Skip to main content

@Response

The @Response annotation can be applied to types returned by @RemoteOp-annotated methods.

Responseparser - Override the part parser.

The @Response annotation can be used to define interfaces for retrieving response parts using a bean-like proxy.

Example
@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:

ContentHeaderStatusCode

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.