Class HttpHeader


  • public class HttpHeader
    extends Object
    A single header within a HTTP request or response. If multiple header values are added to a HTTP request or response with the same name (case-insensitive), then the values will be appended to the end of the same Header with commas separating them.
    • Constructor Detail

      • HttpHeader

        public HttpHeader​(String name,
                          String value)
        Create a HttpHeader instance using the provided name and value.
        Parameters:
        name - the name
        value - the value
    • Method Detail

      • name

        public String name()
        Get the header name.
        Returns:
        the name of this Header
      • value

        public String value()
        Get the header value.
        Returns:
        the value of this Header
      • values

        public String[] values()
        Get the comma separated value as an array.
        Returns:
        the values of this Header that are separated by a comma
      • addValue

        public void addValue​(String value)
        Add a new value to the end of the Header.
        Parameters:
        value - the value to add
      • toString

        public String toString()
        Get the String representation of the header.
        Overrides:
        toString in class Object
        Returns:
        the String representation of this HttpHeader