org.glassfish.jersey.client
Class JerseyInvocation.Builder

java.lang.Object
  extended by org.glassfish.jersey.client.JerseyInvocation.Builder
All Implemented Interfaces:
Invocation.Builder, SyncInvoker, Configurable<Invocation.Builder>
Enclosing class:
JerseyInvocation

public static class JerseyInvocation.Builder
extends Object
implements Invocation.Builder

Jersey-specific client invocation builder.


Constructor Summary
protected JerseyInvocation.Builder(URI uri, ClientConfig configuration)
          Create new Jersey-specific client invocation builder.
 
Method Summary
 JerseyInvocation.Builder accept(MediaType... mediaTypes)
          Add the accepted response media types.
 JerseyInvocation.Builder accept(String... mediaTypes)
          Add the accepted response media types.
 Invocation.Builder acceptEncoding(String... encodings)
          Add acceptable encodings.
 JerseyInvocation.Builder acceptLanguage(Locale... locales)
          Add acceptable languages.
 JerseyInvocation.Builder acceptLanguage(String... locales)
          Add acceptable languages.
 AsyncInvoker async()
          Access the asynchronous uniform request invocation interface to asynchronously invoke the built request.
 JerseyInvocation build(String method)
          Build a request invocation using an arbitrary request method name.
 JerseyInvocation build(String method, Entity<?> entity)
          Build a request invocation using an arbitrary request method name and request entity.
 JerseyInvocation buildDelete()
          Build a DELETE request invocation.
 JerseyInvocation buildGet()
          Build a GET request invocation.
 JerseyInvocation buildPost(Entity<?> entity)
          Build a POST request invocation.
 JerseyInvocation buildPut(Entity<?> entity)
          Build a PUT request invocation.
 JerseyInvocation.Builder cacheControl(CacheControl cacheControl)
          Set the cache control data of the message.
 JerseyInvocation.Builder cookie(Cookie cookie)
          Add a cookie to be set.
 JerseyInvocation.Builder cookie(String name, String value)
          Add a cookie to be set.
 Response delete()
          Invoke HTTP DELETE method for the current request synchronously.
<T> T
delete(Class<T> responseType)
          Invoke HTTP DELETE method for the current request synchronously.
<T> T
delete(GenericType<T> responseType)
          Invoke HTTP DELETE method for the current request synchronously.
 Response get()
          Invoke HTTP GET method for the current request synchronously.
<T> T
get(Class<T> responseType)
          Invoke HTTP GET method for the current request synchronously.
<T> T
get(GenericType<T> responseType)
          Invoke HTTP GET method for the current request synchronously.
 ClientConfig getConfiguration()
          Get a live view of an internal configuration state of this configurable instance.
 Response head()
          Invoke HTTP HEAD method for the current request synchronously.
 JerseyInvocation.Builder header(String name, Object value)
          Add an arbitrary header.
 JerseyInvocation.Builder headers(MultivaluedMap<String,Object> headers)
          Replaces all existing headers with the newly supplied headers.
 Response method(String name)
          Invoke an arbitrary method for the current request synchronously.
<T> T
method(String name, Class<T> responseType)
          Invoke an arbitrary method for the current request synchronously.
 Response method(String name, Entity<?> entity)
          Invoke an arbitrary method for the current request synchronously.
<T> T
method(String name, Entity<?> entity, Class<T> responseType)
          Invoke an arbitrary method for the current request synchronously.
<T> T
method(String name, Entity<?> entity, GenericType<T> responseType)
          Invoke an arbitrary method for the current request synchronously.
<T> T
method(String name, GenericType<T> responseType)
          Invoke an arbitrary method for the current request synchronously.
 Response options()
          Invoke HTTP OPTIONS method for the current request synchronously.
<T> T
options(Class<T> responseType)
          Invoke HTTP OPTIONS method for the current request synchronously.
<T> T
options(GenericType<T> responseType)
          Invoke HTTP OPTIONS method for the current request synchronously.
 Response post(Entity<?> entity)
          Invoke HTTP POST method for the current request synchronously.
<T> T
post(Entity<?> entity, Class<T> responseType)
          Invoke HTTP POST method for the current request synchronously.
<T> T
post(Entity<?> entity, GenericType<T> responseType)
          Invoke HTTP POST method for the current request synchronously.
 JerseyInvocation.Builder preInitialize()
          Pre initializes the configuration of this invocation builder in order to improve performance during the first request.
 JerseyInvocation.Builder property(String name, Object value)
          Set the new configuration property, if already set, the existing value of the property will be updated.
 Response put(Entity<?> entity)
          Invoke HTTP PUT method for the current request synchronously.
<T> T
put(Entity<?> entity, Class<T> responseType)
          Invoke HTTP PUT method for the current request synchronously.
<T> T
put(Entity<?> entity, GenericType<T> responseType)
          Invoke HTTP PUT method for the current request synchronously.
 JerseyInvocation.Builder register(Class<?> providerClass)
          Register a class of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context.
 JerseyInvocation.Builder register(Class<?> providerClass, Class<?>... contracts)
          Register a class of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context.
 JerseyInvocation.Builder register(Class<?> providerClass, int bindingPriority)
          Register a class of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context.
 JerseyInvocation.Builder register(Class<?> providerClass, Map<Class<?>,Integer> contracts)
          Register a class of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context.
 JerseyInvocation.Builder register(Object provider)
          Register an instance of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context.
 JerseyInvocation.Builder register(Object provider, Class<?>... contracts)
          Register an instance of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context.
 JerseyInvocation.Builder register(Object provider, int bindingPriority)
          Register an instance of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context.
 JerseyInvocation.Builder register(Object provider, Map<Class<?>,Integer> contracts)
          Register an instance of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context.
 JerseyInvocation.Builder replaceWith(Configuration config)
          Replace the existing configuration state with an externally provided configuration state.
 Response trace()
          Invoke HTTP TRACE method for the current request synchronously.
<T> T
trace(Class<T> responseType)
          Invoke HTTP TRACE method for the current request synchronously.
<T> T
trace(GenericType<T> responseType)
          Invoke HTTP TRACE method for the current request synchronously.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JerseyInvocation.Builder

protected JerseyInvocation.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.Builder
Build a request invocation using an arbitrary request method name.

Specified by:
build in interface Invocation.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.Builder
Build a request invocation using an arbitrary request method name and request entity.

Specified by:
build in interface Invocation.Builder
Parameters:
method - request method name.
entity - request entity, including it's full 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.
Returns:
invocation encapsulating the built request.

buildGet

public JerseyInvocation buildGet()
Description copied from interface: Invocation.Builder
Build a GET request invocation.

Specified by:
buildGet in interface Invocation.Builder
Returns:
invocation encapsulating the built GET request.

buildDelete

public JerseyInvocation buildDelete()
Description copied from interface: Invocation.Builder
Build a DELETE request invocation.

Specified by:
buildDelete in interface Invocation.Builder
Returns:
invocation encapsulating the built DELETE request.

buildPost

public JerseyInvocation buildPost(Entity<?> entity)
Description copied from interface: Invocation.Builder
Build a POST request invocation.

Specified by:
buildPost in interface Invocation.Builder
Parameters:
entity - request entity, including it's full 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.
Returns:
invocation encapsulating the built POST request.

buildPut

public JerseyInvocation buildPut(Entity<?> entity)
Description copied from interface: Invocation.Builder
Build a PUT request invocation.

Specified by:
buildPut in interface Invocation.Builder
Parameters:
entity - request entity, including it's full 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.
Returns:
invocation encapsulating the built PUT request.

async

public AsyncInvoker async()
Description copied from interface: Invocation.Builder
Access the asynchronous uniform request invocation interface to asynchronously invoke the built request.

Specified by:
async in interface Invocation.Builder
Returns:
asynchronous uniform request invocation interface.

accept

public JerseyInvocation.Builder accept(String... mediaTypes)
Description copied from interface: Invocation.Builder
Add the accepted response media types.

Specified by:
accept in interface Invocation.Builder
Parameters:
mediaTypes - accepted response media types.
Returns:
the updated builder.

accept

public JerseyInvocation.Builder accept(MediaType... mediaTypes)
Description copied from interface: Invocation.Builder
Add the accepted response media types.

Specified by:
accept in interface Invocation.Builder
Parameters:
mediaTypes - accepted response media types.
Returns:
the updated builder.

acceptEncoding

public Invocation.Builder acceptEncoding(String... encodings)
Description copied from interface: Invocation.Builder
Add acceptable encodings.

Specified by:
acceptEncoding in interface Invocation.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.Builder
Add acceptable languages.

Specified by:
acceptLanguage in interface Invocation.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.Builder
Add acceptable languages.

Specified by:
acceptLanguage in interface Invocation.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.Builder
Add a cookie to be set.

Specified by:
cookie in interface Invocation.Builder
Parameters:
cookie - to be set.
Returns:
the updated builder.

cookie

public JerseyInvocation.Builder cookie(String name,
                                       String value)
Description copied from interface: Invocation.Builder
Add a cookie to be set.

Specified by:
cookie in interface Invocation.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.Builder
Set the cache control data of the message.

Specified by:
cacheControl in interface Invocation.Builder
Parameters:
cacheControl - the cache control directives, if null any 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.Builder
Add an arbitrary header.

Specified by:
header in interface Invocation.Builder
Parameters:
name - the name of the header
value - the value of the header, the header will be serialized using a RuntimeDelegate.HeaderDelegate if one is available via 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.
Returns:
the updated builder.

headers

public JerseyInvocation.Builder headers(MultivaluedMap<String,Object> headers)
Description copied from interface: Invocation.Builder
Replaces all existing headers with the newly supplied headers.

Specified by:
headers in interface Invocation.Builder
Parameters:
headers - new headers to be set, if null all existing headers will be removed.
Returns:
the updated builder.

get

public Response get()
             throws ProcessingException
Description copied from interface: SyncInvoker
Invoke HTTP GET method for the current request synchronously.

Specified by:
get in interface SyncInvoker
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: SyncInvoker
Invoke HTTP GET method for the current request synchronously.

Specified by:
get in interface SyncInvoker
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 not successful and the specified response type is not Response.

get

public <T> T get(GenericType<T> responseType)
      throws ProcessingException,
             WebApplicationException
Description copied from interface: SyncInvoker
Invoke HTTP GET method for the current request synchronously.

Specified by:
get in interface SyncInvoker
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 not successful and the specified generic response type does not represent Response

put

public Response put(Entity<?> entity)
             throws ProcessingException
Description copied from interface: SyncInvoker
Invoke HTTP PUT method for the current request synchronously.

Specified by:
put in interface SyncInvoker
Parameters:
entity - request entity, including it's full 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.
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: SyncInvoker
Invoke HTTP PUT method for the current request synchronously.

Specified by:
put in interface SyncInvoker
Type Parameters:
T - response entity type.
Parameters:
entity - request entity, including it's full 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.
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 not successful and the specified response type is not Response.

put

public <T> T put(Entity<?> entity,
                 GenericType<T> responseType)
      throws ProcessingException,
             WebApplicationException
Description copied from interface: SyncInvoker
Invoke HTTP PUT method for the current request synchronously.

Specified by:
put in interface SyncInvoker
Type Parameters:
T - generic response entity type.
Parameters:
entity - request entity, including it's full 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.
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 not successful and the specified generic response type does not represent Response.

post

public Response post(Entity<?> entity)
              throws ProcessingException
Description copied from interface: SyncInvoker
Invoke HTTP POST method for the current request synchronously.

Specified by:
post in interface SyncInvoker
Parameters:
entity - request entity, including it's full 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.
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: SyncInvoker
Invoke HTTP POST method for the current request synchronously.

Specified by:
post in interface SyncInvoker
Type Parameters:
T - response entity type.
Parameters:
entity - request entity, including it's full 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.
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 not successful and the specified response type is not Response.

post

public <T> T post(Entity<?> entity,
                  GenericType<T> responseType)
       throws ProcessingException,
              WebApplicationException
Description copied from interface: SyncInvoker
Invoke HTTP POST method for the current request synchronously.

Specified by:
post in interface SyncInvoker
Type Parameters:
T - generic response entity type.
Parameters:
entity - request entity, including it's full 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.
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 not successful and the specified generic response type does not represent Response.

delete

public Response delete()
                throws ProcessingException
Description copied from interface: SyncInvoker
Invoke HTTP DELETE method for the current request synchronously.

Specified by:
delete in interface SyncInvoker
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: SyncInvoker
Invoke HTTP DELETE method for the current request synchronously.

Specified by:
delete in interface SyncInvoker
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 not successful and the specified response type is not Response.

delete

public <T> T delete(GenericType<T> responseType)
         throws ProcessingException,
                WebApplicationException
Description copied from interface: SyncInvoker
Invoke HTTP DELETE method for the current request synchronously.

Specified by:
delete in interface SyncInvoker
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 not successful and the specified generic response type does not represent Response.

head

public Response head()
              throws ProcessingException
Description copied from interface: SyncInvoker
Invoke HTTP HEAD method for the current request synchronously.

Specified by:
head in interface SyncInvoker
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: SyncInvoker
Invoke HTTP OPTIONS method for the current request synchronously.

Specified by:
options in interface SyncInvoker
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: SyncInvoker
Invoke HTTP OPTIONS method for the current request synchronously.

Specified by:
options in interface SyncInvoker
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 not successful and the specified response type is not Response.

options

public <T> T options(GenericType<T> responseType)
          throws ProcessingException,
                 WebApplicationException
Description copied from interface: SyncInvoker
Invoke HTTP OPTIONS method for the current request synchronously.

Specified by:
options in interface SyncInvoker
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 not successful and the specified generic response type does not represent Response.

trace

public Response trace()
               throws ProcessingException
Description copied from interface: SyncInvoker
Invoke HTTP TRACE method for the current request synchronously.

Specified by:
trace in interface SyncInvoker
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: SyncInvoker
Invoke HTTP TRACE method for the current request synchronously.

Specified by:
trace in interface SyncInvoker
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 not successful and the specified response type is not Response.

trace

public <T> T trace(GenericType<T> responseType)
        throws ProcessingException,
               WebApplicationException
Description copied from interface: SyncInvoker
Invoke HTTP TRACE method for the current request synchronously.

Specified by:
trace in interface SyncInvoker
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 not successful and the specified generic response type does not represent Response.

method

public Response method(String name)
                throws ProcessingException
Description copied from interface: SyncInvoker
Invoke an arbitrary method for the current request synchronously.

Specified by:
method in interface SyncInvoker
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: SyncInvoker
Invoke an arbitrary method for the current request synchronously.

Specified by:
method in interface SyncInvoker
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 not successful and the specified response type is not Response.

method

public <T> T method(String name,
                    GenericType<T> responseType)
         throws ProcessingException,
                WebApplicationException
Description copied from interface: SyncInvoker
Invoke an arbitrary method for the current request synchronously.

Specified by:
method in interface SyncInvoker
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 not successful and the specified generic response type does not represent Response.

method

public Response method(String name,
                       Entity<?> entity)
                throws ProcessingException
Description copied from interface: SyncInvoker
Invoke an arbitrary method for the current request synchronously.

Specified by:
method in interface SyncInvoker
Parameters:
name - method name.
entity - request entity, including it's full 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.
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: SyncInvoker
Invoke an arbitrary method for the current request synchronously.

Specified by:
method in interface SyncInvoker
Type Parameters:
T - response entity type.
Parameters:
name - method name.
entity - request entity, including it's full 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.
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 not successful and the specified response type is not Response.

method

public <T> T method(String name,
                    Entity<?> entity,
                    GenericType<T> responseType)
         throws ProcessingException,
                WebApplicationException
Description copied from interface: SyncInvoker
Invoke an arbitrary method for the current request synchronously.

Specified by:
method in interface SyncInvoker
Type Parameters:
T - generic response entity type.
Parameters:
name - method name.
entity - request entity, including it's full 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.
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 not successful and the specified generic response type does not represent Response.

property

public JerseyInvocation.Builder property(String name,
                                         Object value)
Description copied from interface: Configurable
Set the new configuration property, if already set, the existing value of the property will be updated. Setting a null value into a property effectively removes the property from the property bag.

Specified by:
property in interface Configurable<Invocation.Builder>
Parameters:
name - property name.
value - (new) property value. null value removes the property with the given name.
Returns:
the updated configurable instance.

register

public JerseyInvocation.Builder register(Class<?> providerClass)
Description copied from interface: Configurable
Register a class of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context. Implementations SHOULD warn about and ignore registrations that do not conform to the requirements of supported JAX-RS component types in the given configurable context. Any subsequent registration attempts for a component type, for which a class or instance-based registration already exists in the system MUST be rejected by the JAX-RS implementation and a warning SHOULD be raised to inform the user about the rejected registration. The registered JAX-RS component class is registered as a contract provider of all the recognized JAX-RS or implementation-specific extension contracts including meta-provider contracts, such as Feature or DynamicFeature.

As opposed to component instances registered via Configurable.register(Object) method, the lifecycle of components registered using this class-based register(...) method is fully managed by the JAX-RS implementation or any underlying IoC container supported by the implementation.

Specified by:
register in interface Configurable<Invocation.Builder>
Parameters:
providerClass - JAX-RS component class to be configured in the scope of this configurable context.
Returns:
the updated configurable context.

register

public JerseyInvocation.Builder register(Class<?> providerClass,
                                         int bindingPriority)
Description copied from interface: Configurable
Register a class of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context.

This registration method provides the same functionality as Configurable.register(Class) except that any priority specified on the registered JAX-RS component class via @Priority annotation is overridden with the supplied priority value.

Note that in case the priority is not applicable to a particular provider contract implemented by the class of the registered component, the supplied priority value will be ignored for that contract.

Specified by:
register in interface Configurable<Invocation.Builder>
Parameters:
providerClass - JAX-RS component class to be configured in the scope of this configurable context.
bindingPriority - the overriding priority for the registered component and all the provider contracts the component implements.
Returns:
the updated configurable context.

register

public JerseyInvocation.Builder register(Class<?> providerClass,
                                         Class<?>... contracts)
Description copied from interface: Configurable
Register a class of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context.

This registration method provides the same functionality as Configurable.register(Class) except the JAX-RS component class is only registered as a provider of the listed extension provider or meta-provider contracts. All explicitly enumerated contract types must represent a class or an interface implemented or extended by the registered component. Contracts that are not assignable from the registered component class MUST be ignored and implementations SHOULD raise a warning to inform users about the ignored contract(s).

Specified by:
register in interface Configurable<Invocation.Builder>
Parameters:
providerClass - JAX-RS component class to be configured in the scope of this configurable context.
contracts - the specific extension provider or meta-provider contracts implemented by the component for which the component should be registered. Implementations MUST ignore attempts to register a component class for an empty or null collection of contracts via this method and SHOULD raise a warning about such event.
Returns:
the updated configurable context.

register

public JerseyInvocation.Builder register(Class<?> providerClass,
                                         Map<Class<?>,Integer> contracts)
Description copied from interface: Configurable
Register a class of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context.

This registration method provides same functionality as Configurable.register(Class, Class[]) except that any priority specified on the registered JAX-RS component class using @Priority annotation is overridden for each extension provider contract type separately with an integer priority value specified as a value in the supplied map of [contract type, priority] pairs.

Note that in case a priority is not applicable to a provider contract registered for the JAX-RS component, the supplied priority value is ignored for such contract.

Specified by:
register in interface Configurable<Invocation.Builder>
Parameters:
providerClass - JAX-RS component class to be configured in the scope of this configurable context.
contracts - map of the specific extension provider and meta-provider contracts and their associated priorities for which the JAX-RS component is registered. All contracts in the map must represent a class or an interface implemented or extended by the JAX-RS component. Contracts that are not assignable from the registered component class MUST be ignored and implementations SHOULD raise a warning to inform users about the ignored contract(s).
Returns:
the updated configurable context.

register

public JerseyInvocation.Builder register(Object provider)
Description copied from interface: Configurable
Register an instance of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context. Implementations SHOULD warn about and ignore registrations that do not conform to the requirements of supported JAX-RS component types in the given configurable context. Any subsequent registration attempts for a component type, for which a class or instance-based registration already exists in the system MUST be rejected by the JAX-RS implementation and a warning SHOULD be raised to inform the user about the rejected registration. The registered JAX-RS component is registered as a contract provider of all the recognized JAX-RS or implementation-specific extension contracts including meta-provider contracts, such as Feature or DynamicFeature.

As opposed to components registered via Configurable.register(Class) method, the lifecycle of providers registered using this instance-based register(...) is not managed by JAX-RS runtime. The same registered component instance is used during the whole lifespan of the configurable context. Fields and properties of all registered JAX-RS component instances are injected with their declared dependencies (see Context) by the JAX-RS runtime prior to use.

Specified by:
register in interface Configurable<Invocation.Builder>
Parameters:
provider - JAX-RS component instance to be configured in the scope of this configurable context.
Returns:
the updated configurable context.

register

public JerseyInvocation.Builder register(Object provider,
                                         int bindingPriority)
Description copied from interface: Configurable
Register an instance of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context.

This registration method provides the same functionality as Configurable.register(Object) except that any priority specified on the registered JAX-RS component class via @Priority annotation is overridden with the supplied priority value.

Note that in case the priority is not applicable to a particular provider contract implemented by the class of the registered component, the supplied priority value will be ignored for that contract.

Specified by:
register in interface Configurable<Invocation.Builder>
Parameters:
provider - JAX-RS component instance to be configured in the scope of this configurable context.
bindingPriority - the overriding priority for the registered component and all the provider contracts the component implements.
Returns:
the updated configurable context.

register

public JerseyInvocation.Builder register(Object provider,
                                         Class<?>... contracts)
Description copied from interface: Configurable
Register an instance of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context.

This registration method provides the same functionality as Configurable.register(Object) except the JAX-RS component class is only registered as a provider of the listed extension provider or meta-provider contracts. All explicitly enumerated contract types must represent a class or an interface implemented or extended by the registered component. Contracts that are not assignable from the registered component class MUST be ignored and implementations SHOULD raise a warning to inform users about the ignored contract(s).

Specified by:
register in interface Configurable<Invocation.Builder>
Parameters:
provider - JAX-RS component instance to be configured in the scope of this configurable context.
contracts - the specific extension provider or meta-provider contracts implemented by the component for which the component should be registered. Implementations MUST ignore attempts to register a component class for an empty or null collection of contracts via this method and SHOULD raise a warning about such event.
Returns:
the updated configurable context.

register

public JerseyInvocation.Builder register(Object provider,
                                         Map<Class<?>,Integer> contracts)
Description copied from interface: Configurable
Register an instance of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context.

This registration method provides same functionality as Configurable.register(Object, Class[]) except that any priority specified on the registered JAX-RS component class using @Priority annotation is overridden for each extension provider contract type separately with an integer priority value specified as a value in the supplied map of [contract type, priority] pairs.

Note that in case a priority is not applicable to a provider contract registered for the JAX-RS component, the supplied priority value is ignored for such contract.

Specified by:
register in interface Configurable<Invocation.Builder>
Parameters:
provider - JAX-RS component instance to be configured in the scope of this configurable context.
contracts - map of the specific extension provider and meta-provider contracts and their associated priorities for which the JAX-RS component is registered. All contracts in the map must represent a class or an interface implemented or extended by the JAX-RS component. Contracts that are not assignable from the registered component class MUST be ignored and implementations SHOULD raise a warning to inform users about the ignored contract(s).
Returns:
the updated configurable context.

replaceWith

public JerseyInvocation.Builder replaceWith(Configuration config)
Description copied from interface: Configurable
Replace the existing configuration state with an externally provided configuration state.

Specified by:
replaceWith in interface Configurable<Invocation.Builder>
Parameters:
config - external configuration state to replace the configuration of this configurable instance.
Returns:
the updated configurable context.

getConfiguration

public ClientConfig getConfiguration()
Description copied from interface: Configurable
Get a live view of an internal configuration state of this configurable instance. Any changes made using methods of this Configurable instance will be reflected in the returned Configuration instance.

The returned Configuration instance and the collection data it provides are not thread-safe wrt. modification made using methods on the parent configurable object.

Specified by:
getConfiguration in interface Configurable<Invocation.Builder>
Returns:
configuration live view of the internal configuration state.

preInitialize

public JerseyInvocation.Builder preInitialize()
Pre initializes the configuration of this invocation builder in order to improve performance during the first request.

Once this method is called no other method implementing Configurable must be called on this pre initialized invocation builder otherwise invocation builder will change back to uninitialized.

Returns:
Jersey invocation builder.


Copyright © 2007-2013 Oracle Corporation. All Rights Reserved. Use is subject to license terms.