org.jboss.resteasy.client.jaxrs.internal

## Class ClientResponseContextImpl

- java.lang.Object
- - org.jboss.resteasy.client.jaxrs.internal.ClientResponseContextImpl

- All Implemented Interfaces:
    ClientResponseContext

      public class ClientResponseContextImpl
      extends Object
      implements ClientResponseContext

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ClientResponse` | `response`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientResponseContextImpl(ClientResponse response)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Set<String>` | `getAllowedMethods()` Get the allowed HTTP methods from the Allow HTTP header.
    `Map<String,NewCookie>` | `getCookies()` Get any new cookies set on the response message.
    `Date` | `getDate()` Get message date.
    `InputStream` | `getEntityStream()` Get the entity input stream.
    `EntityTag` | `getEntityTag()` Get the entity tag.
    `MultivaluedMap<String,String>` | `getHeaders()` Get the mutable response headers multivalued map.
    `String` | `getHeaderString(String name)` Get a message header as a single string value.
    `Locale` | `getLanguage()` Get the language of the entity.
    `Date` | `getLastModified()` Get the last modified date.
    `int` | `getLength()` Get Content-Length value.
    `Link` | `getLink(String relation)` Get the link for the relation.
    `Link.Builder` | `getLinkBuilder(String relation)` Convenience method that returns a `Link.Builder` for the relation.
    `Set<Link>` | `getLinks()` Get the links attached to the message as header.
    `URI` | `getLocation()` Get the location.
    `MediaType` | `getMediaType()` Get the media type of the entity.
    `int` | `getStatus()` Get the status code associated with the response.
    `Response.StatusType` | `getStatusInfo()` Get the complete status information associated with the response.
    `boolean` | `hasEntity()` Check if there is a non-empty entity input stream is available in the response message.
    `boolean` | `hasLink(String relation)` Check if link for relation exists.
    `void` | `setEntityStream(InputStream entityStream)` Set a new entity input stream.
    `void` | `setStatus(int code)` Set a new response status code.
    `void` | `setStatusInfo(Response.StatusType statusInfo)` Set the complete status information (status code and reason phrase) associated with the response.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### response

          protected final ClientResponse response

  - ### Constructor Detail

    - #### ClientResponseContextImpl

          public ClientResponseContextImpl(ClientResponse response)

  - ### Method Detail

    - #### getStatus

          public int getStatus()

      Description copied from interface: `ClientResponseContext`
      Get the status code associated with the response.
      Specified by:
        `getStatus` in interface `ClientResponseContext`
      Returns:
        the response status code or -1 if the status was not set.

    - #### setStatus

          public void setStatus(int code)

      Description copied from interface: `ClientResponseContext`
      Set a new response status code.
      Specified by:
        `setStatus` in interface `ClientResponseContext`
      Parameters:
        `code` - new status code.

    - #### getStatusInfo

          public Response.StatusType getStatusInfo()

      Description copied from interface: `ClientResponseContext`
      Get the complete status information associated with the response.
      Specified by:
        `getStatusInfo` in interface `ClientResponseContext`
      Returns:
        the response status information or `null` if the status was not set.

    - #### setStatusInfo

          public void setStatusInfo(Response.StatusType statusInfo)

      Description copied from interface: `ClientResponseContext`
      Set the complete status information (status code and reason phrase) associated with the response.
      Specified by:
        `setStatusInfo` in interface `ClientResponseContext`
      Parameters:
        `statusInfo` - the response status information.

    - #### getHeaders

          public MultivaluedMap<String,String> getHeaders()

      Description copied from interface: `ClientResponseContext`
      Get the mutable response headers multivalued map.
      Specified by:
        `getHeaders` in interface `ClientResponseContext`
      Returns:
        mutable multivalued map of response headers.
      See Also:
        `ClientResponseContext.getHeaderString(String)`

    - #### getAllowedMethods

          public Set<String> getAllowedMethods()

      Description copied from interface: `ClientResponseContext`
      Get the allowed HTTP methods from the Allow HTTP header.
      Specified by:
        `getAllowedMethods` in interface `ClientResponseContext`
      Returns:
        the allowed HTTP methods, all methods will returned as upper case strings.

    - #### getDate

          public Date getDate()

      Description copied from interface: `ClientResponseContext`
      Get message date.
      Specified by:
        `getDate` in interface `ClientResponseContext`
      Returns:
        the message date, otherwise `null` if not present.

    - #### getLanguage

          public Locale getLanguage()

      Description copied from interface: `ClientResponseContext`
      Get the language of the entity.
      Specified by:
        `getLanguage` in interface `ClientResponseContext`
      Returns:
        the language of the entity or `null` if not specified

    - #### getLength

          public int getLength()

      Description copied from interface: `ClientResponseContext`
      Get Content-Length value.
      Specified by:
        `getLength` in interface `ClientResponseContext`
      Returns:
        Content-Length as integer if present and valid number. In other cases returns -1.

    - #### getMediaType

          public MediaType getMediaType()

      Description copied from interface: `ClientResponseContext`
      Get the media type of the entity.
      Specified by:
        `getMediaType` in interface `ClientResponseContext`
      Returns:
        the media type or `null` if not specified (e.g. there's no response entity).

    - #### getCookies

          public Map<String,NewCookie> getCookies()

      Description copied from interface: `ClientResponseContext`
      Get any new cookies set on the response message.
      Specified by:
        `getCookies` in interface `ClientResponseContext`
      Returns:
        a read-only map of cookie name (String) to a `new cookie`.

    - #### getEntityTag

          public EntityTag getEntityTag()

      Description copied from interface: `ClientResponseContext`
      Get the entity tag.
      Specified by:
        `getEntityTag` in interface `ClientResponseContext`
      Returns:
        the entity tag, otherwise `null` if not present.

    - #### getLastModified

          public Date getLastModified()

      Description copied from interface: `ClientResponseContext`
      Get the last modified date.
      Specified by:
        `getLastModified` in interface `ClientResponseContext`
      Returns:
        the last modified date, otherwise `null` if not present.

    - #### getLocation

          public URI getLocation()

      Description copied from interface: `ClientResponseContext`
      Get the location.
      Specified by:
        `getLocation` in interface `ClientResponseContext`
      Returns:
        the location URI, otherwise `null` if not present.

    - #### getLinks

          public Set<Link> getLinks()

      Description copied from interface: `ClientResponseContext`
      Get the links attached to the message as header.
      Specified by:
        `getLinks` in interface `ClientResponseContext`
      Returns:
        links, may return empty `Set` if no links are present. Never returns `null`.

    - #### hasLink

          public boolean hasLink(String relation)

      Description copied from interface: `ClientResponseContext`
      Check if link for relation exists.
      Specified by:
        `hasLink` in interface `ClientResponseContext`
      Parameters:
        `relation` - link relation.
      Returns:
        `true` if the for the relation link exists, `false` otherwise.

    - #### getLink

          public Link getLink(String relation)

      Description copied from interface: `ClientResponseContext`
      Get the link for the relation.
      Specified by:
        `getLink` in interface `ClientResponseContext`
      Parameters:
        `relation` - link relation.
      Returns:
        the link for the relation, otherwise `null` if not present.

    - #### getLinkBuilder

          public Link.Builder getLinkBuilder(String relation)

      Description copied from interface: `ClientResponseContext`
      Convenience method that returns a `Link.Builder` for the relation.
      Specified by:
        `getLinkBuilder` in interface `ClientResponseContext`
      Parameters:
        `relation` - link relation.
      Returns:
        the link builder for the relation, otherwise `null` if not present.

    - #### hasEntity

          public boolean hasEntity()

      Description copied from interface: `ClientResponseContext`
      Check if there is a non-empty entity input stream is available in the response message. The method returns `true` if the entity is present, returns `false` otherwise.
      Specified by:
        `hasEntity` in interface `ClientResponseContext`
      Returns:
        `true` if there is an entity present in the message, `false` otherwise.

    - #### getEntityStream

          public InputStream getEntityStream()

      Description copied from interface: `ClientResponseContext`
      Get the entity input stream. The JAX-RS runtime is responsible for closing the input stream.
      Specified by:
        `getEntityStream` in interface `ClientResponseContext`
      Returns:
        entity input stream.

    - #### setEntityStream

          public void setEntityStream(InputStream entityStream)

      Description copied from interface: `ClientResponseContext`
      Set a new entity input stream. The JAX-RS runtime is responsible for closing the input stream.
      Specified by:
        `setEntityStream` in interface `ClientResponseContext`
      Parameters:
        `entityStream` - new entity input stream.

    - #### getHeaderString

          public String getHeaderString(String name)

      Description copied from interface: `ClientResponseContext`
      Get a message header as a single string value.
      Specified by:
        `getHeaderString` in interface `ClientResponseContext`
      Parameters:
        `name` - the message header.
      Returns:
        the message header value. If the message header is not present then `null` is returned. If the message header is present but has no value then the empty string is returned. If the message header is present more than once then the values of joined together and separated by a ',' character.
      See Also:
        `ClientResponseContext.getHeaders()`

Copyright © 2014. All Rights Reserved.