Class BaseClientResponse<T>

java.lang.Object
javax.ws.rs.core.Response
org.jboss.resteasy.client.ClientResponse<T>
org.jboss.resteasy.client.core.BaseClientResponse<T>

public class BaseClientResponse<T> extends ClientResponse<T>
Version:
$Revision: 1 $
  • Field Details

    • providerFactory

      protected ResteasyProviderFactory providerFactory
    • attributeExceptionsTo

      protected String attributeExceptionsTo
    • headers

      protected javax.ws.rs.core.MultivaluedMap<String,String> headers
    • alternateMediaType

      protected String alternateMediaType
    • returnType

      protected Class<?> returnType
    • genericReturnType

      protected Type genericReturnType
    • annotations

      protected Annotation[] annotations
    • status

      protected int status
    • wasReleased

      protected boolean wasReleased
    • unmarshaledEntity

      protected Object unmarshaledEntity
    • readerInterceptors

      protected javax.ws.rs.ext.ReaderInterceptor[] readerInterceptors
    • exception

      protected Exception exception
    • streamFactory

    • linkHeader

      protected LinkHeader linkHeader
    • location

      protected Link location
    • executor

      protected ClientExecutor executor
    • attributes

      protected Map<String,Object> attributes
  • Constructor Details

  • Method Details

    • copyFromError

      public 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. Copy status and headers, but ignore all type information stored in the ClientResponse.
      Parameters:
      copy -
      Returns:
    • getAttributes

      public Map<String,Object> getAttributes()
      Description copied from class: ClientResponse
      Used to pass information to and between interceptors.
      Specified by:
      getAttributes in class ClientResponse<T>
      Returns:
    • setAttributes

      public void setAttributes(Map<String,Object> attributes)
    • setReaderInterceptors

      public void setReaderInterceptors(javax.ws.rs.ext.ReaderInterceptor[] readerInterceptors)
    • setStatus

      public void setStatus(int status)
    • setHeaders

      public void setHeaders(javax.ws.rs.core.MultivaluedMap<String,String> headers)
    • setProviderFactory

      public void setProviderFactory(ResteasyProviderFactory providerFactory)
    • setReturnType

      public void setReturnType(Class<T> returnType)
    • getReturnType

      public Class<?> getReturnType()
    • setGenericReturnType

      public void setGenericReturnType(Type genericReturnType)
    • setAnnotations

      public void setAnnotations(Annotation[] annotations)
    • getAttributeExceptionsTo

      public String getAttributeExceptionsTo()
    • setAttributeExceptionsTo

      public void setAttributeExceptionsTo(String attributeExceptionsTo)
    • getException

      public Exception getException()
    • setException

      public void setException(Exception exception)
    • getAnnotations

      public Annotation[] getAnnotations()
    • getResponseHeader

      public String getResponseHeader(String headerKey)
    • getLinkHeader

      public LinkHeader 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 class ClientResponse<T>
      Returns:
      non-null
    • getLocationLink

      public Link 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 class ClientResponse<T>
      Returns:
    • getHeaderAsLink

      public Link getHeaderAsLink(String headerName)
      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 class ClientResponse<T>
      Returns:
      null if it doesn't exist
    • setAlternateMediaType

      public void setAlternateMediaType(String alternateMediaType)
    • getStreamFactory

    • setStreamFactory

      public void setStreamFactory(BaseClientResponse.BaseClientResponseStreamFactory streamFactory)
    • 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 class ClientResponse<T>
    • 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>
    • getEntity

      public <T2> T2 getEntity(Class<T2> type)
      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(Class<T2> type, 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:
    • getAnnotations

      private <T2> Annotation[] getAnnotations(Class<T2> type, Type genericType)
    • getEntity

      public <T2> T2 getEntity(Class<T2> type, Type genericType, Annotation[] anns)
      Specified by:
      getEntity in class ClientResponse<T>
      Returns:
    • getMediaType

      public javax.ws.rs.core.MediaType getMediaType()
      Specified by:
      getMediaType in class javax.ws.rs.core.Response
    • readFrom

      protected <T2> Object readFrom(Class<T2> type, Type genericType, javax.ws.rs.core.MediaType media, Annotation[] annotations)
    • 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<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 class ClientResponse<T>
      Returns:
    • getEntity

      public <T2> T2 getEntity(GenericType<T2> genericType, Annotation[] ann)
      Specified by:
      getEntity in class ClientResponse<T>
      Returns:
    • getResponseHeaders

      public javax.ws.rs.core.MultivaluedMap<String,String> 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 class ClientResponse<T>
      Returns:
    • getMetadata

      public javax.ws.rs.core.MultivaluedMap<String,Object> getMetadata()
      Specified by:
      getMetadata in class javax.ws.rs.core.Response
    • getStatus

      public int getStatus()
      Specified by:
      getStatus in class javax.ws.rs.core.Response
    • getStatusInfo

      public javax.ws.rs.core.Response.StatusType getStatusInfo()
      Specified by:
      getStatusInfo in class javax.ws.rs.core.Response
    • checkFailureStatus

      public void checkFailureStatus()
    • createResponseFailure

      public ClientResponseFailure createResponseFailure(String message)
    • createResponseFailure

      public ClientResponseFailure createResponseFailure(String message, Exception e)
    • getResponseStatus

      public javax.ws.rs.core.Response.Status getResponseStatus()
      Specified by:
      getResponseStatus in class ClientResponse<T>
    • wasReleased

      public boolean wasReleased()
    • setWasReleased

      public void setWasReleased(boolean wasReleased)
    • releaseConnection

      public final void releaseConnection()
      Specified by:
      releaseConnection in class ClientResponse<T>
    • finalize

      protected final void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • readEntity

      public <T> T readEntity(Class<T> entityType)
      Specified by:
      readEntity in class javax.ws.rs.core.Response
    • readEntity

      public <T> T readEntity(javax.ws.rs.core.GenericType<T> entityType)
      Specified by:
      readEntity in class javax.ws.rs.core.Response
    • readEntity

      public <T> T readEntity(Class<T> entityType, Annotation[] annotations)
      Specified by:
      readEntity in class javax.ws.rs.core.Response
    • readEntity

      public <T> T readEntity(javax.ws.rs.core.GenericType<T> entityType, Annotation[] annotations)
      Specified by:
      readEntity in class javax.ws.rs.core.Response
    • hasEntity

      public boolean hasEntity()
      Specified by:
      hasEntity in class javax.ws.rs.core.Response
    • bufferEntity

      public boolean bufferEntity()
      Specified by:
      bufferEntity in class javax.ws.rs.core.Response
    • close

      public void close()
      Specified by:
      close in class javax.ws.rs.core.Response
    • getHeaderString

      public String getHeaderString(String name)
      Specified by:
      getHeaderString in class javax.ws.rs.core.Response
    • getLanguage

      public Locale getLanguage()
      Specified by:
      getLanguage in class javax.ws.rs.core.Response
    • getLength

      public int getLength()
      Specified by:
      getLength in class javax.ws.rs.core.Response
    • getCookies

      public Map<String,javax.ws.rs.core.NewCookie> getCookies()
      Specified by:
      getCookies in class javax.ws.rs.core.Response
    • getEntityTag

      public javax.ws.rs.core.EntityTag getEntityTag()
      Specified by:
      getEntityTag in class javax.ws.rs.core.Response
    • getDate

      public Date getDate()
      Specified by:
      getDate in class javax.ws.rs.core.Response
    • getLastModified

      public Date getLastModified()
      Specified by:
      getLastModified in class javax.ws.rs.core.Response
    • getLinks

      public Set<javax.ws.rs.core.Link> getLinks()
      Specified by:
      getLinks in class javax.ws.rs.core.Response
    • hasLink

      public boolean hasLink(String relation)
      Specified by:
      hasLink in class javax.ws.rs.core.Response
    • getLink

      public javax.ws.rs.core.Link getLink(String relation)
      Specified by:
      getLink in class javax.ws.rs.core.Response
    • getLinkBuilder

      public javax.ws.rs.core.Link.Builder getLinkBuilder(String relation)
      Specified by:
      getLinkBuilder in class javax.ws.rs.core.Response
    • getLocation

      public URI getLocation()
      Specified by:
      getLocation in class javax.ws.rs.core.Response
    • getAllowedMethods

      public Set<String> getAllowedMethods()
      Specified by:
      getAllowedMethods in class javax.ws.rs.core.Response
    • getStringHeaders

      public javax.ws.rs.core.MultivaluedMap<String,String> getStringHeaders()
      Specified by:
      getStringHeaders in class javax.ws.rs.core.Response