Invocation.Builder
| Modifier and Type | Class and Description |
|---|---|
| public static interface | Invocation.Builder
A client request invocation builder. |
| Modifier and Type | Method and Description |
|---|---|
| public Response | |
| public < response type T> T | |
| public < generic response type T> T | Returns: response object of the specified generic type as a result of the request invocation.type literal representing a generic Java type the
response should be converted into. responseType)Synchronously invoke the request and receive a response of the specified generic type back. |
| public Invocation | |
| public Future | |
| public < response type T> Future | |
| public < generic response type T> Future | Returns: future response object of the specified generic type as a result of the request invocation.type literal representing a generic Java type the
response should be converted into. responseType)Submit the request for an asynchronous invocation and receive a future response of the specified generic type back. |
| public < response type T> Future | Returns: future response object of the specified type as a result of the request invocation.invocation callback for asynchronous processing of the
request invocation result. callback)Submit the request for an asynchronous invocation and register an
|
| invoke | back to summary |
|---|---|
| public Response invoke() Synchronously invoke the request and receive a response back.
| |
| invoke | back to summary |
|---|---|
| public <T> T invoke(Class<T> responseType) Synchronously invoke the request and receive a response of the specified type back.
| |
| invoke | back to summary |
|---|---|
| public <T> T invoke(GenericType<T> responseType) Synchronously invoke the request and receive a response of the specified generic type back.
| |
| property | back to summary |
|---|---|
| public Invocation property(String name, Object value) Set a new property in the context of a request represented by this invocation.
The property is available for a later retrieval via
| |
| submit | back to summary |
|---|---|
| public Future Submit the request for an asynchronous invocation and receive a future response back.
Note that calling the | |
| submit | back to summary |
|---|---|
| public <T> Future Submit the request for an asynchronous invocation and receive a future response of the specified type back.
Note that calling the | |
| submit | back to summary |
|---|---|
| public <T> Future Submit the request for an asynchronous invocation and receive a future response of the specified generic type back.
Note that calling the
| |
| submit | back to summary |
|---|---|
| public <T> Future Submit the request for an asynchronous invocation and register an
Note that calling the
| |
request(...)
methods on a resource target, provides methods for
preparing a client request invocation. Once the request is prepared
the invocation builder can be either used to build an Invocation
with a generic execution interface:
Client client = ClientBuilder.newClient();
WebTarget resourceTarget = client.target("http://examples.jaxrs.com/");
// Build a HTTP GET request that accepts "text/plain" response type
// and contains a custom HTTP header entry "Foo: bar".
Invocation invocation = resourceTarget.request("text/plain")
.header("Foo", "bar").buildGet();
// Invoke the request using generic interface
String response = invocation.invoke(String.class);
Alternatively, one of the inherited synchronous invocation
methods can be used to invoke the prepared request and return the server
response in a single step, e.g.:
Client client = ClientBuilder.newClient();
WebTarget resourceTarget = client.target("http://examples.jaxrs.com/");
// Build and invoke the get request in a single step
String response = resourceTarget.request("text/plain")
.header("Foo", "bar").get(String.class);
Once the request is fully prepared for invoking, switching to an
asynchronous invocation mode is possible by
calling the async() method on the builder, e.g.:
Client client = ClientBuilder.newClient();
WebTarget resourceTarget = client.target("http://examples.jaxrs.com/");
// Build and invoke the get request asynchronously in a single step
Future response = resourceTarget.request("text/plain")
.header("Foo", "bar").async().get(String.class);
| Modifier and Type | Method and Description |
|---|---|
| public Invocation. | |
| public Invocation. | |
| public Invocation. | Returns: the updated builder.an array of the acceptable encodings. encodings)Add acceptable encodings. |
| public Invocation. | Returns: the updated builder.an array of the acceptable languages. locales)Add acceptable languages. |
| public Invocation. | Returns: the updated builder.an array of the acceptable languages. locales)Add acceptable languages. |
| public AsyncInvoker | Returns: asynchronous uniform request invocation interface.Access the asynchronous uniform request invocation interface to asynchronously invoke the built request. |
| public Invocation | |
| public Invocation | Returns: invocation encapsulating the built request.request method name. method, Entity<?> request entity, including it's full entity)javax.ws.rs.core.Variant information.
Any variant-related HTTP headers previously set (namely Content-Type,
Content-Language and Content-Encoding) will be overwritten using
the entity variant information.Build a request invocation using an arbitrary request method name and request entity. |
| public Invocation | Returns: invocation encapsulating the built DELETE request.Build a DELETE request invocation. |
| public Invocation | |
| public Invocation | Returns: invocation encapsulating the built POST request.request entity, including it's full entity)javax.ws.rs.core.Variant information.
Any variant-related HTTP headers previously set (namely Content-Type,
Content-Language and Content-Encoding) will be overwritten using
the entity variant information.Build a POST request invocation. |
| public Invocation | Returns: invocation encapsulating the built PUT request.request entity, including it's full entity)javax.ws.rs.core.Variant information.
Any variant-related HTTP headers previously set (namely Content-Type,
Content-Language and Content-Encoding) will be overwritten using
the entity variant information.Build a PUT request invocation. |
| public Invocation. | Returns: the updated builder.the cache control directives, if cacheControl)null
any existing cache control directives will be removed.Set the cache control data of the message. |
| public Invocation. | |
| public Invocation. | |
| public Invocation. | Returns: the updated builder.the name of the header name, Object the value of the header, the header will be serialized
using a value)javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate if
one is available via javax.ws.rs.ext.RuntimeDelegate#createHeaderDelegate(java.lang.Class)
for the class of value or using its toString method
if a header delegate is not available. If value is null
then all current headers of the same name will be removed.Add an arbitrary header. |
| public Invocation. | Returns: the updated builder.new headers to be set, if headers)null all existing
headers will be removed.Replaces all existing headers with the newly supplied headers. |
| public Invocation. | |
| public CompletionStageRxInvoker | Returns: default reactive invoker instance.Access the default reactive invoker based on |
| public <T extends RxInvoker> T |
| accept | back to summary |
|---|---|
| public Invocation. Add the accepted response media types.
| |
| accept | back to summary |
|---|---|
| public Invocation. Add the accepted response media types.
| |
| acceptEncoding | back to summary |
|---|---|
| public Invocation. Add acceptable encodings.
| |
| acceptLanguage | back to summary |
|---|---|
| public Invocation. Add acceptable languages.
| |
| acceptLanguage | back to summary |
|---|---|
| public Invocation. Add acceptable languages.
| |
| async | back to summary |
|---|---|
| public AsyncInvoker async() Access the asynchronous uniform request invocation interface to asynchronously invoke the built request.
| |
| build | back to summary |
|---|---|
| public Invocation build(String method) Build a request invocation using an arbitrary request method name.
| |
| build | back to summary |
|---|---|
| public Invocation build(String method, Entity<?> entity) Build a request invocation using an arbitrary request method name and request entity.
| |
| buildDelete | back to summary |
|---|---|
| public Invocation buildDelete() Build a DELETE request invocation.
| |
| buildGet | back to summary |
|---|---|
| public Invocation buildGet() Build a GET request invocation.
| |
| buildPost | back to summary |
|---|---|
| public Invocation buildPost(Entity<?> entity) Build a POST request invocation.
| |
| buildPut | back to summary |
|---|---|
| public Invocation buildPut(Entity<?> entity) Build a PUT request invocation.
| |
| cacheControl | back to summary |
|---|---|
| public Invocation. Set the cache control data of the message.
| |
| cookie | back to summary |
|---|---|
| public Invocation. Add a cookie to be set.
| |
| cookie | back to summary |
|---|---|
| public Invocation. Add a cookie to be set.
| |
| header | back to summary |
|---|---|
| public Invocation. Add an arbitrary header.
| |
| headers | back to summary |
|---|---|
| public Invocation. Replaces all existing headers with the newly supplied headers.
| |
| property | back to summary |
|---|---|
| public Invocation. Set a new property in the context of a request represented by this invocation builder.
The property is available for a later retrieval via
| |
| rx | back to summary |
|---|---|
| public CompletionStageRxInvoker rx() Access the default reactive invoker based on
| |
| rx | back to summary |
|---|---|
| public <T extends RxInvoker> T rx(Class<T> clazz) Access a reactive invoker based on a This method is an extension point for JAX-RS implementations to support other types representing asynchronous computations.
| |