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.Invocation
Jersey implementation ofJAX-RS client-side request invocation
contract.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
JerseyInvocation.AsyncInvoker
static class
JerseyInvocation.Builder
Jersey-specificclient invocation builder
.private static class
JerseyInvocation.EntityPresence
-
Field Summary
Fields Modifier and Type Field Description private boolean
copyRequestContext
private static java.util.logging.Logger
LOGGER
private static java.util.Map<java.lang.String,JerseyInvocation.EntityPresence>
METHODS
private ClientRequest
requestContext
-
Constructor Summary
Constructors Modifier Constructor Description private
JerseyInvocation(JerseyInvocation.Builder builder)
private
JerseyInvocation(JerseyInvocation.Builder builder, boolean copyRequestContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private javax.ws.rs.ProcessingException
convertToException(javax.ws.rs.core.Response response)
private javax.ws.rs.WebApplicationException
createExceptionForFamily(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.Response
invoke()
<T> T
invoke(java.lang.Class<T> responseType)
<T> T
invoke(javax.ws.rs.core.GenericType<T> responseType)
JerseyInvocation
property(java.lang.String name, java.lang.Object value)
(package private) ClientRequest
request()
Returns a reference to the mutable request context to be invoked.private ClientRequest
requestForCall(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 anInvocationCallback
to process the future result of the invocation.private <T> T
translate(ClientResponse response, RequestScope scope, java.lang.Class<T> responseType)
private <T> T
translate(ClientResponse response, RequestScope scope, javax.ws.rs.core.GenericType<T> responseType)
private void
validateHttpMethodAndEntity(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:
invoke
in interfacejavax.ws.rs.client.Invocation
- Throws:
javax.ws.rs.ProcessingException
javax.ws.rs.WebApplicationException
-
invoke
public <T> T invoke(java.lang.Class<T> responseType) throws javax.ws.rs.ProcessingException, javax.ws.rs.WebApplicationException
- Specified by:
invoke
in interfacejavax.ws.rs.client.Invocation
- Throws:
javax.ws.rs.ProcessingException
javax.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:
invoke
in interfacejavax.ws.rs.client.Invocation
- Throws:
javax.ws.rs.ProcessingException
javax.ws.rs.WebApplicationException
-
submit
public java.util.concurrent.Future<javax.ws.rs.core.Response> submit()
- Specified by:
submit
in interfacejavax.ws.rs.client.Invocation
-
submit
public <T> java.util.concurrent.Future<T> submit(java.lang.Class<T> responseType)
- Specified by:
submit
in 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:
submit
in 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:
submit
in 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 anInvocationCallback
to process the future result of the invocation.Response type in this case is taken from
responseType
param (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:
property
in 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.
-
-