public class ClientResponse
extends org.glassfish.jersey.message.internal.InboundMessageContext
implements jakarta.ws.rs.client.ClientResponseContext, org.glassfish.jersey.internal.inject.InjectionManagerSupplier
| Constructor and Description | 
|---|
ClientResponse(ClientRequest requestContext,
              jakarta.ws.rs.core.Response response)
Create new Jersey client response context initialized from a JAX-RS  
response. | 
ClientResponse(jakarta.ws.rs.core.Response.StatusType status,
              ClientRequest requestContext)
Create a new Jersey client response context. 
 | 
ClientResponse(jakarta.ws.rs.core.Response.StatusType status,
              ClientRequest requestContext,
              URI resolvedRequestUri)
Create a new Jersey client response context. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
Map<String,jakarta.ws.rs.core.NewCookie> | 
getCookies()  | 
Object | 
getEntity()
Get the message entity Java instance. 
 | 
org.glassfish.jersey.internal.inject.InjectionManager | 
getInjectionManager()
Get injection manager. 
 | 
Set<jakarta.ws.rs.core.Link> | 
getLinks()
Get the links attached to the message as header. 
 | 
protected Iterable<jakarta.ws.rs.ext.ReaderInterceptor> | 
getReaderInterceptors()
Get reader interceptors bound to this context. 
 | 
ClientRequest | 
getRequestContext()
Get the associated client request context paired with this response context. 
 | 
URI | 
getResolvedRequestUri()
Get the absolute URI of the ultimate request made to receive this response. 
 | 
int | 
getStatus()  | 
jakarta.ws.rs.core.Response.StatusType | 
getStatusInfo()  | 
<T> T | 
readEntity(Class<T> entityType)
Read the message entity input stream as an instance of specified Java type
 using a  
MessageBodyReader that supports mapping the
 message entity stream onto the requested type. | 
<T> T | 
readEntity(Class<T> entityType,
          Annotation[] annotations)
Read the message entity input stream as an instance of specified Java type
 using a  
MessageBodyReader that supports mapping the
 message entity stream onto the requested type. | 
<T> T | 
readEntity(jakarta.ws.rs.core.GenericType<T> entityType)
Read the message entity input stream as an instance of specified Java type
 using a  
MessageBodyReader that supports mapping the
 message entity stream onto the requested type. | 
<T> T | 
readEntity(jakarta.ws.rs.core.GenericType<T> entityType,
          Annotation[] annotations)
Read the message entity input stream as an instance of specified Java type
 using a  
MessageBodyReader that supports mapping the
 message entity stream onto the requested type. | 
void | 
setResolvedRequestUri(URI uri)
Set the absolute URI of the ultimate request that was made to receive this response. 
 | 
void | 
setStatus(int code)  | 
void | 
setStatusInfo(jakarta.ws.rs.core.Response.StatusType status)  | 
String | 
toString()  | 
bufferEntity, close, getAllowedMethods, getConfiguration, getDate, getEntityStream, getEntityTag, getHeaders, getHeaderString, getIfMatch, getIfNoneMatch, getLanguage, getLastModified, getLength, getLink, getLinkBuilder, getLocation, getMediaType, getQualifiedAcceptableLanguages, getQualifiedAcceptableMediaTypes, getQualifiedAcceptCharset, getQualifiedAcceptEncoding, getRequestCookies, getResponseCookies, getWorkers, hasEntity, hasLink, header, headers, headers, headers, headers, readEntity, readEntity, readEntity, readEntity, remove, setEntityStream, setWorkerspublic ClientResponse(ClientRequest requestContext, jakarta.ws.rs.core.Response response)
response.requestContext - associated request context.response - JAX-RS response to be used to initialize the response context.public ClientResponse(jakarta.ws.rs.core.Response.StatusType status,
                      ClientRequest requestContext)
status - response status.requestContext - associated client request context.public ClientResponse(jakarta.ws.rs.core.Response.StatusType status,
                      ClientRequest requestContext,
                      URI resolvedRequestUri)
status - response status.requestContext - associated client request context.resolvedRequestUri - resolved request URI (see getResolvedRequestUri()).public int getStatus()
getStatus in interface jakarta.ws.rs.client.ClientResponseContextpublic void setStatus(int code)
setStatus in interface jakarta.ws.rs.client.ClientResponseContextpublic void setStatusInfo(jakarta.ws.rs.core.Response.StatusType status)
setStatusInfo in interface jakarta.ws.rs.client.ClientResponseContextpublic jakarta.ws.rs.core.Response.StatusType getStatusInfo()
getStatusInfo in interface jakarta.ws.rs.client.ClientResponseContextpublic URI getResolvedRequestUri()
 The returned URI points to the ultimate location of the requested resource that
 provided the data represented by this response instance. Because Jersey client connectors
 may be configured to automatically follow redirect responses, the value of the URI returned by this method may
 be different from the value of the original request URI that can be retrieved using response.getRequestContext().getUri()
 chain of method calls.
 
ClientProperties.FOLLOW_REDIRECTS, 
setResolvedRequestUri(java.net.URI)public void setResolvedRequestUri(URI uri)
If the original request URI has been modified (e.g. due to redirections), the absolute URI of the ultimate request being made to receive the response should be set by the caller on the response instance using this method.
uri - absolute URI of the ultimate request made to receive this response. Must not be null.NullPointerException - in case the passed uri parameter is null.IllegalArgumentException - in case the passed uri parameter does
                                            not represent an absolute URI.ClientProperties.FOLLOW_REDIRECTS, 
getResolvedRequestUri()public ClientRequest getRequestContext()
public Map<String,jakarta.ws.rs.core.NewCookie> getCookies()
getCookies in interface jakarta.ws.rs.client.ClientResponseContextpublic Set<jakarta.ws.rs.core.Link> getLinks()
org.glassfish.jersey.message.internal.InboundMessageContextgetLinks in interface jakarta.ws.rs.client.ClientResponseContextgetLinks in class org.glassfish.jersey.message.internal.InboundMessageContextSet if no links are present. Never
 returns null.public Object getEntity() throws IllegalStateException
null if the message
 does not contain an entity body.
 
 If the entity is represented by an un-consumed input stream
 the method will return the input stream.
 
null if message does not contain an
         entity body (i.e. when InboundMessageContext.hasEntity() returns false).IllegalStateException - if the entity was previously fully consumed
                               as an input stream, or
                               if the response has been closed.Response.getEntity()public <T> T readEntity(Class<T> entityType) throws jakarta.ws.rs.ProcessingException, IllegalStateException
MessageBodyReader that supports mapping the
 message entity stream onto the requested type.
 
 Method throws an ProcessingException if the content of the
 message cannot be mapped to an entity of the requested type and
 IllegalStateException in case the entity is not backed by an input
 stream or if the original entity input stream has already been consumed
 without buffering the entity data prior consuming.
 
 A message instance returned from this method will be cached for
 subsequent retrievals via getEntity(). Unless the supplied entity
 type is an input stream, this method automatically
 closes the an unconsumed original response entity data stream
 if open. In case the entity data has been buffered, the buffer will be reset
 prior consuming the buffered data to enable subsequent invocations of
 readEntity(...) methods on this response.
 
T - entity instance Java type.entityType - the type of entity.ProcessingException wrapping the
         underlying NoContentException is thrown.jakarta.ws.rs.ProcessingException - if the content of the message cannot be
                               mapped to an entity of the requested type.IllegalStateException - if the entity is not backed by an input stream,
                               the response has been closed already,
                               or if the entity input stream has been fully consumed already and has
                               not been buffered prior consuming.MessageBodyReader, 
Response.readEntity(Class)public <T> T readEntity(jakarta.ws.rs.core.GenericType<T> entityType)
                 throws jakarta.ws.rs.ProcessingException,
                        IllegalStateException
MessageBodyReader that supports mapping the
 message entity stream onto the requested type.
 
 Method throws an ProcessingException if the content of the
 message cannot be mapped to an entity of the requested type and
 IllegalStateException in case the entity is not backed by an input
 stream or if the original entity input stream has already been consumed
 without buffering the entity data prior consuming.
 
 A message instance returned from this method will be cached for
 subsequent retrievals via getEntity(). Unless the supplied entity
 type is an input stream, this method automatically
 closes the an unconsumed original response entity data stream
 if open. In case the entity data has been buffered, the buffer will be reset
 prior consuming the buffered data to enable subsequent invocations of
 readEntity(...) methods on this response.
 
T - entity instance Java type.entityType - the type of entity; may be generic.ProcessingException wrapping the
         underlying NoContentException is thrown.jakarta.ws.rs.ProcessingException - if the content of the message cannot be
                               mapped to an entity of the requested type.IllegalStateException - if the entity is not backed by an input stream,
                               the response has been closed already,
                               or if the entity input stream has been fully consumed already and has
                               not been buffered prior consuming.MessageBodyReader, 
Response.readEntity(jakarta.ws.rs.core.GenericType)public <T> T readEntity(Class<T> entityType, Annotation[] annotations) throws jakarta.ws.rs.ProcessingException, IllegalStateException
MessageBodyReader that supports mapping the
 message entity stream onto the requested type.
 
 Method throws an ProcessingException if the content of the
 message cannot be mapped to an entity of the requested type and
 IllegalStateException in case the entity is not backed by an input
 stream or if the original entity input stream has already been consumed
 without buffering the entity data prior consuming.
 
 A message instance returned from this method will be cached for
 subsequent retrievals via getEntity(). Unless the supplied entity
 type is an input stream, this method automatically
 closes the an unconsumed original response entity data stream
 if open. In case the entity data has been buffered, the buffer will be reset
 prior consuming the buffered data to enable subsequent invocations of
 readEntity(...) methods on this response.
 
T - entity instance Java type.entityType - the type of entity.annotations - annotations that will be passed to the MessageBodyReader.ProcessingException wrapping the
         underlying NoContentException is thrown.jakarta.ws.rs.ProcessingException - if the content of the message cannot be
                               mapped to an entity of the requested type.IllegalStateException - if the entity is not backed by an input stream,
                               the response has been closed already,
                               or if the entity input stream has been fully consumed already and has
                               not been buffered prior consuming.MessageBodyReader, 
Response.readEntity(Class, java.lang.annotation.Annotation[])public <T> T readEntity(jakarta.ws.rs.core.GenericType<T> entityType,
                        Annotation[] annotations)
                 throws jakarta.ws.rs.ProcessingException,
                        IllegalStateException
MessageBodyReader that supports mapping the
 message entity stream onto the requested type.
 
 Method throws an ProcessingException if the content of the
 message cannot be mapped to an entity of the requested type and
 IllegalStateException in case the entity is not backed by an input
 stream or if the original entity input stream has already been consumed
 without buffering the entity data prior consuming.
 
 A message instance returned from this method will be cached for
 subsequent retrievals via getEntity(). Unless the supplied entity
 type is an input stream, this method automatically
 closes the an unconsumed original response entity data stream
 if open. In case the entity data has been buffered, the buffer will be reset
 prior consuming the buffered data to enable subsequent invocations of
 readEntity(...) methods on this response.
 
T - entity instance Java type.entityType - the type of entity; may be generic.annotations - annotations that will be passed to the MessageBodyReader.ProcessingException wrapping the
         underlying NoContentException is thrown.jakarta.ws.rs.ProcessingException - if the content of the message cannot be
                               mapped to an entity of the requested type.IllegalStateException - if the entity is not backed by an input stream,
                               the response has been closed already,
                               or if the entity input stream has been fully consumed already and has
                               not been buffered prior consuming.MessageBodyReader, 
Response.readEntity(jakarta.ws.rs.core.GenericType, java.lang.annotation.Annotation[])public org.glassfish.jersey.internal.inject.InjectionManager getInjectionManager()
org.glassfish.jersey.internal.inject.InjectionManagerSuppliergetInjectionManager in interface org.glassfish.jersey.internal.inject.InjectionManagerSupplierprotected Iterable<jakarta.ws.rs.ext.ReaderInterceptor> getReaderInterceptors()
org.glassfish.jersey.message.internal.InboundMessageContext
 Interceptors will be used when one of the readEntity methods is invoked.
 
getReaderInterceptors in class org.glassfish.jersey.message.internal.InboundMessageContextCopyright © 2007-2020, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.