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 interfaceprivate static classNested 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 Stringprotected Annotation[]protected Stringprotected Exceptionprotected ClientExecutorprotected Typeprotected LinkHeaderprotected Linkprotected ResteasyProviderFactoryprotected javax.ws.rs.ext.ReaderInterceptor[]protected Class<?> protected intprotected Objectprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionBaseClientResponse(BaseClientResponse.BaseClientResponseStreamFactory streamFactory, ClientExecutor executor) -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidvoidclose()static ClientResponsecopyFromError(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 voidfinalize()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> T2Extract the response body with the provided type information<T2> T2Extract the response body with the provided type information<T2> T2getEntity(Class<T2> type, Type genericType, Annotation[] anns) <T2> T2getEntity(GenericType<T2> genericType) Extract the response body with the provided type information.<T2> T2getEntity(GenericType<T2> genericType, Annotation[] ann) javax.ws.rs.core.EntityTaggetHeaderAsLink(String headerName) Header is assumed to be a URL, a Link object is created from it if it exists.getHeaderString(String name) intjavax.ws.rs.core.Linkjavax.ws.rs.core.Link.BuildergetLinkBuilder(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.MediaTypegetResponseHeader(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.StatusClass<?> intjavax.ws.rs.core.Response.StatusTypebooleanboolean<T> TreadEntity(Class<T> entityType) <T> TreadEntity(Class<T> entityType, Annotation[] annotations) <T> TreadEntity(javax.ws.rs.core.GenericType<T> entityType) <T> TreadEntity(javax.ws.rs.core.GenericType<T> entityType, Annotation[] annotations) protected <T2> ObjectreadFrom(Class<T2> type, Type genericType, javax.ws.rs.core.MediaType media, Annotation[] annotations) final voidvoidAttempts to reset the InputStream of the response.voidsetAlternateMediaType(String alternateMediaType) voidsetAnnotations(Annotation[] annotations) voidsetAttributeExceptionsTo(String attributeExceptionsTo) voidsetAttributes(Map<String, Object> attributes) voidsetException(Exception exception) voidsetGenericReturnType(Type genericReturnType) voidsetHeaders(javax.ws.rs.core.MultivaluedMap<String, String> headers) voidsetProviderFactory(ResteasyProviderFactory providerFactory) voidsetReaderInterceptors(javax.ws.rs.ext.ReaderInterceptor[] readerInterceptors) voidsetReturnType(Class<T> returnType) voidsetStatus(int status) voidvoidsetWasReleased(boolean wasReleased) booleanMethods 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:ClientResponseUsed to pass information to and between interceptors.- Specified by:
getAttributesin 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:ClientResponseGet the link headers of the response. All Link objects returned will automatically have the same ClientExecutor as the request.- Specified by:
getLinkHeaderin classClientResponse<T>- Returns:
- non-null
-
getLocationLink
Description copied from class:ClientResponseGet 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:
getLocationLinkin classClientResponse<T>- Returns:
-
getHeaderAsLink
Description copied from class:ClientResponseHeader 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:
getHeaderAsLinkin classClientResponse<T>- Parameters:
headerName-- Returns:
- null if it doesn't exist
-
setAlternateMediaType
-
getStreamFactory
-
setStreamFactory
-
resetStream
public void resetStream()Description copied from class:ClientResponseAttempts to reset the InputStream of the response. Useful for refetching an entity after a marshalling failure- Specified by:
resetStreamin classClientResponse<T>
-
getEntity
Description copied from class:ClientResponseUnmarshal 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:
getEntityin classClientResponse<T>- Returns:
-
getEntity
Description copied from class:ClientResponseExtract 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:
getEntityin classClientResponse<T>- Type Parameters:
T2-- Parameters:
type-- Returns:
-
getEntity
Description copied from class:ClientResponseExtract 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:
getEntityin classClientResponse<T>- Type Parameters:
T2-- Parameters:
type-genericType-- Returns:
-
getAnnotations
-
getEntity
- Specified by:
getEntityin classClientResponse<T>- Type Parameters:
T2-- Parameters:
type-genericType-anns-- Returns:
-
getMediaType
public javax.ws.rs.core.MediaType getMediaType()- Specified by:
getMediaTypein 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:ClientResponseExtract 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 GenericTypeinvalid input: '<'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:
getEntityin classClientResponse<T>- Type Parameters:
T2-- Parameters:
genericType-- Returns:
-
getEntity
- Specified by:
getEntityin classClientResponse<T>- Type Parameters:
T2-- Parameters:
genericType-ann-- Returns:
-
getResponseHeaders
Description copied from class:ClientResponseThis method returns the same exact map as Response.getMetadata() except as a map of strings rather than objects- Specified by:
getResponseHeadersin classClientResponse<T>- Returns:
-
getMetadata
- Specified by:
getMetadatain classjavax.ws.rs.core.Response
-
getStatus
public int getStatus()- Specified by:
getStatusin classjavax.ws.rs.core.Response
-
getStatusInfo
public javax.ws.rs.core.Response.StatusType getStatusInfo()- Specified by:
getStatusInfoin classjavax.ws.rs.core.Response
-
checkFailureStatus
public void checkFailureStatus() -
createResponseFailure
-
createResponseFailure
-
getResponseStatus
public javax.ws.rs.core.Response.Status getResponseStatus()- Specified by:
getResponseStatusin classClientResponse<T>
-
wasReleased
public boolean wasReleased() -
setWasReleased
public void setWasReleased(boolean wasReleased) -
releaseConnection
public final void releaseConnection()- Specified by:
releaseConnectionin classClientResponse<T>
-
finalize
-
readEntity
- Specified by:
readEntityin classjavax.ws.rs.core.Response
-
readEntity
public <T> T readEntity(javax.ws.rs.core.GenericType<T> entityType) - Specified by:
readEntityin classjavax.ws.rs.core.Response
-
readEntity
- Specified by:
readEntityin classjavax.ws.rs.core.Response
-
readEntity
- Specified by:
readEntityin classjavax.ws.rs.core.Response
-
hasEntity
public boolean hasEntity()- Specified by:
hasEntityin classjavax.ws.rs.core.Response
-
bufferEntity
public boolean bufferEntity()- Specified by:
bufferEntityin classjavax.ws.rs.core.Response
-
close
public void close()- Specified by:
closein classjavax.ws.rs.core.Response
-
getHeaderString
- Specified by:
getHeaderStringin classjavax.ws.rs.core.Response
-
getLanguage
- Specified by:
getLanguagein classjavax.ws.rs.core.Response
-
getLength
public int getLength()- Specified by:
getLengthin classjavax.ws.rs.core.Response
-
getCookies
- Specified by:
getCookiesin classjavax.ws.rs.core.Response
-
getEntityTag
public javax.ws.rs.core.EntityTag getEntityTag()- Specified by:
getEntityTagin classjavax.ws.rs.core.Response
-
getDate
- Specified by:
getDatein classjavax.ws.rs.core.Response
-
getLastModified
- Specified by:
getLastModifiedin classjavax.ws.rs.core.Response
-
getLinks
- Specified by:
getLinksin classjavax.ws.rs.core.Response
-
hasLink
- Specified by:
hasLinkin classjavax.ws.rs.core.Response
-
getLink
- Specified by:
getLinkin classjavax.ws.rs.core.Response
-
getLinkBuilder
- Specified by:
getLinkBuilderin classjavax.ws.rs.core.Response
-
getLocation
- Specified by:
getLocationin classjavax.ws.rs.core.Response
-
getAllowedMethods
- Specified by:
getAllowedMethodsin classjavax.ws.rs.core.Response
-
getStringHeaders
- Specified by:
getStringHeadersin classjavax.ws.rs.core.Response
-