Interface Http.HeaderName

Enclosing class:
Http

public static sealed interface Http.HeaderName
HTTP header name.
  • Method Summary

    Modifier and Type
    Method
    Description
    Header name as used in HTTP/1, or "human-readable" value of this header.
    default int
    Index of this header (if one of the known indexed headers), or -1 if this is a custom header name.
    default boolean
    Http2 defines pseudoheaders as headers starting with a : character.
    Lowercase value of this header, used by HTTP/2, may be used for lookup by HTTP/1.
    withValue(boolean changing, boolean sensitive, String value)
    Create a new header with this name and the provided value.
    withValue(boolean changing, boolean sensitive, String... value)
    Create a new header with this name and the provided value.
    withValue(int value)
    Create a new header with this name and the provided value.
    Create a new header with this name and the provided value.
    withValue(String... value)
    Create a new header with this name and the provided value.
  • Method Details

    • lowerCase

      String lowerCase()
      Lowercase value of this header, used by HTTP/2, may be used for lookup by HTTP/1. There is no validation of this value, so if this contains an upper-case letter, behavior is undefined.
      Returns:
      name of the header, lowercase
    • defaultCase

      String defaultCase()
      Header name as used in HTTP/1, or "human-readable" value of this header.
      Returns:
      name of the header, may use uppercase and/or lowercase
    • index

      default int index()
      Index of this header (if one of the known indexed headers), or -1 if this is a custom header name.
      Returns:
      index of this header
    • isPseudoHeader

      default boolean isPseudoHeader()
      Http2 defines pseudoheaders as headers starting with a : character. These are used instead of the prologue line from HTTP/1 (to define path, authority etc.) and instead of status line in response.
      Returns:
      whether this header is a pseudo-header
    • withValue

      default Http.HeaderValue withValue(String value)
      Create a new header with this name and the provided value. The header is considered not sensitive and not changing.
      Parameters:
      value - value of the header
      Returns:
      a new cached HTTP header
      See Also:
    • withValue

      default Http.HeaderValue withValue(int value)
      Create a new header with this name and the provided value. The header is considered not sensitive and not changing.
      Parameters:
      value - value of the header
      Returns:
      a new cached HTTP header
    • withValue

      default Http.HeaderValue withValue(String... value)
      Create a new header with this name and the provided value. The header is considered not sensitive and not changing.
      Parameters:
      value - value(s) of the header
      Returns:
      a new HTTP header
      See Also:
    • withValue

      default Http.HeaderValue withValue(boolean changing, boolean sensitive, String value)
      Create a new header with this name and the provided value.
      Parameters:
      changing - is this a header that changes value often (e.g. with every request); important for HTTP/2, where changing headers do not cache values
      sensitive - is this a sensitive header, where we should not cache the value ever (such as security token)
      value - value of the header
      Returns:
      a new cached HTTP header
    • withValue

      default Http.HeaderValue withValue(boolean changing, boolean sensitive, String... value)
      Create a new header with this name and the provided value.
      Parameters:
      changing - is this a header that changes value often (e.g. with every request); important for HTTP/2, where changing headers do not cache values
      sensitive - is this a sensitive header, where we should not cache the value ever (such as security token)
      value - value(s) of the header
      Returns:
      a new HTTP header