com.holonplatform.http

## Interface HttpHeaders

- All Superinterfaces:
    MessageHeaders<List<String>>
  All Known Subinterfaces:
    HttpMessage<P>, HttpRequest, HttpResponse<T>, ResponseEntity<T>, ServletHttpRequest
  All Known Implementing Classes:
    AbstractHttpRequest, DefaultHttpResponse

      public interface HttpHeaders
      extends MessageHeaders<List<String>>

  HTTP headers representation.
  Since:
    5.0.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `ACCEPT` The HTTP `Accept` header field name.
    `static String` | `ACCEPT_CHARSET` The HTTP `Accept-Charset` header field name.
    `static String` | `ACCEPT_ENCODING` The HTTP `Accept-Encoding` header field name.
    `static String` | `ACCEPT_LANGUAGE` The HTTP `Accept-Language` header field name.
    `static String` | `ACCEPT_RANGES` The HTTP `Accept-Ranges` header field name.
    `static String` | `AGE` The HTTP `Age` header field name.
    `static String` | `ALLOW` The HTTP `Allow` header field name.
    `static String` | `AUTHORIZATION` The HTTP `Authorization` header field name.
    `static String` | `CACHE_CONTROL` The HTTP `Cache-Control` header field name.
    `static String` | `CONNECTION` The HTTP `Connection` header field name.
    `static String` | `CONTENT_DISPOSITION` The HTTP `Content-Disposition` header field name
    `static String` | `CONTENT_ENCODING` The HTTP `Content-Encoding` header field name.
    `static String` | `CONTENT_LANGUAGE` The HTTP `Content-Language` header field name.
    `static String` | `CONTENT_LENGTH` The HTTP `Content-Length` header field name.
    `static String` | `CONTENT_LOCATION` The HTTP `Content-Location` header field name.
    `static String` | `CONTENT_RANGE` The HTTP `Content-Range` header field name.
    `static String` | `CONTENT_TYPE` The HTTP `Content-Type` header field name.
    `static String` | `COOKIE` The HTTP `Cookie` header field name.
    `static String` | `DATE` The HTTP `Date` header field name.
    `static String` | `ETAG` The HTTP `ETag` header field name.
    `static String` | `EXPECT` The HTTP `Expect` header field name.
    `static String` | `EXPIRES` The HTTP `Expires` header field name.
    `static String` | `FROM` The HTTP `From` header field name.
    `static String` | `HOST` The HTTP `Host` header field name.
    `static String` | `IF_MATCH` The HTTP `If-Match` header field name.
    `static String` | `IF_MODIFIED_SINCE` The HTTP `If-Modified-Since` header field name.
    `static String` | `IF_NONE_MATCH` The HTTP `If-None-Match` header field name.
    `static String` | `IF_RANGE` The HTTP `If-Range` header field name.
    `static String` | `IF_UNMODIFIED_SINCE` The HTTP `If-Unmodified-Since` header field name.
    `static String` | `LAST_MODIFIED` The HTTP `Last-Modified` header field name.
    `static String` | `LINK` The HTTP `Link` header field name.
    `static String` | `LOCATION` The HTTP `Location` header field name.
    `static String` | `MAX_FORWARDS` The HTTP `Max-Forwards` header field name.
    `static String` | `ORIGIN` The HTTP `Origin` header field name.
    `static String` | `PRAGMA` The HTTP `Pragma` header field name.
    `static String` | `PROXY_AUTHENTICATE` The HTTP `Proxy-Authenticate` header field name.
    `static String` | `PROXY_AUTHORIZATION` The HTTP `Proxy-Authorization` header field name.
    `static String` | `RANGE` The HTTP `Range` header field name.
    `static String` | `REFERER` The HTTP `Referer` header field name.
    `static String` | `RETRY_AFTER` The HTTP `Retry-After` header field name.
    `static String` | `SCHEME_BASIC` Basic authentication scheme
    `static String` | `SCHEME_BEARER` Bearer authentication scheme
    `static String` | `SCHEME_DIGEST` Digest authentication scheme
    `static String` | `SERVER` The HTTP `Server` header field name.
    `static String` | `SET_COOKIE` The HTTP `Set-Cookie` header field name.
    `static String` | `TRAILER` The HTTP `Trailer` header field name.
    `static String` | `TRANSFER_ENCODING` The HTTP `Transfer-Encoding` header field name.
    `static String` | `UPGRADE` The HTTP `Upgrade` header field name.
    `static String` | `USER_AGENT` The HTTP `User-Agent` header field name.
    `static String` | `VARY` The HTTP `Vary` header field name.
    `static String` | `VIA` The HTTP `Via` header field name.
    `static String` | `WARNING` The HTTP `Warning` header field name.
    `static String` | `WWW_AUTHENTICATE` The HTTP `WWW-Authenticate` header field name.

  - ### Method Summary

    All Methods Instance Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default Optional<String[]>` | `getAuthorizationBasicCredentials()` Return the basic authorization credential values from the `AUTHORIZATION` header, if present and of scheme type `SCHEME_BASIC`.
    `default Optional<String>` | `getAuthorizationBearer()` Return the authorization bearer token from the `AUTHORIZATION` header, if present and of scheme type `SCHEME_BEARER`.
    `default Optional<Long>` | `getContentLength()` Return the length of the request body in bytes, as specified by the `CONTENT_LENGTH` header.
    `default Optional<Date>` | `getDate()` Return the date and time at which the message was created, as specified by the `DATE` header.
    `default Optional<String>` | `getHeaderValue(String name)` Get a HTTP header as a single string value.
    `default Optional<Locale>` | `getLocale()` Get the first (most qualified) `Locale` using the `ACCEPT_LANGUAGE` header, if present.
    `default List<Locale>` | `getLocales()` Try to get a list of `Locale` using the `ACCEPT_LANGUAGE` header, if present.
    `default Optional<URI>` | `getLocation()` Return the resource location as specified by the `LOCATION` header.

    - ### Methods inherited from interface com.holonplatform.core.messaging.MessageHeaders

      `getHeader, getHeaders`

- - ### Field Detail

    - #### ACCEPT

          static final String ACCEPT

      The HTTP `Accept` header field name.
      See Also:
        Section 5.3.2 of RFC 7231, Constant Field Values

    - #### ACCEPT_CHARSET

          static final String ACCEPT_CHARSET

      The HTTP `Accept-Charset` header field name.
      See Also:
        Section 5.3.3 of RFC 7231, Constant Field Values

    - #### ACCEPT_ENCODING

          static final String ACCEPT_ENCODING

      The HTTP `Accept-Encoding` header field name.
      See Also:
        Section 5.3.4 of RFC 7231, Constant Field Values

    - #### ACCEPT_LANGUAGE

          static final String ACCEPT_LANGUAGE

      The HTTP `Accept-Language` header field name.
      See Also:
        Section 5.3.5 of RFC 7231, Constant Field Values

    - #### ACCEPT_RANGES

          static final String ACCEPT_RANGES

      The HTTP `Accept-Ranges` header field name.
      See Also:
        Section 5.3.5 of RFC 7233, Constant Field Values

    - #### AGE

          static final String AGE

      The HTTP `Age` header field name.
      See Also:
        Section 5.1 of RFC 7234, Constant Field Values

    - #### ALLOW

          static final String ALLOW

      The HTTP `Allow` header field name.
      See Also:
        Section 7.4.1 of RFC 7231, Constant Field Values

    - #### AUTHORIZATION

          static final String AUTHORIZATION

      The HTTP `Authorization` header field name.
      See Also:
        Section 4.2 of RFC 7235, Constant Field Values

    - #### CACHE_CONTROL

          static final String CACHE_CONTROL

      The HTTP `Cache-Control` header field name.
      See Also:
        Section 5.2 of RFC 7234, Constant Field Values

    - #### CONNECTION

          static final String CONNECTION

      The HTTP `Connection` header field name.
      See Also:
        Section 6.1 of RFC 7230, Constant Field Values

    - #### CONTENT_ENCODING

          static final String CONTENT_ENCODING

      The HTTP `Content-Encoding` header field name.
      See Also:
        Section 3.1.2.2 of RFC 7231, Constant Field Values

    - #### CONTENT_DISPOSITION

          static final String CONTENT_DISPOSITION

      The HTTP `Content-Disposition` header field name
      See Also:
        RFC 6266, Constant Field Values

    - #### CONTENT_LANGUAGE

          static final String CONTENT_LANGUAGE

      The HTTP `Content-Language` header field name.
      See Also:
        Section 3.1.3.2 of RFC 7231, Constant Field Values

    - #### CONTENT_LENGTH

          static final String CONTENT_LENGTH

      The HTTP `Content-Length` header field name.
      See Also:
        Section 3.3.2 of RFC 7230, Constant Field Values

    - #### CONTENT_LOCATION

          static final String CONTENT_LOCATION

      The HTTP `Content-Location` header field name.
      See Also:
        Section 3.1.4.2 of RFC 7231, Constant Field Values

    - #### CONTENT_RANGE

          static final String CONTENT_RANGE

      The HTTP `Content-Range` header field name.
      See Also:
        Section 4.2 of RFC 7233, Constant Field Values

    - #### CONTENT_TYPE

          static final String CONTENT_TYPE

      The HTTP `Content-Type` header field name.
      See Also:
        Section 3.1.1.5 of RFC 7231, Constant Field Values

    - #### COOKIE

          static final String COOKIE

      The HTTP `Cookie` header field name.
      See Also:
        Section 4.3.4 of RFC 2109, Constant Field Values

    - #### DATE

          static final String DATE

      The HTTP `Date` header field name.
      See Also:
        Section 7.1.1.2 of RFC 7231, Constant Field Values

    - #### ETAG

          static final String ETAG

      The HTTP `ETag` header field name.
      See Also:
        Section 2.3 of RFC 7232, Constant Field Values

    - #### EXPECT

          static final String EXPECT

      The HTTP `Expect` header field name.
      See Also:
        Section 5.1.1 of RFC 7231, Constant Field Values

    - #### EXPIRES

          static final String EXPIRES

      The HTTP `Expires` header field name.
      See Also:
        Section 5.3 of RFC 7234, Constant Field Values

    - #### FROM

          static final String FROM

      The HTTP `From` header field name.
      See Also:
        Section 5.5.1 of RFC 7231, Constant Field Values

    - #### HOST

          static final String HOST

      The HTTP `Host` header field name.
      See Also:
        Section 5.4 of RFC 7230, Constant Field Values

    - #### IF_MATCH

          static final String IF_MATCH

      The HTTP `If-Match` header field name.
      See Also:
        Section 3.1 of RFC 7232, Constant Field Values

    - #### IF_MODIFIED_SINCE

          static final String IF_MODIFIED_SINCE

      The HTTP `If-Modified-Since` header field name.
      See Also:
        Section 3.3 of RFC 7232, Constant Field Values

    - #### IF_NONE_MATCH

          static final String IF_NONE_MATCH

      The HTTP `If-None-Match` header field name.
      See Also:
        Section 3.2 of RFC 7232, Constant Field Values

    - #### IF_RANGE

          static final String IF_RANGE

      The HTTP `If-Range` header field name.
      See Also:
        Section 3.2 of RFC 7233, Constant Field Values

    - #### IF_UNMODIFIED_SINCE

          static final String IF_UNMODIFIED_SINCE

      The HTTP `If-Unmodified-Since` header field name.
      See Also:
        Section 3.4 of RFC 7232, Constant Field Values

    - #### LAST_MODIFIED

          static final String LAST_MODIFIED

      The HTTP `Last-Modified` header field name.
      See Also:
        Section 2.2 of RFC 7232, Constant Field Values

    - #### LINK

          static final String LINK

      The HTTP `Link` header field name.
      See Also:
        RFC 5988, Constant Field Values

    - #### LOCATION

          static final String LOCATION

      The HTTP `Location` header field name.
      See Also:
        Section 7.1.2 of RFC 7231, Constant Field Values

    - #### MAX_FORWARDS

          static final String MAX_FORWARDS

      The HTTP `Max-Forwards` header field name.
      See Also:
        Section 5.1.2 of RFC 7231, Constant Field Values

    - #### ORIGIN

          static final String ORIGIN

      The HTTP `Origin` header field name.
      See Also:
        RFC 6454, Constant Field Values

    - #### PRAGMA

          static final String PRAGMA

      The HTTP `Pragma` header field name.
      See Also:
        Section 5.4 of RFC 7234, Constant Field Values

    - #### PROXY_AUTHENTICATE

          static final String PROXY_AUTHENTICATE

      The HTTP `Proxy-Authenticate` header field name.
      See Also:
        Section 4.3 of RFC 7235, Constant Field Values

    - #### PROXY_AUTHORIZATION

          static final String PROXY_AUTHORIZATION

      The HTTP `Proxy-Authorization` header field name.
      See Also:
        Section 4.4 of RFC 7235, Constant Field Values

    - #### RANGE

          static final String RANGE

      The HTTP `Range` header field name.
      See Also:
        Section 3.1 of RFC 7233, Constant Field Values

    - #### REFERER

          static final String REFERER

      The HTTP `Referer` header field name.
      See Also:
        Section 5.5.2 of RFC 7231, Constant Field Values

    - #### RETRY_AFTER

          static final String RETRY_AFTER

      The HTTP `Retry-After` header field name.
      See Also:
        Section 7.1.3 of RFC 7231, Constant Field Values

    - #### SERVER

          static final String SERVER

      The HTTP `Server` header field name.
      See Also:
        Section 7.4.2 of RFC 7231, Constant Field Values

    - #### SET_COOKIE

          static final String SET_COOKIE

      The HTTP `Set-Cookie` header field name.
      See Also:
        Section 4.2.2 of RFC 2109, Constant Field Values

    - #### TRAILER

          static final String TRAILER

      The HTTP `Trailer` header field name.
      See Also:
        Section 4.4 of RFC 7230, Constant Field Values

    - #### TRANSFER_ENCODING

          static final String TRANSFER_ENCODING

      The HTTP `Transfer-Encoding` header field name.
      See Also:
        Section 3.3.1 of RFC 7230, Constant Field Values

    - #### UPGRADE

          static final String UPGRADE

      The HTTP `Upgrade` header field name.
      See Also:
        Section 6.7 of RFC 7230, Constant Field Values

    - #### USER_AGENT

          static final String USER_AGENT

      The HTTP `User-Agent` header field name.
      See Also:
        Section 5.5.3 of RFC 7231, Constant Field Values

    - #### VARY

          static final String VARY

      The HTTP `Vary` header field name.
      See Also:
        Section 7.1.4 of RFC 7231, Constant Field Values

    - #### VIA

          static final String VIA

      The HTTP `Via` header field name.
      See Also:
        Section 5.7.1 of RFC 7230, Constant Field Values

    - #### WARNING

          static final String WARNING

      The HTTP `Warning` header field name.
      See Also:
        Section 5.5 of RFC 7234, Constant Field Values

    - #### WWW_AUTHENTICATE

          static final String WWW_AUTHENTICATE

      The HTTP `WWW-Authenticate` header field name.
      See Also:
        Section 4.1 of RFC 7235, Constant Field Values

    - #### SCHEME_BASIC

          static final String SCHEME_BASIC

      Basic authentication scheme
      See Also:
        Constant Field Values

    - #### SCHEME_BEARER

          static final String SCHEME_BEARER

      Bearer authentication scheme
      See Also:
        Constant Field Values

    - #### SCHEME_DIGEST

          static final String SCHEME_DIGEST

      Digest authentication scheme
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getHeaderValue

          default Optional<String> getHeaderValue(String name)

      Get a HTTP header as a single string value.
      Parameters:
        `name` - The header name (not null)
      Returns:
        The HTTP header value. If the HTTP header is present more than once then the values are joined together and separated by a ',' character.

    - #### getDate

          default Optional<Date> getDate()

      Return the date and time at which the message was created, as specified by the `DATE` header.
      Returns:
        Message date/time, if available

    - #### getContentLength

          default Optional<Long> getContentLength()

      Return the length of the request body in bytes, as specified by the `CONTENT_LENGTH` header.
      Returns:
        Content length in bytes, if available

    - #### getLocation

          default Optional<URI> getLocation()

      Return the resource location as specified by the `LOCATION` header.
      Returns:
        location URI, if available

    - #### getLocales

          default List<Locale> getLocales()

      Try to get a list of `Locale` using the `ACCEPT_LANGUAGE` header, if present. If more than one language is specified in the `Accept-Language` header, returned Locales will be ordered relying on quality parameter, if specified.
      Returns:
        List of Locale for the languages of the `Accept-Language` header, if any. If header is not present, an empty list is returned.

    - #### getLocale

          default Optional<Locale> getLocale()

      Get the first (most qualified) `Locale` using the `ACCEPT_LANGUAGE` header, if present.
      Returns:
        The first (most qualified) `Locale` using the `ACCEPT_LANGUAGE` header, if available

    - #### getAuthorizationBearer

          default Optional<String> getAuthorizationBearer()

      Return the authorization bearer token from the `AUTHORIZATION` header, if present and of scheme type `SCHEME_BEARER`.
      Returns:
        Authorization bearer token, if available

    - #### getAuthorizationBasicCredentials

          default Optional<String[]> getAuthorizationBasicCredentials()

      Return the basic authorization credential values from the `AUTHORIZATION` header, if present and of scheme type `SCHEME_BASIC`.

      The authorization credentials are decoded from Base64 before returning them to caller.

      Returns:
        Basic authorization credentials as an array which contains the username at index 0 and the password at index 1, if available

Copyright © 2019 The Holon Platform. All rights reserved.