Package org.glassfish.jersey.client
Class JerseyInvocation
- java.lang.Object
-
- org.glassfish.jersey.client.JerseyInvocation
-
- All Implemented Interfaces:
javax.ws.rs.client.Invocation
public class JerseyInvocation extends java.lang.Object implements javax.ws.rs.client.InvocationJersey implementation ofJAX-RS client-side request invocationcontract.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classJerseyInvocation.AsyncInvokerstatic classJerseyInvocation.BuilderJersey-specificclient invocation builder.private static classJerseyInvocation.EntityPresence
-
Field Summary
Fields Modifier and Type Field Description private booleancopyRequestContextprivate static java.util.logging.LoggerLOGGERprivate static java.util.Map<java.lang.String,JerseyInvocation.EntityPresence>METHODSprivate ClientRequestrequestContext
-
Constructor Summary
Constructors Modifier Constructor Description privateJerseyInvocation(JerseyInvocation.Builder builder)privateJerseyInvocation(JerseyInvocation.Builder builder, boolean copyRequestContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private javax.ws.rs.ProcessingExceptionconvertToException(javax.ws.rs.core.Response response)private javax.ws.rs.WebApplicationExceptioncreateExceptionForFamily(javax.ws.rs.core.Response response, javax.ws.rs.core.Response.Status.Family statusFamily)private static java.util.Map<java.lang.String,JerseyInvocation.EntityPresence>initializeMap()javax.ws.rs.core.Responseinvoke()<T> Tinvoke(java.lang.Class<T> responseType)<T> Tinvoke(javax.ws.rs.core.GenericType<T> responseType)JerseyInvocationproperty(java.lang.String name, java.lang.Object value)(package private) ClientRequestrequest()Returns a reference to the mutable request context to be invoked.private ClientRequestrequestForCall(ClientRequest requestContext)java.util.concurrent.Future<javax.ws.rs.core.Response>submit()<T> java.util.concurrent.Future<T>submit(java.lang.Class<T> responseType)<T> java.util.concurrent.Future<T>submit(javax.ws.rs.client.InvocationCallback<T> callback)<T> java.util.concurrent.Future<T>submit(javax.ws.rs.core.GenericType<T> responseType)<T> java.util.concurrent.Future<T>submit(javax.ws.rs.core.GenericType<T> responseType, javax.ws.rs.client.InvocationCallback<T> callback)Submit the request for an asynchronous invocation and register anInvocationCallbackto process the future result of the invocation.private <T> Ttranslate(ClientResponse response, RequestScope scope, java.lang.Class<T> responseType)private <T> Ttranslate(ClientResponse response, RequestScope scope, javax.ws.rs.core.GenericType<T> responseType)private voidvalidateHttpMethodAndEntity(ClientRequest request)
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
requestContext
private final ClientRequest requestContext
-
copyRequestContext
private final boolean copyRequestContext
-
METHODS
private static final java.util.Map<java.lang.String,JerseyInvocation.EntityPresence> METHODS
-
-
Constructor Detail
-
JerseyInvocation
private JerseyInvocation(JerseyInvocation.Builder builder)
-
JerseyInvocation
private JerseyInvocation(JerseyInvocation.Builder builder, boolean copyRequestContext)
-
-
Method Detail
-
initializeMap
private static java.util.Map<java.lang.String,JerseyInvocation.EntityPresence> initializeMap()
-
validateHttpMethodAndEntity
private void validateHttpMethodAndEntity(ClientRequest request)
-
requestForCall
private ClientRequest requestForCall(ClientRequest requestContext)
-
invoke
public javax.ws.rs.core.Response invoke() throws javax.ws.rs.ProcessingException, javax.ws.rs.WebApplicationException- Specified by:
invokein interfacejavax.ws.rs.client.Invocation- Throws:
javax.ws.rs.ProcessingExceptionjavax.ws.rs.WebApplicationException
-
invoke
public <T> T invoke(java.lang.Class<T> responseType) throws javax.ws.rs.ProcessingException, javax.ws.rs.WebApplicationException- Specified by:
invokein interfacejavax.ws.rs.client.Invocation- Throws:
javax.ws.rs.ProcessingExceptionjavax.ws.rs.WebApplicationException
-
invoke
public <T> T invoke(javax.ws.rs.core.GenericType<T> responseType) throws javax.ws.rs.ProcessingException, javax.ws.rs.WebApplicationException- Specified by:
invokein interfacejavax.ws.rs.client.Invocation- Throws:
javax.ws.rs.ProcessingExceptionjavax.ws.rs.WebApplicationException
-
submit
public java.util.concurrent.Future<javax.ws.rs.core.Response> submit()
- Specified by:
submitin interfacejavax.ws.rs.client.Invocation
-
submit
public <T> java.util.concurrent.Future<T> submit(java.lang.Class<T> responseType)
- Specified by:
submitin interfacejavax.ws.rs.client.Invocation
-
translate
private <T> T translate(ClientResponse response, RequestScope scope, java.lang.Class<T> responseType) throws javax.ws.rs.ProcessingException
- Throws:
javax.ws.rs.ProcessingException
-
submit
public <T> java.util.concurrent.Future<T> submit(javax.ws.rs.core.GenericType<T> responseType)
- Specified by:
submitin interfacejavax.ws.rs.client.Invocation
-
translate
private <T> T translate(ClientResponse response, RequestScope scope, javax.ws.rs.core.GenericType<T> responseType) throws javax.ws.rs.ProcessingException
- Throws:
javax.ws.rs.ProcessingException
-
submit
public <T> java.util.concurrent.Future<T> submit(javax.ws.rs.client.InvocationCallback<T> callback)
- Specified by:
submitin interfacejavax.ws.rs.client.Invocation
-
submit
public <T> java.util.concurrent.Future<T> submit(javax.ws.rs.core.GenericType<T> responseType, javax.ws.rs.client.InvocationCallback<T> callback)Submit the request for an asynchronous invocation and register anInvocationCallbackto process the future result of the invocation.Response type in this case is taken from
responseTypeparam (if notnull) rather than fromcallback. This allows to pass callbacks likenew InvocationCallback<>() {...}.- Type Parameters:
T- response type- Parameters:
responseType- response type that is used instead of obtaining types fromcallback.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.
-
property
public JerseyInvocation property(java.lang.String name, java.lang.Object value)
- Specified by:
propertyin interfacejavax.ws.rs.client.Invocation
-
convertToException
private javax.ws.rs.ProcessingException convertToException(javax.ws.rs.core.Response response)
-
createExceptionForFamily
private javax.ws.rs.WebApplicationException createExceptionForFamily(javax.ws.rs.core.Response response, javax.ws.rs.core.Response.Status.Family statusFamily)
-
request
ClientRequest request()
Returns a reference to the mutable request context to be invoked.- Returns:
- mutable request context to be invoked.
-
-