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:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • name

      private final String name
    • sensitive

      private final boolean sensitive
    • value

      private final String value
  • Constructor Details

    • 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 Details

    • 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