The {@link oaj.http.annotation.Header @Header} annotation can be applied to arguments of @RemoteOp-annotated methods
to denote that they are header parameters on the request.
- {@link oaj.http.annotation.Header}
- {@link oaj.http.annotation.Header#name() name} - Header name.
- {@link oaj.http.annotation.Header#serializer() serializer} - Override the part serializer.
| @Remote(path="/myproxy")
| public interface MyProxy {
|
| // Explicit names specified for HTTP headers.
| // pojo will be converted to UON notation (unless plain-text parts enabled).
| @RemoteGet("/mymethod1")
| String myProxyMethod1(@Header("Foo") String foo,
| @Header("Bar") MyPojo pojo);
|
| // Multiple values pulled from a HeaderList object.
| // Same as @Header("*").
| @RemoteGet("/mymethod2")
| String myProxyMethod2(@Header HeaderList headerList);
|
| // Multiple values pulled from a Map.
| // Same as @Header("*").
| @RemoteGet("/mymethod3")
| String myProxyMethod3(@Header Map<String,Object> map);
|
| // Multiple values pulled from a bean.
| // Same as @Header("*").
| @RemoteGet("/mymethod4")
| String myProxyMethod4(@Header MyBean myBean);
| }
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.Header#serializer() @Header(serializer)} annotation.
Multi-part arguments (i.e. those with name == "*" or empty) can be any of the following types:
-
{@link oaj.http.header.HeaderList} - Serialized as individual headers.
-
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).
See the link below for information about supported data types in OpenAPI serialization.