|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.jersey.message.internal.InboundMessageContext
org.glassfish.jersey.client.ClientResponse
public class ClientResponse
Jersey client response context.
| Constructor Summary | |
|---|---|
ClientResponse(ClientRequest requestContext,
Response response)
Create new Jersey client response context initialized from a JAX-RS response. |
|
ClientResponse(Response.StatusType status,
ClientRequest requestContext)
Create a new Jersey client response context. |
|
| Method Summary | ||
|---|---|---|
Map<String,NewCookie> |
getCookies()
Get any new cookies set on the response message. |
|
Object |
getEntity()
Get the message entity Java instance. |
|
Set<Link> |
getLinks()
Get the links attached to the message as header. |
|
ClientRequest |
getRequestContext()
Get the associated client request context paired with this response context. |
|
int |
getStatus()
Get the status code associated with the response. |
|
Response.StatusType |
getStatusInfo()
Get the complete status information associated with the response. |
|
|
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. |
|
|
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. |
|
|
readEntity(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. |
|
|
readEntity(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 |
setStatus(int code)
Set a new response status code. |
|
void |
setStatusInfo(Response.StatusType status)
Set the complete status information (status code and reason phrase) associated with the response. |
|
String |
toString()
|
|
| Methods inherited from class org.glassfish.jersey.message.internal.InboundMessageContext |
|---|
bufferEntity, close, getAllowedMethods, 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, setReaderInterceptors, setWorkers |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface javax.ws.rs.client.ClientResponseContext |
|---|
getAllowedMethods, getDate, getEntityStream, getEntityTag, getHeaders, getHeaderString, getLanguage, getLastModified, getLength, getLink, getLinkBuilder, getLocation, getMediaType, hasEntity, hasLink, setEntityStream |
| Constructor Detail |
|---|
public ClientResponse(ClientRequest requestContext,
Response response)
response.
requestContext - associated request context.response - JAX-RS response to be used to initialize the response context.
public ClientResponse(Response.StatusType status,
ClientRequest requestContext)
status - response status.requestContext - associated client request context.| Method Detail |
|---|
public int getStatus()
ClientResponseContext
getStatus in interface ClientResponseContextpublic void setStatus(int code)
ClientResponseContext
setStatus in interface ClientResponseContextcode - new status code.public void setStatusInfo(Response.StatusType status)
ClientResponseContext
setStatusInfo in interface ClientResponseContextstatus - the response status information.public Response.StatusType getStatusInfo()
ClientResponseContext
getStatusInfo in interface ClientResponseContextnull if the status was
not set.public ClientRequest getRequestContext()
public Map<String,NewCookie> getCookies()
ClientResponseContext
getCookies in interface ClientResponseContextnew cookie.public Set<Link> getLinks()
InboundMessageContext
getLinks in interface ClientResponseContextgetLinks in class InboundMessageContextSet if no links are present. Never
returns null.public String toString()
toString in class Object
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 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.
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(GenericType<T> entityType)
throws 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.
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(javax.ws.rs.core.GenericType)
public <T> T readEntity(Class<T> entityType,
Annotation[] annotations)
throws 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.
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(GenericType<T> entityType,
Annotation[] annotations)
throws 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.
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(javax.ws.rs.core.GenericType, java.lang.annotation.Annotation[])
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||