The {@link oaj.http.annotation.FormData @FormData} annotation can be applied to arguments of @RemoteOp-annotated methods
to denote that they are form-data parameters on the request.
- {@link oaj.http.annotation.FormData}
- {@link oaj.http.annotation.FormData#name() name} - Form data entry name.
- {@link oaj.http.annotation.FormData#serializer() serializer} - Override the part serializer.
| @Remote(path="/myproxy")
| public interface MyProxy {
|
| // Explicit names specified for form data parameters.
| @RemotePost
| String postParameters(
| @FormData("foo") String foo,
| @FormData("bar") MyPojo pojo
| );
|
| // Multiple values pulled from a PartList object.
| // Name "*" is inferred.
| @RemotePost
| String postPartList(@FormData PartList partList);
|
| // Multiple values pulled from a Map.
| @RemotePost
| String postMap(@FormData Map<String,Object> map);
|
| // Multiple values pulled from a bean.
| @RemotePost
| String postBean(@FormData MyBean bean);
|
| // An entire form-data HTTP body as a String.
| @RemotePost
| String postString(@FormData String string);
|
| // An entire form-data HTTP body as a Reader.
| @RemotePost
| String postReader(@FormData Reader reader);
| }
Single-part arguments (i.e. those with name != "*") can be any of the following types:
-
Any serializable POJO - Converted to a string using the {@link oaj.httppart.HttpPartSerializer} registered with the
RestClient ({@link oaj.oapi.OpenApiSerializer} by default) or associated via the {@link oaj.http.annotation.FormData#serializer() @FormData(serializer)} annotation.
Multi-part arguments (i.e. those with name == "*" or empty) can be any of the following types:
-
{@link java.io.Reader} - Raw contents of {@code Reader} will be serialized to remote resource.
-
{@link java.io.InputStream} - Raw contents of {@code InputStream} will be serialized to remote resource.
-
{@link oaj.http.part.PartList} - Converted to a URL-encoded FORM post.
-
Map - Converted to key-value pairs.
Values serialized using the registered {@link oaj.httppart.HttpPartSerializer} ({@link oaj.oapi.OpenApiSerializer} by default).
-
Bean - Converted to key-value pairs.
Values serialized using the registered {@link oaj.httppart.HttpPartSerializer} ({@link oaj.oapi.OpenApiSerializer} by default).
-
CharSequence - Used directly as am "application/x-www-form-urlencoded" entity.
See the link below for information about supported data types in OpenAPI serialization.