Class DefaultHttpHeaders

java.lang.Object
org.jboss.netty.handler.codec.http.HttpHeaders
org.jboss.netty.handler.codec.http.DefaultHttpHeaders
All Implemented Interfaces:
Iterable<Map.Entry<String,String>>
Direct Known Subclasses:
DefaultHttpChunkTrailer.TrailingHeaders

public class DefaultHttpHeaders extends HttpHeaders
  • Field Details

  • Constructor Details

    • DefaultHttpHeaders

      public DefaultHttpHeaders()
    • DefaultHttpHeaders

      public DefaultHttpHeaders(boolean validate)
  • Method Details

    • createSet

      private static Set<String> createSet(Class<?> clazz)
    • hash

      private static int hash(String name, boolean validate)
    • eq

      private static boolean eq(String name1, String name2)
    • toLowerCase

      private static char toLowerCase(char c)
    • index

      private static int index(int hash)
    • validateHeaderValue0

      void validateHeaderValue0(String headerValue)
    • add

      public HttpHeaders add(String name, Object value)
      Description copied from class: HttpHeaders
      Adds a new header with the specified name and value. If the specified value is not a String, it is converted into a String by Object.toString(), except in the cases of Date and Calendar, which are formatted to the date format defined in RFC2616.
      Specified by:
      add in class HttpHeaders
      Parameters:
      name - The name of the header being added
      value - The value of the header being added
      Returns:
      this
    • add

      public HttpHeaders add(String name, Iterable<?> values)
      Description copied from class: HttpHeaders
      Adds a new header with the specified name and values. This getMethod can be represented approximately as the following code:
       for (Object v: values) {
           if (v == null) {
               break;
           }
           headers.add(name, v);
       }
       
      Specified by:
      add in class HttpHeaders
      Parameters:
      name - The name of the headers being set
      values - The values of the headers being set
      Returns:
      this
    • add0

      private void add0(int h, int i, String name, String value)
    • remove

      public HttpHeaders remove(String name)
      Description copied from class: HttpHeaders
      Removes the header with the specified name.
      Specified by:
      remove in class HttpHeaders
      Parameters:
      name - The name of the header to remove
      Returns:
      this
    • remove0

      private void remove0(int h, int i, String name)
    • set

      public HttpHeaders set(String name, Object value)
      Description copied from class: HttpHeaders
      Sets a header with the specified name and value. If there is an existing header with the same name, it is removed. If the specified value is not a String, it is converted into a String by Object.toString(), except for Date and Calendar, which are formatted to the date format defined in RFC2616.
      Specified by:
      set in class HttpHeaders
      Parameters:
      name - The name of the header being set
      value - The value of the header being set
      Returns:
      this
    • set

      public HttpHeaders set(String name, Iterable<?> values)
      Description copied from class: HttpHeaders
      Sets a header with the specified name and values. If there is an existing header with the same name, it is removed. This getMethod can be represented approximately as the following code:
       headers.remove(name);
       for (Object v: values) {
           if (v == null) {
               break;
           }
           headers.add(name, v);
       }
       
      Specified by:
      set in class HttpHeaders
      Parameters:
      name - The name of the headers being set
      values - The values of the headers being set
      Returns:
      this
    • clear

      public HttpHeaders clear()
      Description copied from class: HttpHeaders
      Removes all headers from this HttpMessage.
      Specified by:
      clear in class HttpHeaders
      Returns:
      this
    • get

      public String get(String name)
      Description copied from class: HttpHeaders
      Returns the value of a header with the specified name. If there are more than one values for the specified name, the first value is returned.
      Specified by:
      get in class HttpHeaders
      Parameters:
      name - The name of the header to search
      Returns:
      The first header value or null if there is no such header
    • get

      private String get(String name, boolean last)
    • getAll

      public List<String> getAll(String name)
      Description copied from class: HttpHeaders
      Returns the values of headers with the specified name
      Specified by:
      getAll in class HttpHeaders
      Parameters:
      name - The name of the headers to search
      Returns:
      A List of header values which will be empty if no values are found
    • entries

      public List<Map.Entry<String,String>> entries()
      Description copied from class: HttpHeaders
      Returns a new List that contains all headers in this object. Note that modifying the returned List will not affect the state of this object. If you intend to enumerate over the header entries only, use Iterable.iterator() instead, which has much less overhead.
      Specified by:
      entries in class HttpHeaders
    • iterator

      public Iterator<Map.Entry<String,String>> iterator()
    • contains

      public boolean contains(String name)
      Description copied from class: HttpHeaders
      Checks to see if there is a header with the specified name
      Specified by:
      contains in class HttpHeaders
      Parameters:
      name - The name of the header to search for
      Returns:
      True if at least one header is found
    • isEmpty

      public boolean isEmpty()
      Description copied from class: HttpHeaders
      Checks if no header exists.
      Specified by:
      isEmpty in class HttpHeaders
    • contains

      public boolean contains(String name, String value, boolean ignoreCaseValue)
      Description copied from class: HttpHeaders
      Returns true if a header with the name and value exists.
      Overrides:
      contains in class HttpHeaders
      Parameters:
      name - the headername
      value - the value
      ignoreCaseValue - true if case should be ignored
      Returns:
      contains true if it contains it false otherwise
    • names

      public Set<String> names()
      Description copied from class: HttpHeaders
      Returns a new Set that contains the names of all headers in this object. Note that modifying the returned Set will not affect the state of this object. If you intend to enumerate over the header entries only, use Iterable.iterator() instead, which has much less overhead.
      Specified by:
      names in class HttpHeaders
    • toString

      private static String toString(Object value)