org.jboss.resteasy.specimpl

## Class ResteasyHttpHeaders

- java.lang.Object
- - org.jboss.resteasy.specimpl.ResteasyHttpHeaders

- All Implemented Interfaces:
    HttpHeaders

      public class ResteasyHttpHeaders
      extends Object
      implements HttpHeaders

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    - ### Fields inherited from interface javax.ws.rs.core.HttpHeaders

      `ACCEPT, ACCEPT_CHARSET, ACCEPT_ENCODING, ACCEPT_LANGUAGE, ALLOW, AUTHORIZATION, CACHE_CONTROL, CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_ID, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_TYPE, COOKIE, DATE, ETAG, EXPIRES, HOST, IF_MATCH, IF_MODIFIED_SINCE, IF_NONE_MATCH, IF_UNMODIFIED_SINCE, LAST_MODIFIED, LINK, LOCATION, RETRY_AFTER, SET_COOKIE, USER_AGENT, VARY, WWW_AUTHENTICATE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ResteasyHttpHeaders(MultivaluedMap<String,String> requestHeaders)`
    `ResteasyHttpHeaders(MultivaluedMap<String,String> requestHeaders, Map<String,Cookie> cookies)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<Locale>` | `getAcceptableLanguages()` Get a list of languages that are acceptable for the response.
    `List<MediaType>` | `getAcceptableMediaTypes()` Get a list of media types that are acceptable for the response.
    `Map<String,Cookie>` | `getCookies()` Get any cookies that accompanied the request.
    `Date` | `getDate()` Get message date.
    `String` | `getHeaderString(String name)` Get a HTTP header as a single string value.
    `Locale` | `getLanguage()` Get the language of the request entity.
    `int` | `getLength()` Get Content-Length value.
    `MediaType` | `getMediaType()` Get the media type of the request entity.
    `Map<String,Cookie>` | `getMutableCookies()`
    `MultivaluedMap<String,String>` | `getMutableHeaders()`
    `List<String>` | `getRequestHeader(String name)` Get the values of a HTTP request header.
    `MultivaluedMap<String,String>` | `getRequestHeaders()` Get the values of HTTP request headers.
    `void` | `setCookies(Map<String,Cookie> cookies)`
    `void` | `testParsing()`

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

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

- - ### Constructor Detail

    - #### ResteasyHttpHeaders

          public ResteasyHttpHeaders(MultivaluedMap<String,String> requestHeaders)

    - #### ResteasyHttpHeaders

          public ResteasyHttpHeaders(MultivaluedMap<String,String> requestHeaders,
                             Map<String,Cookie> cookies)

  - ### Method Detail

    - #### getRequestHeaders

          public MultivaluedMap<String,String> getRequestHeaders()

      Description copied from interface: `HttpHeaders`
      Get the values of HTTP request headers. The returned Map is case-insensitive wrt. keys and is read-only. The method never returns `null`.
      Specified by:
        `getRequestHeaders` in interface `HttpHeaders`
      Returns:
        a read-only map of header names and values.

    - #### getMutableHeaders

          public MultivaluedMap<String,String> getMutableHeaders()

    - #### testParsing

          public void testParsing()

    - #### getRequestHeader

          public List<String> getRequestHeader(String name)

      Description copied from interface: `HttpHeaders`
      Get the values of a HTTP request header. The returned List is read-only. This is a shortcut for `getRequestHeaders().get(name)`.
      Specified by:
        `getRequestHeader` in interface `HttpHeaders`
      Parameters:
        `name` - the header name, case insensitive.
      Returns:
        a read-only list of header values.

    - #### getCookies

          public Map<String,Cookie> getCookies()

      Description copied from interface: `HttpHeaders`
      Get any cookies that accompanied the request.
      Specified by:
        `getCookies` in interface `HttpHeaders`
      Returns:
        a read-only map of cookie name (String) to Cookie.

    - #### getMutableCookies

          public Map<String,Cookie> getMutableCookies()

    - #### setCookies

          public void setCookies(Map<String,Cookie> cookies)

    - #### getDate

          public Date getDate()

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

    - #### getHeaderString

          public String getHeaderString(String name)

      Description copied from interface: `HttpHeaders`
      Get a HTTP header as a single string value.

      Each single header value is converted to String using a `RuntimeDelegate.HeaderDelegate` if one is available via `RuntimeDelegate.createHeaderDelegate(java.lang.Class)` for the header value class or using its `toString` method if a header delegate is not available.
      Specified by:
        `getHeaderString` in interface `HttpHeaders`
      Parameters:
        `name` - the HTTP header.
      Returns:
        the HTTP header value. If the HTTP header is not present then `null` is returned. If the HTTP header is present but has no value then the empty string is returned. If the HTTP header is present more than once then the values of joined together and separated by a ',' character.
      See Also:
        `HttpHeaders.getRequestHeader(java.lang.String)`

    - #### getLanguage

          public Locale getLanguage()

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

    - #### getLength

          public int getLength()

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

    - #### getMediaType

          public MediaType getMediaType()

      Description copied from interface: `HttpHeaders`
      Get the media type of the request entity.
      Specified by:
        `getMediaType` in interface `HttpHeaders`
      Returns:
        the media type or `null` if there is no request entity.

    - #### getAcceptableMediaTypes

          public List<MediaType> getAcceptableMediaTypes()

      Description copied from interface: `HttpHeaders`
      Get a list of media types that are acceptable for the response.

      If no acceptable media types are specified, a read-only list containing a single `wildcard media type` instance is returned.
      Specified by:
        `getAcceptableMediaTypes` in interface `HttpHeaders`
      Returns:
        a read-only list of requested response media types sorted according to their q-value, with highest preference first.

    - #### getAcceptableLanguages

          public List<Locale> getAcceptableLanguages()

      Description copied from interface: `HttpHeaders`
      Get a list of languages that are acceptable for the response.

      If no acceptable languages are specified, a read-only list containing a single wildcard `Locale` instance (with language field set to "`*`") is returned.
      Specified by:
        `getAcceptableLanguages` in interface `HttpHeaders`
      Returns:
        a read-only list of acceptable languages sorted according to their q-value, with highest preference first.

Copyright © 2014. All Rights Reserved.