Class HTTPHeaders

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class HTTPHeaders
    extends Inventor
    implements java.lang.Cloneable
    This class represents the header configuration options for an HTTP request and response. Note that HTTPHeaders treats header names in a case-insensitive manner.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(java.lang.String name, java.lang.String value)
      Adds the given header value under the given name.
      void clear()
      Removes all headers.
      java.lang.Object clone()  
      long count()
      Gets the number of HTTP headers.
      boolean exists​(java.lang.String name)
      Determines if the headers collection contains a header of the specified name, with any value.
      java.lang.String getNameAt​(long index)
      Retrieves the header name from a collection index.
      java.lang.String getValue​(java.lang.String name)
      Retrieves the value of a given header.
      void remove​(java.lang.String name)
      Removes the header value under the given name.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HTTPHeaders

        public HTTPHeaders​(HTTPHeaders obj)
        Copy constructor.
      • HTTPHeaders

        public HTTPHeaders()
        Creates an empty object.
    • Method Detail

      • clone

        public java.lang.Object clone()
      • getNameAt

        public java.lang.String getNameAt​(long index)
        Retrieves the header name from a collection index.

        Parameters:
        index - index of the header to retrieve

        Returns:
        the header name at the given index or an empty string if the given index does not exist.

      • remove

        public void remove​(java.lang.String name)
        Removes the header value under the given name.

        Parameters:
        name - the name of the header to remove from the collection.
      • getValue

        public java.lang.String getValue​(java.lang.String name)
        Retrieves the value of a given header.

        Parameters:
        name - the name of the header to check

        Returns:
        the value of the given header name or an empty string if the given header does not exist.

      • add

        public void add​(java.lang.String name,
                        java.lang.String value)
        Adds the given header value under the given name. If a header already exists with the given name, its value will be overwritten.

        Parameters:
        name - the header to add to the collection.

        value - the content of the header.
      • clear

        public void clear()
        Removes all headers.
      • exists

        public boolean exists​(java.lang.String name)
        Determines if the headers collection contains a header of the specified name, with any value. param name the name of the header to check

        Returns:
        true if the given header exists.

      • count

        public long count()
        Gets the number of HTTP headers.

        Returns:
        number of HTTP headers.