org.apache.hc.core5.http.message

## Class BasicHeader

- java.lang.Object
- - org.apache.hc.core5.http.message.BasicHeader

- All Implemented Interfaces:
    Serializable, Cloneable, Header, NameValuePair

      @Contract(threading=IMMUTABLE)
      public class BasicHeader
      extends Object
      implements Header, Cloneable, Serializable

  Immutable `Header`.
  Since:
    4.0
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicHeader(String name, Object value)` Default constructor
    `BasicHeader(String name, Object value, boolean sensitive)` Constructor with sensitivity flag

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `BasicHeader` | `clone()`
    `String` | `getName()` Gets the name of this pair.
    `String` | `getValue()` Gets the value of this pair.
    `boolean` | `isSensitive()` Returns `true` if the header should be considered sensitive.
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### BasicHeader

          public BasicHeader(String name,
                             Object value)

      Default constructor
      Parameters:
        `name` - the header name
        `value` - the header value, taken as the value's `toString()`.

    - #### BasicHeader

          public BasicHeader(String name,
                             Object value,
                             boolean sensitive)

      Constructor with sensitivity flag
      Parameters:
        `name` - the header name
        `value` - the header value, taken as the value's `toString()`.
        `sensitive` - sensitive flag
      Since:
        5.0

  - ### Method Detail

    - #### getName

          public String getName()

      Description copied from interface: `NameValuePair`
      Gets the name of this pair.
      Specified by:
        `getName` in interface `NameValuePair`
      Returns:
        the name of this pair, never `null`.

    - #### getValue

          public String getValue()

      Description copied from interface: `NameValuePair`
      Gets the value of this pair.
      Specified by:
        `getValue` in interface `NameValuePair`
      Returns:
        the value of this pair, may be `null`.

    - #### isSensitive

          public boolean isSensitive()

      Description copied from interface: `Header`
      Returns `true` if the header should be considered sensitive.

      Some encoding schemes such as HPACK impose restrictions on encoded representation of sensitive headers.

      Specified by:
        `isSensitive` in interface `Header`
      Returns:
        `true` if the header should be considered sensitive.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### clone

          public BasicHeader clone()
                            throws CloneNotSupportedException

      Overrides:
        `clone` in class `Object`
      Throws:
        `CloneNotSupportedException`

Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.