Package org.glassfish.jersey.client
Class JerseyInvocation.Builder
- java.lang.Object
-
- org.glassfish.jersey.client.JerseyInvocation.Builder
-
- All Implemented Interfaces:
Invocation.Builder,SyncInvoker
- Enclosing class:
- JerseyInvocation
public static class JerseyInvocation.Builder extends Object implements Invocation.Builder
Jersey-specificclient invocation builder.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBuilder(URI uri, ClientConfig configuration)Create new Jersey-specific client invocation builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JerseyInvocation.Builderaccept(MediaType... mediaTypes)Add the accepted response media types.JerseyInvocation.Builderaccept(String... mediaTypes)Add the accepted response media types.Invocation.BuilderacceptEncoding(String... encodings)Add acceptable encodings.JerseyInvocation.BuilderacceptLanguage(String... locales)Add acceptable languages.JerseyInvocation.BuilderacceptLanguage(Locale... locales)Add acceptable languages.AsyncInvokerasync()Access the asynchronous uniform request invocation interface to asynchronously invoke the built request.JerseyInvocationbuild(String method)Build a request invocation using an arbitrary request method name.JerseyInvocationbuild(String method, Entity<?> entity)Build a request invocation using an arbitrary request method name and request entity.JerseyInvocationbuildDelete()Build a DELETE request invocation.JerseyInvocationbuildGet()Build a GET request invocation.JerseyInvocationbuildPost(Entity<?> entity)Build a POST request invocation.JerseyInvocationbuildPut(Entity<?> entity)Build a PUT request invocation.JerseyInvocation.BuildercacheControl(CacheControl cacheControl)Set the cache control data of the message.JerseyInvocation.Buildercookie(Cookie cookie)Add a cookie to be set.JerseyInvocation.Buildercookie(String name, String value)Add a cookie to be set.Responsedelete()Invoke HTTP DELETE method for the current request synchronously.<T> Tdelete(GenericType<T> responseType)Invoke HTTP DELETE method for the current request synchronously.<T> Tdelete(Class<T> responseType)Invoke HTTP DELETE method for the current request synchronously.Responseget()Invoke HTTP GET method for the current request synchronously.<T> Tget(GenericType<T> responseType)Invoke HTTP GET method for the current request synchronously.<T> Tget(Class<T> responseType)Invoke HTTP GET method for the current request synchronously.Responsehead()Invoke HTTP HEAD method for the current request synchronously.JerseyInvocation.Builderheader(String name, Object value)Add an arbitrary header.JerseyInvocation.Builderheaders(MultivaluedMap<String,Object> headers)Replaces all existing headers with the newly supplied headers.Responsemethod(String name)Invoke an arbitrary method for the current request synchronously.Responsemethod(String name, Entity<?> entity)Invoke an arbitrary method for the current request synchronously.<T> Tmethod(String name, Entity<?> entity, GenericType<T> responseType)Invoke an arbitrary method for the current request synchronously.<T> Tmethod(String name, Entity<?> entity, Class<T> responseType)Invoke an arbitrary method for the current request synchronously.<T> Tmethod(String name, GenericType<T> responseType)Invoke an arbitrary method for the current request synchronously.<T> Tmethod(String name, Class<T> responseType)Invoke an arbitrary method for the current request synchronously.Responseoptions()Invoke HTTP OPTIONS method for the current request synchronously.<T> Toptions(GenericType<T> responseType)Invoke HTTP OPTIONS method for the current request synchronously.<T> Toptions(Class<T> responseType)Invoke HTTP OPTIONS method for the current request synchronously.Responsepost(Entity<?> entity)Invoke HTTP POST method for the current request synchronously.<T> Tpost(Entity<?> entity, GenericType<T> responseType)Invoke HTTP POST method for the current request synchronously.<T> Tpost(Entity<?> entity, Class<T> responseType)Invoke HTTP POST method for the current request synchronously.JerseyInvocation.Builderproperty(String name, Object value)Set a new property in the context of a request represented by this invocation builder.Responseput(Entity<?> entity)Invoke HTTP PUT method for the current request synchronously.<T> Tput(Entity<?> entity, GenericType<T> responseType)Invoke HTTP PUT method for the current request synchronously.<T> Tput(Entity<?> entity, Class<T> responseType)Invoke HTTP PUT method for the current request synchronously.CompletionStageRxInvokerrx()Access the default reactive invoker based onCompletionStage.<T extends RxInvoker>
Trx(Class<T> clazz)Access a reactive invoker based on aRxInvokersubclass provider.Responsetrace()Invoke HTTP TRACE method for the current request synchronously.<T> Ttrace(GenericType<T> responseType)Invoke HTTP TRACE method for the current request synchronously.<T> Ttrace(Class<T> responseType)Invoke HTTP TRACE method for the current request synchronously.
-
-
-
Constructor Detail
-
Builder
protected Builder(URI uri, ClientConfig configuration)
Create new Jersey-specific client invocation builder.- Parameters:
uri- invoked request URI.configuration- Jersey client configuration.
-
-
Method Detail
-
build
public JerseyInvocation build(String method)
Description copied from interface:Invocation.BuilderBuild a request invocation using an arbitrary request method name.- Specified by:
buildin interfaceInvocation.Builder- Parameters:
method- request method name.- Returns:
- invocation encapsulating the built request.
-
build
public JerseyInvocation build(String method, Entity<?> entity)
Description copied from interface:Invocation.BuilderBuild a request invocation using an arbitrary request method name and request entity.- Specified by:
buildin interfaceInvocation.Builder- Parameters:
method- request method name.entity- request entity, including it's fullVariantinformation. Any variant-related HTTP headers previously set (namelyContent-Type,Content-LanguageandContent-Encoding) will be overwritten using the entity variant information.- Returns:
- invocation encapsulating the built request.
-
buildGet
public JerseyInvocation buildGet()
Description copied from interface:Invocation.BuilderBuild a GET request invocation.- Specified by:
buildGetin interfaceInvocation.Builder- Returns:
- invocation encapsulating the built GET request.
-
buildDelete
public JerseyInvocation buildDelete()
Description copied from interface:Invocation.BuilderBuild a DELETE request invocation.- Specified by:
buildDeletein interfaceInvocation.Builder- Returns:
- invocation encapsulating the built DELETE request.
-
buildPost
public JerseyInvocation buildPost(Entity<?> entity)
Description copied from interface:Invocation.BuilderBuild a POST request invocation.- Specified by:
buildPostin interfaceInvocation.Builder- Parameters:
entity- request entity, including it's fullVariantinformation. Any variant-related HTTP headers previously set (namelyContent-Type,Content-LanguageandContent-Encoding) will be overwritten using the entity variant information.- Returns:
- invocation encapsulating the built POST request.
-
buildPut
public JerseyInvocation buildPut(Entity<?> entity)
Description copied from interface:Invocation.BuilderBuild a PUT request invocation.- Specified by:
buildPutin interfaceInvocation.Builder- Parameters:
entity- request entity, including it's fullVariantinformation. Any variant-related HTTP headers previously set (namelyContent-Type,Content-LanguageandContent-Encoding) will be overwritten using the entity variant information.- Returns:
- invocation encapsulating the built PUT request.
-
async
public AsyncInvoker async()
Description copied from interface:Invocation.BuilderAccess the asynchronous uniform request invocation interface to asynchronously invoke the built request.- Specified by:
asyncin interfaceInvocation.Builder- Returns:
- asynchronous uniform request invocation interface.
-
accept
public JerseyInvocation.Builder accept(String... mediaTypes)
Description copied from interface:Invocation.BuilderAdd the accepted response media types.- Specified by:
acceptin interfaceInvocation.Builder- Parameters:
mediaTypes- accepted response media types.- Returns:
- the updated builder.
-
accept
public JerseyInvocation.Builder accept(MediaType... mediaTypes)
Description copied from interface:Invocation.BuilderAdd the accepted response media types.- Specified by:
acceptin interfaceInvocation.Builder- Parameters:
mediaTypes- accepted response media types.- Returns:
- the updated builder.
-
acceptEncoding
public Invocation.Builder acceptEncoding(String... encodings)
Description copied from interface:Invocation.BuilderAdd acceptable encodings.- Specified by:
acceptEncodingin interfaceInvocation.Builder- Parameters:
encodings- an array of the acceptable encodings.- Returns:
- the updated builder.
-
acceptLanguage
public JerseyInvocation.Builder acceptLanguage(Locale... locales)
Description copied from interface:Invocation.BuilderAdd acceptable languages.- Specified by:
acceptLanguagein interfaceInvocation.Builder- Parameters:
locales- an array of the acceptable languages.- Returns:
- the updated builder.
-
acceptLanguage
public JerseyInvocation.Builder acceptLanguage(String... locales)
Description copied from interface:Invocation.BuilderAdd acceptable languages.- Specified by:
acceptLanguagein interfaceInvocation.Builder- Parameters:
locales- an array of the acceptable languages.- Returns:
- the updated builder.
-
cookie
public JerseyInvocation.Builder cookie(Cookie cookie)
Description copied from interface:Invocation.BuilderAdd a cookie to be set.- Specified by:
cookiein interfaceInvocation.Builder- Parameters:
cookie- to be set.- Returns:
- the updated builder.
-
cookie
public JerseyInvocation.Builder cookie(String name, String value)
Description copied from interface:Invocation.BuilderAdd a cookie to be set.- Specified by:
cookiein interfaceInvocation.Builder- Parameters:
name- the name of the cookie.value- the value of the cookie.- Returns:
- the updated builder.
-
cacheControl
public JerseyInvocation.Builder cacheControl(CacheControl cacheControl)
Description copied from interface:Invocation.BuilderSet the cache control data of the message.- Specified by:
cacheControlin interfaceInvocation.Builder- Parameters:
cacheControl- the cache control directives, ifnullany existing cache control directives will be removed.- Returns:
- the updated builder.
-
header
public JerseyInvocation.Builder header(String name, Object value)
Description copied from interface:Invocation.BuilderAdd an arbitrary header.- Specified by:
headerin interfaceInvocation.Builder- Parameters:
name- the name of the headervalue- the value of the header, the header will be serialized using aRuntimeDelegate.HeaderDelegateif one is available viaRuntimeDelegate.createHeaderDelegate(java.lang.Class)for the class ofvalueor using itstoStringmethod if a header delegate is not available. Ifvalueisnullthen all current headers of the same name will be removed.- Returns:
- the updated builder.
-
headers
public JerseyInvocation.Builder headers(MultivaluedMap<String,Object> headers)
Description copied from interface:Invocation.BuilderReplaces all existing headers with the newly supplied headers.- Specified by:
headersin interfaceInvocation.Builder- Parameters:
headers- new headers to be set, ifnullall existing headers will be removed.- Returns:
- the updated builder.
-
get
public Response get() throws ProcessingException
Description copied from interface:SyncInvokerInvoke HTTP GET method for the current request synchronously.- Specified by:
getin interfaceSyncInvoker- Returns:
- invocation response.
- Throws:
ProcessingException- in case the invocation processing has failed.
-
get
public <T> T get(Class<T> responseType) throws ProcessingException, WebApplicationException
Description copied from interface:SyncInvokerInvoke HTTP GET method for the current request synchronously.- Specified by:
getin interfaceSyncInvoker- Type Parameters:
T- response entity type.- Parameters:
responseType- Java type the response entity will be converted to.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.WebApplicationException- in case the response status code of the response returned by the server is notsuccessfuland the specified response type is notResponse.
-
get
public <T> T get(GenericType<T> responseType) throws ProcessingException, WebApplicationException
Description copied from interface:SyncInvokerInvoke HTTP GET method for the current request synchronously.- Specified by:
getin interfaceSyncInvoker- Type Parameters:
T- generic response entity type.- Parameters:
responseType- representation of a generic Java type the response entity will be converted to.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.WebApplicationException- in case the response status code of the response returned by the server is notsuccessfuland the specified generic response type does not representResponse
-
put
public Response put(Entity<?> entity) throws ProcessingException
Description copied from interface:SyncInvokerInvoke HTTP PUT method for the current request synchronously.- Specified by:
putin interfaceSyncInvoker- Parameters:
entity- request entity, including it's fullVariantinformation. Any variant-related HTTP headers previously set (namelyContent-Type,Content-LanguageandContent-Encoding) will be overwritten using the entity variant information.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.
-
put
public <T> T put(Entity<?> entity, Class<T> responseType) throws ProcessingException, WebApplicationException
Description copied from interface:SyncInvokerInvoke HTTP PUT method for the current request synchronously.- Specified by:
putin interfaceSyncInvoker- Type Parameters:
T- response entity type.- Parameters:
entity- request entity, including it's fullVariantinformation. Any variant-related HTTP headers previously set (namelyContent-Type,Content-LanguageandContent-Encoding) will be overwritten using the entity variant information.responseType- Java type the response entity will be converted to.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.WebApplicationException- in case the response status code of the response returned by the server is notsuccessfuland the specified response type is notResponse.
-
put
public <T> T put(Entity<?> entity, GenericType<T> responseType) throws ProcessingException, WebApplicationException
Description copied from interface:SyncInvokerInvoke HTTP PUT method for the current request synchronously.- Specified by:
putin interfaceSyncInvoker- Type Parameters:
T- generic response entity type.- Parameters:
entity- request entity, including it's fullVariantinformation. Any variant-related HTTP headers previously set (namelyContent-Type,Content-LanguageandContent-Encoding) will be overwritten using the entity variant information.responseType- representation of a generic Java type the response entity will be converted to.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.WebApplicationException- in case the response status code of the response returned by the server is notsuccessfuland the specified generic response type does not representResponse.
-
post
public Response post(Entity<?> entity) throws ProcessingException
Description copied from interface:SyncInvokerInvoke HTTP POST method for the current request synchronously.- Specified by:
postin interfaceSyncInvoker- Parameters:
entity- request entity, including it's fullVariantinformation. Any variant-related HTTP headers previously set (namelyContent-Type,Content-LanguageandContent-Encoding) will be overwritten using the entity variant information.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.
-
post
public <T> T post(Entity<?> entity, Class<T> responseType) throws ProcessingException, WebApplicationException
Description copied from interface:SyncInvokerInvoke HTTP POST method for the current request synchronously.- Specified by:
postin interfaceSyncInvoker- Type Parameters:
T- response entity type.- Parameters:
entity- request entity, including it's fullVariantinformation. Any variant-related HTTP headers previously set (namelyContent-Type,Content-LanguageandContent-Encoding) will be overwritten using the entity variant information.responseType- Java type the response entity will be converted to.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.WebApplicationException- in case the response status code of the response returned by the server is notsuccessfuland the specified response type is notResponse.
-
post
public <T> T post(Entity<?> entity, GenericType<T> responseType) throws ProcessingException, WebApplicationException
Description copied from interface:SyncInvokerInvoke HTTP POST method for the current request synchronously.- Specified by:
postin interfaceSyncInvoker- Type Parameters:
T- generic response entity type.- Parameters:
entity- request entity, including it's fullVariantinformation. Any variant-related HTTP headers previously set (namelyContent-Type,Content-LanguageandContent-Encoding) will be overwritten using the entity variant information.responseType- representation of a generic Java type the response entity will be converted to.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.WebApplicationException- in case the response status code of the response returned by the server is notsuccessfuland the specified generic response type does not representResponse.
-
delete
public Response delete() throws ProcessingException
Description copied from interface:SyncInvokerInvoke HTTP DELETE method for the current request synchronously.- Specified by:
deletein interfaceSyncInvoker- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.
-
delete
public <T> T delete(Class<T> responseType) throws ProcessingException, WebApplicationException
Description copied from interface:SyncInvokerInvoke HTTP DELETE method for the current request synchronously.- Specified by:
deletein interfaceSyncInvoker- Type Parameters:
T- response entity type.- Parameters:
responseType- Java type the response entity will be converted to.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.WebApplicationException- in case the response status code of the response returned by the server is notsuccessfuland the specified response type is notResponse.
-
delete
public <T> T delete(GenericType<T> responseType) throws ProcessingException, WebApplicationException
Description copied from interface:SyncInvokerInvoke HTTP DELETE method for the current request synchronously.- Specified by:
deletein interfaceSyncInvoker- Type Parameters:
T- generic response entity type.- Parameters:
responseType- representation of a generic Java type the response entity will be converted to.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.WebApplicationException- in case the response status code of the response returned by the server is notsuccessfuland the specified generic response type does not representResponse.
-
head
public Response head() throws ProcessingException
Description copied from interface:SyncInvokerInvoke HTTP HEAD method for the current request synchronously.- Specified by:
headin interfaceSyncInvoker- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.
-
options
public Response options() throws ProcessingException
Description copied from interface:SyncInvokerInvoke HTTP OPTIONS method for the current request synchronously.- Specified by:
optionsin interfaceSyncInvoker- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.
-
options
public <T> T options(Class<T> responseType) throws ProcessingException, WebApplicationException
Description copied from interface:SyncInvokerInvoke HTTP OPTIONS method for the current request synchronously.- Specified by:
optionsin interfaceSyncInvoker- Type Parameters:
T- response entity type.- Parameters:
responseType- Java type the response entity will be converted to.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.WebApplicationException- in case the response status code of the response returned by the server is notsuccessfuland the specified response type is notResponse.
-
options
public <T> T options(GenericType<T> responseType) throws ProcessingException, WebApplicationException
Description copied from interface:SyncInvokerInvoke HTTP OPTIONS method for the current request synchronously.- Specified by:
optionsin interfaceSyncInvoker- Type Parameters:
T- generic response entity type.- Parameters:
responseType- representation of a generic Java type the response entity will be converted to.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.WebApplicationException- in case the response status code of the response returned by the server is notsuccessfuland the specified generic response type does not representResponse.
-
trace
public Response trace() throws ProcessingException
Description copied from interface:SyncInvokerInvoke HTTP TRACE method for the current request synchronously.- Specified by:
tracein interfaceSyncInvoker- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.
-
trace
public <T> T trace(Class<T> responseType) throws ProcessingException, WebApplicationException
Description copied from interface:SyncInvokerInvoke HTTP TRACE method for the current request synchronously.- Specified by:
tracein interfaceSyncInvoker- Type Parameters:
T- response entity type.- Parameters:
responseType- Java type the response entity will be converted to.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.WebApplicationException- in case the response status code of the response returned by the server is notsuccessfuland the specified response type is notResponse.
-
trace
public <T> T trace(GenericType<T> responseType) throws ProcessingException, WebApplicationException
Description copied from interface:SyncInvokerInvoke HTTP TRACE method for the current request synchronously.- Specified by:
tracein interfaceSyncInvoker- Type Parameters:
T- generic response entity type.- Parameters:
responseType- representation of a generic Java type the response entity will be converted to.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.WebApplicationException- in case the response status code of the response returned by the server is notsuccessfuland the specified generic response type does not representResponse.
-
method
public Response method(String name) throws ProcessingException
Description copied from interface:SyncInvokerInvoke an arbitrary method for the current request synchronously.- Specified by:
methodin interfaceSyncInvoker- Parameters:
name- method name.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.
-
method
public <T> T method(String name, Class<T> responseType) throws ProcessingException, WebApplicationException
Description copied from interface:SyncInvokerInvoke an arbitrary method for the current request synchronously.- Specified by:
methodin interfaceSyncInvoker- Type Parameters:
T- response entity type.- Parameters:
name- method name.responseType- Java type the response entity will be converted to.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.WebApplicationException- in case the response status code of the response returned by the server is notsuccessfuland the specified response type is notResponse.
-
method
public <T> T method(String name, GenericType<T> responseType) throws ProcessingException, WebApplicationException
Description copied from interface:SyncInvokerInvoke an arbitrary method for the current request synchronously.- Specified by:
methodin interfaceSyncInvoker- Type Parameters:
T- generic response entity type.- Parameters:
name- method name.responseType- representation of a generic Java type the response entity will be converted to.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.WebApplicationException- in case the response status code of the response returned by the server is notsuccessfuland the specified generic response type does not representResponse.
-
method
public Response method(String name, Entity<?> entity) throws ProcessingException
Description copied from interface:SyncInvokerInvoke an arbitrary method for the current request synchronously.- Specified by:
methodin interfaceSyncInvoker- Parameters:
name- method name.entity- request entity, including it's fullVariantinformation. Any variant-related HTTP headers previously set (namelyContent-Type,Content-LanguageandContent-Encoding) will be overwritten using the entity variant information.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.
-
method
public <T> T method(String name, Entity<?> entity, Class<T> responseType) throws ProcessingException, WebApplicationException
Description copied from interface:SyncInvokerInvoke an arbitrary method for the current request synchronously.- Specified by:
methodin interfaceSyncInvoker- Type Parameters:
T- response entity type.- Parameters:
name- method name.entity- request entity, including it's fullVariantinformation. Any variant-related HTTP headers previously set (namelyContent-Type,Content-LanguageandContent-Encoding) will be overwritten using the entity variant information.responseType- Java type the response entity will be converted to.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.WebApplicationException- in case the response status code of the response returned by the server is notsuccessfuland the specified response type is notResponse.
-
method
public <T> T method(String name, Entity<?> entity, GenericType<T> responseType) throws ProcessingException, WebApplicationException
Description copied from interface:SyncInvokerInvoke an arbitrary method for the current request synchronously.- Specified by:
methodin interfaceSyncInvoker- Type Parameters:
T- generic response entity type.- Parameters:
name- method name.entity- request entity, including it's fullVariantinformation. Any variant-related HTTP headers previously set (namelyContent-Type,Content-LanguageandContent-Encoding) will be overwritten using the entity variant information.responseType- representation of a generic Java type the response entity will be converted to.- Returns:
- invocation response.
- Throws:
ResponseProcessingException- in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).ProcessingException- in case the request processing or subsequent I/O operation fails.WebApplicationException- in case the response status code of the response returned by the server is notsuccessfuland the specified generic response type does not representResponse.
-
property
public JerseyInvocation.Builder property(String name, Object value)
Description copied from interface:Invocation.BuilderSet a new property in the context of a request represented by this invocation builder.The property is available for a later retrieval via
ClientRequestContext.getProperty(String)orInterceptorContext.getProperty(String). If a property with a given name is already set in the request context, the existing value of the property will be updated. Setting anullvalue into a property effectively removes the property from the request property bag.- Specified by:
propertyin interfaceInvocation.Builder- Parameters:
name- property name.value- (new) property value.nullvalue removes the property with the given name.- Returns:
- the updated builder.
- See Also:
Invocation.property(String, Object)
-
rx
public CompletionStageRxInvoker rx()
Description copied from interface:Invocation.BuilderAccess the default reactive invoker based onCompletionStage.- Specified by:
rxin interfaceInvocation.Builder- Returns:
- default reactive invoker instance.
- See Also:
Invocation.Builder.rx(Class)
-
rx
public <T extends RxInvoker> T rx(Class<T> clazz)
Description copied from interface:Invocation.BuilderAccess a reactive invoker based on aRxInvokersubclass provider. Note that correspondingRxInvokerProvidermust be registered in the client runtime.This method is an extension point for JAX-RS implementations to support other types representing asynchronous computations.
- Specified by:
rxin interfaceInvocation.Builder- Type Parameters:
T- generic invoker type.- Parameters:
clazz-RxInvokersubclass.- Returns:
- reactive invoker instance.
- See Also:
Configurable.register(Class)
-
-