Class EmptyHttpHeaders

java.lang.Object
io.netty.handler.codec.http.HttpHeaders
io.netty.handler.codec.http.EmptyHttpHeaders
All Implemented Interfaces:
java.lang.Iterable<java.util.Map.Entry<java.lang.String, java.lang.String>>

public class EmptyHttpHeaders extends HttpHeaders
  • Field Details

    • EMPTY_CHARS_ITERATOR

      static final java.util.Iterator<java.util.Map.Entry<java.lang.CharSequence, java.lang.CharSequence>> EMPTY_CHARS_ITERATOR
    • INSTANCE

      public static final EmptyHttpHeaders INSTANCE
  • Constructor Details

    • EmptyHttpHeaders

      protected EmptyHttpHeaders()
  • Method Details

    • instance

      @Deprecated static EmptyHttpHeaders instance()
      Deprecated.
      Use INSTANCE

      This is needed to break a cyclic static initialization loop between HttpHeaders and EmptyHttpHeaders.

      See Also:
    • get

      public java.lang.String get(java.lang.String name)
      Specified by:
      get in class HttpHeaders
      See Also:
    • getInt

      public java.lang.Integer getInt(java.lang.CharSequence name)
      Description copied from class: HttpHeaders
      Returns the integer 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:
      getInt in class HttpHeaders
      Parameters:
      name - the name of the header to search
      Returns:
      the first header value if the header is found and its value is an integer. null if there's no such header or its value is not an integer.
    • getInt

      public int getInt(java.lang.CharSequence name, int defaultValue)
      Description copied from class: HttpHeaders
      Returns the integer 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:
      getInt in class HttpHeaders
      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the first header value if the header is found and its value is an integer. defaultValue if there's no such header or its value is not an integer.
    • getShort

      public java.lang.Short getShort(java.lang.CharSequence name)
      Description copied from class: HttpHeaders
      Returns the short 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:
      getShort in class HttpHeaders
      Parameters:
      name - the name of the header to search
      Returns:
      the first header value if the header is found and its value is a short. null if there's no such header or its value is not a short.
    • getShort

      public short getShort(java.lang.CharSequence name, short defaultValue)
      Description copied from class: HttpHeaders
      Returns the short 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:
      getShort in class HttpHeaders
      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the first header value if the header is found and its value is a short. defaultValue if there's no such header or its value is not a short.
    • getTimeMillis

      public java.lang.Long getTimeMillis(java.lang.CharSequence name)
      Description copied from class: HttpHeaders
      Returns the date 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:
      getTimeMillis in class HttpHeaders
      Parameters:
      name - the name of the header to search
      Returns:
      the first header value if the header is found and its value is a date. null if there's no such header or its value is not a date.
    • getTimeMillis

      public long getTimeMillis(java.lang.CharSequence name, long defaultValue)
      Description copied from class: HttpHeaders
      Returns the date 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:
      getTimeMillis in class HttpHeaders
      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the first header value if the header is found and its value is a date. defaultValue if there's no such header or its value is not a date.
    • getAll

      public java.util.List<java.lang.String> getAll(java.lang.String name)
      Specified by:
      getAll in class HttpHeaders
      See Also:
    • entries

      public java.util.List<java.util.Map.Entry<java.lang.String, java.lang.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 HttpHeaders.iterator() instead, which has much less overhead.
      Specified by:
      entries in class HttpHeaders
      See Also:
    • contains

      public boolean contains(java.lang.String name)
      Specified by:
      contains in class HttpHeaders
      See Also:
    • isEmpty

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

      public int size()
      Description copied from class: HttpHeaders
      Returns the number of headers in this object.
      Specified by:
      size in class HttpHeaders
    • names

      public java.util.Set<java.lang.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 HttpHeaders.iterator() instead, which has much less overhead.
      Specified by:
      names in class HttpHeaders
    • add

      public HttpHeaders add(java.lang.String name, java.lang.Object value)
      Specified by:
      add in class HttpHeaders
      See Also:
    • add

      public HttpHeaders add(java.lang.String name, java.lang.Iterable<?> values)
      Specified by:
      add in class HttpHeaders
      See Also:
    • addInt

      public HttpHeaders addInt(java.lang.CharSequence name, int value)
      Description copied from class: HttpHeaders
      Add the name to value.
      Specified by:
      addInt in class HttpHeaders
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • addShort

      public HttpHeaders addShort(java.lang.CharSequence name, short value)
      Description copied from class: HttpHeaders
      Add the name to value.
      Specified by:
      addShort in class HttpHeaders
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • set

      public HttpHeaders set(java.lang.String name, java.lang.Object value)
      Specified by:
      set in class HttpHeaders
      See Also:
    • set

      public HttpHeaders set(java.lang.String name, java.lang.Iterable<?> values)
      Specified by:
      set in class HttpHeaders
      See Also:
    • setInt

      public HttpHeaders setInt(java.lang.CharSequence name, int value)
      Description copied from class: HttpHeaders
      Set the name to value. This will remove all previous values associated with name.
      Specified by:
      setInt in class HttpHeaders
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setShort

      public HttpHeaders setShort(java.lang.CharSequence name, short value)
      Description copied from class: HttpHeaders
      Set the name to value. This will remove all previous values associated with name.
      Specified by:
      setShort in class HttpHeaders
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • remove

      public HttpHeaders remove(java.lang.String name)
      Specified by:
      remove in class HttpHeaders
      See Also:
    • clear

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

      public java.util.Iterator<java.util.Map.Entry<java.lang.String, java.lang.String>> iterator()
      Specified by:
      iterator in interface java.lang.Iterable<java.util.Map.Entry<java.lang.String, java.lang.String>>
      Specified by:
      iterator in class HttpHeaders
    • iteratorCharSequence

      public java.util.Iterator<java.util.Map.Entry<java.lang.CharSequence, java.lang.CharSequence>> iteratorCharSequence()
      Specified by:
      iteratorCharSequence in class HttpHeaders
      Returns:
      Iterator over the name/value header pairs.