org.jboss.resteasy.client.core
Class ClientResponseImpl<T>
java.lang.Object
javax.ws.rs.core.Response
org.jboss.resteasy.client.ClientResponse<T>
org.jboss.resteasy.client.core.ClientResponseImpl<T>
public class ClientResponseImpl<T>
- extends ClientResponse<T>
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
Methods inherited from class javax.ws.rs.core.Response |
created, fromResponse, noContent, notAcceptable, notModified, notModified, notModified, ok, ok, ok, ok, ok, seeOther, serverError, status, status, temporaryRedirect |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
providerFactory
protected ResteasyProviderFactory providerFactory
attributeExceptionsTo
protected java.lang.String attributeExceptionsTo
interceptors
protected java.lang.Iterable<ClientInterceptor> interceptors
restVerb
protected java.lang.String restVerb
url
protected java.lang.String url
baseMethod
protected org.apache.commons.httpclient.HttpMethodBase baseMethod
headers
protected CaseInsensitiveMap<java.lang.String> headers
alternateMediaType
protected java.lang.String alternateMediaType
returnType
protected java.lang.Class<?> returnType
genericReturnType
protected java.lang.reflect.Type genericReturnType
annotations
protected java.lang.annotation.Annotation[] annotations
status
protected int status
wasReleased
protected boolean wasReleased
streamWasRead
protected boolean streamWasRead
rawResults
protected byte[] rawResults
unmarshaledEntity
protected java.lang.Object unmarshaledEntity
exception
protected java.lang.Exception exception
allowRereads
protected boolean allowRereads
performExecute
protected boolean performExecute
cacheInputStream
protected boolean cacheInputStream
ClientResponseImpl
public ClientResponseImpl()
setProviderFactory
public void setProviderFactory(ResteasyProviderFactory providerFactory)
setReturnType
public void setReturnType(java.lang.Class<T> returnType)
getReturnType
public java.lang.Class<?> getReturnType()
setGenericReturnType
public void setGenericReturnType(java.lang.reflect.Type genericReturnType)
setAnnotations
public void setAnnotations(java.lang.annotation.Annotation[] annotations)
getAttributeExceptionsTo
public java.lang.String getAttributeExceptionsTo()
setAttributeExceptionsTo
public void setAttributeExceptionsTo(java.lang.String attributeExceptionsTo)
getException
public java.lang.Exception getException()
setException
public void setException(java.lang.Exception exception)
setInterceptors
public void setInterceptors(java.lang.Iterable<ClientInterceptor> interceptors)
getContentTypeHeader
public org.apache.commons.httpclient.Header getContentTypeHeader()
getContentType
public java.lang.String getContentType()
getAnnotations
public java.lang.annotation.Annotation[] getAnnotations()
getResponseHeader
public java.lang.String getResponseHeader(java.lang.String headerKey)
setAlternateMediaType
public void setAlternateMediaType(java.lang.String alternateMediaType)
getHttpBaseMethod
public org.apache.commons.httpclient.HttpMethodBase getHttpBaseMethod()
isAllowRereads
public boolean isAllowRereads()
setAllowRereads
public void setAllowRereads(boolean allowRereads)
isPerformExecute
public boolean isPerformExecute()
setPerformExecute
public void setPerformExecute(boolean performExecute)
getEntity
public T getEntity()
- Description copied from class:
ClientResponse
- Unmarshal the target entity from the response OutputStream. You must have type information set via
otherwise, this will not work.
This method actually does the reading on the OutputStream. It will only do the read once. Afterwards, it will
cache the result and return the cached result.
- Specified by:
getEntity
in class ClientResponse<T>
- Returns:
- an object instance or null if there is no entity
- See Also:
MessageBodyWriter
getEntity
public <T2> T2 getEntity(java.lang.Class<T2> type,
java.lang.reflect.Type genericType)
- Description copied from class:
ClientResponse
- Extract the response body with the provided type information
This method actually does the reading on the OutputStream. It will only do the read once. Afterwards, it will
cache the result and return the cached result.
- Specified by:
getEntity
in class ClientResponse<T>
- Returns:
getEntity
public <T2> T2 getEntity(GenericType<T2> genericType)
- Description copied from class:
ClientResponse
- Extract the response body with the provided type information. GenericType is a trick used to
pass in generic type information to the resteasy runtime.
For example:
List list = response.getEntity(new GenericType() {});
This method actually does the reading on the OutputStream. It will only do the read once. Afterwards, it will
cache the result and return the cached result.
- Specified by:
getEntity
in class ClientResponse<T>
- Returns:
getHeaders
public MultivaluedMap<java.lang.String,java.lang.String> getHeaders()
- Description copied from class:
ClientResponse
- This method returns the same exact map as Response.getMetadata() except as a map of strings rather than objects
- Specified by:
getHeaders
in class ClientResponse<T>
- Returns:
getMetadata
public MultivaluedMap<java.lang.String,java.lang.Object> getMetadata()
- Description copied from class:
Response
- Get metadata associated with the response as a map. The returned map
may be subsequently modified by the JAX-RS runtime. Values will be
serialized using a
RuntimeDelegate.HeaderDelegate
if one is available via
RuntimeDelegate.createHeaderDelegate(java.lang.Class)
for the class of the value or using the values toString
method if a
header delegate is not available.
- Specified by:
getMetadata
in class Response
- Returns:
- response metadata as a map
getStatus
public int getStatus()
- Description copied from class:
Response
- Get the status code associated with the response.
- Specified by:
getStatus
in class Response
- Returns:
- the response status code or -1 if the status was not set.
finalize
protected void finalize()
throws java.lang.Throwable
- Overrides:
finalize
in class java.lang.Object
- Throws:
java.lang.Throwable
getRestVerb
public java.lang.String getRestVerb()
setRestVerb
public void setRestVerb(java.lang.String restVerb)
setUrl
public void setUrl(java.lang.String url)
execute
public int execute(org.apache.commons.httpclient.HttpClient client)
extractHeaders
public static CaseInsensitiveMap<java.lang.String> extractHeaders(org.apache.commons.httpclient.HttpMethodBase baseMethod)
checkFailureStatus
public void checkFailureStatus()
createResponseFailure
public ClientResponseFailure createResponseFailure(java.lang.String message)
createResponseFailure
public ClientResponseFailure createResponseFailure(java.lang.String message,
java.lang.Exception e)
releaseConnection
public void releaseConnection()
getResponseStatus
public Response.Status getResponseStatus()
- Specified by:
getResponseStatus
in class ClientResponse<T>
wasReleased
public boolean wasReleased()
Copyright © 2009. All Rights Reserved.