The {@link oaj.http.annotation.Response @Response} annotation can be applied to types returned by @RemoteOp-annotated methods.
- {@link oaj.http.annotation.Response}
- {@link oaj.http.annotation.Response#parser() parser} - Override the part parser.
The @Response annotation can be used to define interfaces for retrieving response parts using a bean-like proxy.
| @Remote
| public interface PetStore {
|
| @RemotePost
| CreatePetResponse postPet(...);
| }
| @Response
| public interface CreatePetResponse {
|
| @Content
| Pet getContent();
|
| @Header("E-Tag")
| UUID getUUID();
|
| @StatusCode
| int getStatus();
| }
| PetStore store = client.getRemote(PetStore.class, "http://localhost:10000");
|
| CreatePetResponse response = store.postPet(...);
| Pet pet = response.getContent();
| UUID uuid = response.getUUID();
| int status = response.getStatus();
The annotated methods must be no-arg.
They can be named anything.
Any of the following annotations can be used on the methods:
- {@link oaj.http.annotation.Content}
- {@link oaj.http.annotation.Header}
- {@link oaj.http.annotation.StatusCode}
The behavior and functionality of all of the annotations are the same as if they were used on method arguments directly. This means full support for OpenAPI serialization and validation.