@Response
The {@link oaj.http.annotation.Response @Response} annotation can be applied to types returned by @RemoteMethod-annotated methods.
- {@link oaj.http.annotation.Response}
- {@link oaj.http.annotation.Response#partParser() partParser} - 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 {
@RemoteMethod
CreatePetResponse postPet(...);
}
@Response
public interface CreatePetResponse {
@ResponseBody
Pet getBody();
@ResponseHeader("E-Tag")
UUID getUUID();
@ResponseStatus
int getStatus();
}
PetStore store = restClient.getRemote(PetStore.class, "http://localhost:10000");
CreatePetResponse response = store.postPet(...);
Pet pet = response.getBody();
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.ResponseBody}
- {@link oaj.http.annotation.ResponseHeader}
- {@link oaj.http.annotation.ResponseStatus}
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.