|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jersey.api.client.ClientResponse
public class ClientResponse
A client (in-bound) HTTP response.
Nested Class Summary | |
---|---|
static class |
ClientResponse.Status
Status codes defined by HTTP, see HTTP/1.1 documentation. |
Field Summary | |
---|---|
protected static RuntimeDelegate.HeaderDelegate<java.util.Date> |
dateDelegate
|
protected static RuntimeDelegate.HeaderDelegate<EntityTag> |
entityTagDelegate
|
Constructor Summary | |
---|---|
ClientResponse(int status,
InBoundHeaders headers,
java.io.InputStream entity,
MessageBodyWorkers workers)
|
Method Summary | ||
---|---|---|
void |
bufferEntity()
Buffer the entity. |
|
void |
close()
Close the response. |
|
java.util.Set<java.lang.String> |
getAllow()
Get the allowed HTTP methods from the Allow HTTP header. |
|
Client |
getClient()
Get the client. |
|
ClientResponse.Status |
getClientResponseStatus()
Get the status code. |
|
java.util.List<NewCookie> |
getCookies()
Get the list of cookies. |
|
|
getEntity(java.lang.Class<T> c)
Get the entity of the response. |
|
|
getEntity(GenericType<T> gt)
Get the entity of the response. |
|
java.io.InputStream |
getEntityInputStream()
Get the input stream of the response. |
|
EntityTag |
getEntityTag()
Get the entity tag. |
|
MultivaluedMap<java.lang.String,java.lang.String> |
getHeaders()
Get the HTTP headers of the response. |
|
java.lang.String |
getLanguage()
Get the language. |
|
java.util.Date |
getLastModified()
Get the last modified date. |
|
int |
getLength()
Get Content-Length. |
|
WebResourceLinkHeaders |
getLinks()
|
|
java.net.URI |
getLocation()
Get the location. |
|
MultivaluedMap<java.lang.String,java.lang.String> |
getMetadata()
Deprecated. |
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Get the map of response properties. |
|
java.util.Date |
getResponseDate()
Get response date (server side). |
|
Response.Status |
getResponseStatus()
Deprecated. use getClientResponseStatus() |
|
int |
getStatus()
Get the status code. |
|
MediaType |
getType()
Get the media type of the response. |
|
boolean |
hasEntity()
Checks if there is an entity available. |
|
void |
setEntityInputStream(java.io.InputStream entity)
Set the input stream of the response. |
|
void |
setResponseStatus(Response.StatusType status)
Deprecated. see setStatus(javax.ws.rs.core.Response.StatusType) |
|
void |
setStatus(int status)
Set the status code. |
|
void |
setStatus(Response.StatusType status)
Set the status code. |
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final RuntimeDelegate.HeaderDelegate<EntityTag> entityTagDelegate
protected static final RuntimeDelegate.HeaderDelegate<java.util.Date> dateDelegate
Constructor Detail |
---|
public ClientResponse(int status, InBoundHeaders headers, java.io.InputStream entity, MessageBodyWorkers workers)
Method Detail |
---|
public Client getClient()
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
A response property is an application-defined property that may be added by the user, a filter, or the handler that is managing the connection.
public int getStatus()
public void setStatus(int status)
status
- the status code.public void setStatus(Response.StatusType status)
status
- the status code.public ClientResponse.Status getClientResponseStatus()
setStatus(int)
and there is no
mapping between the integer value and the Response.Status
enumeration value.@Deprecated public Response.Status getResponseStatus()
getClientResponseStatus()
setStatus(int)
and there is no
mapping between the integer value and the Response.Status
enumeration value.@Deprecated public void setResponseStatus(Response.StatusType status)
setStatus(javax.ws.rs.core.Response.StatusType)
status
- the status code.@Deprecated public MultivaluedMap<java.lang.String,java.lang.String> getMetadata()
public MultivaluedMap<java.lang.String,java.lang.String> getHeaders()
public boolean hasEntity()
public java.io.InputStream getEntityInputStream()
public void setEntityInputStream(java.io.InputStream entity)
entity
- the input stream of the response.public <T> T getEntity(java.lang.Class<T> c) throws ClientHandlerException, UniformInterfaceException
If the entity is not an instance of Closeable then the entity input stream is closed.
T
- the type of the response.c
- the type of the entity.
c
.
ClientHandlerException
- if there is an error processing the response.
UniformInterfaceException
- if the response status is 204 (No Content).public <T> T getEntity(GenericType<T> gt) throws ClientHandlerException, UniformInterfaceException
If the entity is not an instance of Closeable then this response
is closed (you cannot read it more than once, any subsequent
call will produce ClientHandlerException
).
T
- the type of the response.gt
- the generic type of the entity.
ClientHandlerException
- if there is an error processing the response.
UniformInterfaceException
- if the response status is 204 (No Content).public void bufferEntity() throws ClientHandlerException
All the bytes of the original entity input stream will be read and stored in memory. The original entity input stream will then be closed.
ClientHandlerException
- if there is an error processing the response.public void close() throws ClientHandlerException
The entity input stream is closed.
ClientHandlerException
- if there is an error closing the response.public MediaType getType()
public java.net.URI getLocation()
null
if not present.public EntityTag getEntityTag()
null
if not present.public java.util.Date getLastModified()
null
if not present.public java.util.Date getResponseDate()
null
if not present.public java.lang.String getLanguage()
null
if not present.public int getLength()
public java.util.List<NewCookie> getCookies()
public java.util.Set<java.lang.String> getAllow()
Note that the Allow HTTP header will be returned from an OPTIONS request.
public WebResourceLinkHeaders getLinks()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |