org.glassfish.jersey.client
Class JerseyInvocation

java.lang.Object
  extended by org.glassfish.jersey.client.JerseyInvocation
All Implemented Interfaces:
Invocation

public class JerseyInvocation
extends java.lang.Object
implements Invocation

Jersey implementation of JAX-RS client-side request invocation contract.

Author:
Marek Potociar (marek.potociar at oracle.com)

Nested Class Summary
static class JerseyInvocation.Builder
          Jersey-specific client invocation builder.
 
Method Summary
 ClientConfig configuration()
          Get access to the underlying configuration.
 Response invoke()
          Synchronously invoke the request and receive a response back.
<T> T
invoke(java.lang.Class<T> responseType)
          Synchronously invoke the request and receive a response of the specified type back.
<T> T
invoke(GenericType<T> responseType)
          Synchronously invoke the request and receive a response of the specified generic type back.
 java.util.concurrent.Future<Response> submit()
          Submit the request for an asynchronous invocation and receive a future response back.
<T> java.util.concurrent.Future<T>
submit(java.lang.Class<T> responseType)
          Submit the request for an asynchronous invocation and receive a future response of the specified type back.
<T> java.util.concurrent.Future<T>
submit(GenericType<T> responseType)
          Submit the request for an asynchronous invocation and receive a future response of the specified generic type back.
<T> java.util.concurrent.Future<T>
submit(InvocationCallback<T> callback)
          Submit the request for an asynchronous invocation and register an InvocationCallback to process the future result of the invocation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

invoke

public Response invoke()
                throws ClientException,
                       WebApplicationException
Description copied from interface: Invocation
Synchronously invoke the request and receive a response back.

Specified by:
invoke in interface Invocation
Returns:
response object as a result of the request invocation.
Throws:
ClientException - in case the invocation processing has failed.
WebApplicationException

invoke

public <T> T invoke(java.lang.Class<T> responseType)
         throws ClientException,
                WebApplicationException
Description copied from interface: Invocation
Synchronously invoke the request and receive a response of the specified type back.

Specified by:
invoke in interface Invocation
Type Parameters:
T - response type
Parameters:
responseType - Java type the response should be converted into.
Returns:
response object of the specified type as a result of the request invocation.
Throws:
ClientException - in case the invocation processing has failed.
WebApplicationException - in case the response status code of the response returned by the server is not successful.

invoke

public <T> T invoke(GenericType<T> responseType)
         throws ClientException,
                WebApplicationException
Description copied from interface: Invocation
Synchronously invoke the request and receive a response of the specified generic type back.

Specified by:
invoke in interface Invocation
Type Parameters:
T - generic response type
Parameters:
responseType - type literal representing a generic Java type the response should be converted into.
Returns:
response object of the specified generic type as a result of the request invocation.
Throws:
ClientException - in case the invocation processing has failed.
WebApplicationException - in case the response status code of the response returned by the server is not successful.

submit

public java.util.concurrent.Future<Response> submit()
Description copied from interface: Invocation
Submit the request for an asynchronous invocation and receive a future response back.

Note that calling the Future.get() method on the returned Future instance may throw an ExecutionException that wraps an ClientException thrown in case of an invocation processing failure.

Specified by:
submit in interface Invocation
Returns:
future response object as a result of the request invocation.

submit

public <T> java.util.concurrent.Future<T> submit(java.lang.Class<T> responseType)
Description copied from interface: Invocation
Submit the request for an asynchronous invocation and receive a future response of the specified type back.

Note that calling the Future.get() method on the returned Future instance may throw an ExecutionException that wraps either an ClientException thrown in case of an invocation processing failure or a WebApplicationException or one of its subclasses thrown in case the received response status code is not successful and the specified response type is not Response.

Specified by:
submit in interface Invocation
Type Parameters:
T - response type
Parameters:
responseType - Java type the response should be converted into.
Returns:
future response object of the specified type as a result of the request invocation.

submit

public <T> java.util.concurrent.Future<T> submit(GenericType<T> responseType)
Description copied from interface: Invocation
Submit the request for an asynchronous invocation and receive a future response of the specified generic type back.

Note that calling the Future.get() method on the returned Future instance may throw an ExecutionException that wraps either an ClientException thrown in case of an invocation processing failure or a WebApplicationException or one of its subclasses thrown in case the received response status code is not successful and the specified response type is not Response.

Specified by:
submit in interface Invocation
Type Parameters:
T - generic response type
Parameters:
responseType - type literal representing a generic Java type the response should be converted into.
Returns:
future response object of the specified generic type as a result of the request invocation.

submit

public <T> java.util.concurrent.Future<T> submit(InvocationCallback<T> callback)
Description copied from interface: Invocation
Submit the request for an asynchronous invocation and register an InvocationCallback to process the future result of the invocation.

Note that calling the Future.get() method on the returned Future instance may throw an ExecutionException that wraps either an ClientException thrown in case of an invocation processing failure or a WebApplicationException or one of its subclasses thrown in case the received response status code is not successful and the generic type of the supplied response callback is not Response.

Specified by:
submit in interface Invocation
Type Parameters:
T - response type
Parameters:
callback - invocation callback for asynchronous processing of the request invocation result.
Returns:
future response object of the specified type as a result of the request invocation.

configuration

public ClientConfig configuration()
Description copied from interface: Invocation
Get access to the underlying configuration.

Specified by:
configuration in interface Invocation
Returns:
a mutable configuration bound to the instance.


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