Package org.jboss.resteasy.client.core
Class BaseClientResponse<T>
java.lang.Object
javax.ws.rs.core.Response
org.jboss.resteasy.client.ClientResponse<T>
org.jboss.resteasy.client.core.BaseClientResponse<T>
- Version:
- $Revision: 1 $
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
private static class
Nested classes/interfaces inherited from class javax.ws.rs.core.Response
javax.ws.rs.core.Response.ResponseBuilder, javax.ws.rs.core.Response.Status, javax.ws.rs.core.Response.StatusType
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
protected Annotation[]
protected String
protected Exception
protected ClientExecutor
protected Type
protected LinkHeader
protected Link
protected ResteasyProviderFactory
protected javax.ws.rs.ext.ReaderInterceptor[]
protected Class<?>
protected int
protected Object
protected boolean
-
Constructor Summary
ConstructorsConstructorDescriptionBaseClientResponse
(BaseClientResponse.BaseClientResponseStreamFactory streamFactory, ClientExecutor executor) -
Method Summary
Modifier and TypeMethodDescriptionboolean
void
void
close()
static ClientResponse
copyFromError
(ClientResponse copy) Store entity within a byte array input stream because we want to release the connection if a ClientResponseFailure is thrown.createResponseFailure
(String message) createResponseFailure
(String message, Exception e) protected final void
finalize()
private <T2> Annotation[]
getAnnotations
(Class<T2> type, Type genericType) Used to pass information to and between interceptors.getDate()
Unmarshal the target entity from the response OutputStream.<T2> T2
Extract the response body with the provided type information<T2> T2
Extract the response body with the provided type information<T2> T2
getEntity
(Class<T2> type, Type genericType, Annotation[] anns) <T2> T2
getEntity
(GenericType<T2> genericType) Extract the response body with the provided type information.<T2> T2
getEntity
(GenericType<T2> genericType, Annotation[] ann) javax.ws.rs.core.EntityTag
getHeaderAsLink
(String headerName) Header is assumed to be a URL, a Link object is created from it if it exists.getHeaderString
(String name) int
javax.ws.rs.core.Link
javax.ws.rs.core.Link.Builder
getLinkBuilder
(String relation) Get the link headers of the response.Set<javax.ws.rs.core.Link>
getLinks()
Get the Location header as a Link so you can easily execute on it.javax.ws.rs.core.MediaType
getResponseHeader
(String headerKey) This method returns the same exact map as Response.getMetadata() except as a map of strings rather than objectsjavax.ws.rs.core.Response.Status
Class<?>
int
javax.ws.rs.core.Response.StatusType
boolean
boolean
<T> T
readEntity
(Class<T> entityType) <T> T
readEntity
(Class<T> entityType, Annotation[] annotations) <T> T
readEntity
(javax.ws.rs.core.GenericType<T> entityType) <T> T
readEntity
(javax.ws.rs.core.GenericType<T> entityType, Annotation[] annotations) protected <T2> Object
readFrom
(Class<T2> type, Type genericType, javax.ws.rs.core.MediaType media, Annotation[] annotations) final void
void
Attempts to reset the InputStream of the response.void
setAlternateMediaType
(String alternateMediaType) void
setAnnotations
(Annotation[] annotations) void
setAttributeExceptionsTo
(String attributeExceptionsTo) void
setAttributes
(Map<String, Object> attributes) void
setException
(Exception exception) void
setGenericReturnType
(Type genericReturnType) void
setHeaders
(javax.ws.rs.core.MultivaluedMap<String, String> headers) void
setProviderFactory
(ResteasyProviderFactory providerFactory) void
setReaderInterceptors
(javax.ws.rs.ext.ReaderInterceptor[] readerInterceptors) void
setReturnType
(Class<T> returnType) void
setStatus
(int status) void
void
setWasReleased
(boolean wasReleased) boolean
Methods inherited from class javax.ws.rs.core.Response
accepted, accepted, created, fromResponse, getHeaders, noContent, notAcceptable, notModified, notModified, notModified, ok, ok, ok, ok, ok, seeOther, serverError, status, status, status, temporaryRedirect
-
Field Details
-
providerFactory
-
attributeExceptionsTo
-
headers
-
alternateMediaType
-
returnType
-
genericReturnType
-
annotations
-
status
protected int status -
wasReleased
protected boolean wasReleased -
unmarshaledEntity
-
readerInterceptors
protected javax.ws.rs.ext.ReaderInterceptor[] readerInterceptors -
exception
-
streamFactory
-
linkHeader
-
location
-
executor
-
attributes
-
-
Constructor Details
-
BaseClientResponse
public BaseClientResponse(BaseClientResponse.BaseClientResponseStreamFactory streamFactory, ClientExecutor executor) -
BaseClientResponse
-
-
Method Details
-
copyFromError
Store entity within a byte array input stream because we want to release the connection if a ClientResponseFailure is thrown. Copy status and headers, but ignore all type information stored in the ClientResponse.- Parameters:
copy
-- Returns:
-
getAttributes
Description copied from class:ClientResponse
Used to pass information to and between interceptors.- Specified by:
getAttributes
in classClientResponse<T>
- Returns:
-
setAttributes
-
setReaderInterceptors
public void setReaderInterceptors(javax.ws.rs.ext.ReaderInterceptor[] readerInterceptors) -
setStatus
public void setStatus(int status) -
setHeaders
-
setProviderFactory
-
setReturnType
-
getReturnType
-
setGenericReturnType
-
setAnnotations
-
getAttributeExceptionsTo
-
setAttributeExceptionsTo
-
getException
-
setException
-
getAnnotations
-
getResponseHeader
-
getLinkHeader
Description copied from class:ClientResponse
Get the link headers of the response. All Link objects returned will automatically have the same ClientExecutor as the request.- Specified by:
getLinkHeader
in classClientResponse<T>
- Returns:
- non-null
-
getLocationLink
Description copied from class:ClientResponse
Get the Location header as a Link so you can easily execute on it. All Link objects returned will automatically have the same ClientExecutor as the request.- Specified by:
getLocationLink
in classClientResponse<T>
- Returns:
-
getHeaderAsLink
Description copied from class:ClientResponse
Header is assumed to be a URL, a Link object is created from it if it exists. Also, the type field of the link with be initialized if there is another header appended with -Type. i.e. if the header was "custom" it will also look for a header of custom-type and expect that this is a media type. All Link objects returned will automatically have the same ClientExecutor as the request.- Specified by:
getHeaderAsLink
in classClientResponse<T>
- Returns:
- null if it doesn't exist
-
setAlternateMediaType
-
getStreamFactory
-
setStreamFactory
-
resetStream
public void resetStream()Description copied from class:ClientResponse
Attempts to reset the InputStream of the response. Useful for refetching an entity after a marshalling failure- Specified by:
resetStream
in classClientResponse<T>
-
getEntity
Description copied from class:ClientResponse
Unmarshal the target entity from the response OutputStream. You must have type information set viaotherwise, 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 classClientResponse<T>
-
getEntity
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 classClientResponse<T>
- Returns:
-
getEntity
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 classClientResponse<T>
- Returns:
-
getAnnotations
-
getEntity
- Specified by:
getEntity
in classClientResponse<T>
- Returns:
-
getMediaType
public javax.ws.rs.core.MediaType getMediaType()- Specified by:
getMediaType
in classjavax.ws.rs.core.Response
-
readFrom
protected <T2> Object readFrom(Class<T2> type, Type genericType, javax.ws.rs.core.MediaType media, Annotation[] annotations) -
getEntity
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<List () {}); 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 classClientResponse<T>
- Returns:
-
getEntity
- Specified by:
getEntity
in classClientResponse<T>
- Returns:
-
getResponseHeaders
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:
getResponseHeaders
in classClientResponse<T>
- Returns:
-
getMetadata
- Specified by:
getMetadata
in classjavax.ws.rs.core.Response
-
getStatus
public int getStatus()- Specified by:
getStatus
in classjavax.ws.rs.core.Response
-
getStatusInfo
public javax.ws.rs.core.Response.StatusType getStatusInfo()- Specified by:
getStatusInfo
in classjavax.ws.rs.core.Response
-
checkFailureStatus
public void checkFailureStatus() -
createResponseFailure
-
createResponseFailure
-
getResponseStatus
public javax.ws.rs.core.Response.Status getResponseStatus()- Specified by:
getResponseStatus
in classClientResponse<T>
-
wasReleased
public boolean wasReleased() -
setWasReleased
public void setWasReleased(boolean wasReleased) -
releaseConnection
public final void releaseConnection()- Specified by:
releaseConnection
in classClientResponse<T>
-
finalize
-
readEntity
- Specified by:
readEntity
in classjavax.ws.rs.core.Response
-
readEntity
public <T> T readEntity(javax.ws.rs.core.GenericType<T> entityType) - Specified by:
readEntity
in classjavax.ws.rs.core.Response
-
readEntity
- Specified by:
readEntity
in classjavax.ws.rs.core.Response
-
readEntity
- Specified by:
readEntity
in classjavax.ws.rs.core.Response
-
hasEntity
public boolean hasEntity()- Specified by:
hasEntity
in classjavax.ws.rs.core.Response
-
bufferEntity
public boolean bufferEntity()- Specified by:
bufferEntity
in classjavax.ws.rs.core.Response
-
close
public void close()- Specified by:
close
in classjavax.ws.rs.core.Response
-
getHeaderString
- Specified by:
getHeaderString
in classjavax.ws.rs.core.Response
-
getLanguage
- Specified by:
getLanguage
in classjavax.ws.rs.core.Response
-
getLength
public int getLength()- Specified by:
getLength
in classjavax.ws.rs.core.Response
-
getCookies
- Specified by:
getCookies
in classjavax.ws.rs.core.Response
-
getEntityTag
public javax.ws.rs.core.EntityTag getEntityTag()- Specified by:
getEntityTag
in classjavax.ws.rs.core.Response
-
getDate
- Specified by:
getDate
in classjavax.ws.rs.core.Response
-
getLastModified
- Specified by:
getLastModified
in classjavax.ws.rs.core.Response
-
getLinks
- Specified by:
getLinks
in classjavax.ws.rs.core.Response
-
hasLink
- Specified by:
hasLink
in classjavax.ws.rs.core.Response
-
getLink
- Specified by:
getLink
in classjavax.ws.rs.core.Response
-
getLinkBuilder
- Specified by:
getLinkBuilder
in classjavax.ws.rs.core.Response
-
getLocation
- Specified by:
getLocation
in classjavax.ws.rs.core.Response
-
getAllowedMethods
- Specified by:
getAllowedMethods
in classjavax.ws.rs.core.Response
-
getStringHeaders
- Specified by:
getStringHeaders
in classjavax.ws.rs.core.Response
-