Interface RequestHeadersBuilder

All Superinterfaces:
HttpHeadersBuilder, Iterable<Map.Entry<io.netty.util.AsciiString,String>>

public interface RequestHeadersBuilder extends HttpHeadersBuilder
Builds a RequestHeaders.
See Also:
  • Method Details

    • build

      Returns a newly created RequestHeaders with the entries in this builder.
      Specified by:
      build in interface HttpHeadersBuilder
      Throws:
      IllegalStateException - if this builder does not have ":method" and ":path" headers set.
    • method

      Sets the ":method" header.
    • path

      Sets the ":path" header.
    • scheme

      RequestHeadersBuilder scheme(String scheme)
      Sets the ":scheme" header.
    • scheme

      default RequestHeadersBuilder scheme(SessionProtocol sessionProtocol)
      Sets the ":scheme" header from the specified SessionProtocol.
    • authority

      RequestHeadersBuilder authority(String authority)
      Sets the ":authority" header.
    • authority

      default RequestHeadersBuilder authority(Endpoint endpoint)
      Sets the ":authority" header from the specified Endpoint.
      Throws:
      IllegalArgumentException - if the specified Endpoint refers to a group
    • acceptLanguages

      RequestHeadersBuilder acceptLanguages(Iterable<Locale.LanguageRange> acceptedLanguages)
      Sets the "accept-language" header.
      Parameters:
      acceptedLanguages - the accepted languages.
      Returns:
      this
    • acceptLanguages

      default RequestHeadersBuilder acceptLanguages(Locale.LanguageRange... acceptedLanguages)
      Sets the "accept-language" header.
      Parameters:
      acceptedLanguages - the accepted languages.
      Returns:
      this
    • cookie

      RequestHeadersBuilder cookie(Cookie cookie)
      Adds the cookie header.
    • cookies

      RequestHeadersBuilder cookies(Iterable<? extends Cookie> cookies)
      Adds the cookie header.
    • cookies

      RequestHeadersBuilder cookies(Cookie... cookies)
      Adds the cookie header.
    • accept

      RequestHeadersBuilder accept(MediaType... mediaTypes)
      Adds the Accept header.
    • accept

      Adds the Accept header.
    • sizeHint

      RequestHeadersBuilder sizeHint(int sizeHint)
      Description copied from interface: HttpHeadersBuilder
      Specifies the hint about the number of headers which may improve the memory efficiency and performance of the underlying data structure.
      Specified by:
      sizeHint in interface HttpHeadersBuilder
      Returns:
      this
    • endOfStream

      RequestHeadersBuilder endOfStream(boolean endOfStream)
      Description copied from interface: HttpHeadersBuilder
      Sets whether the headers will be the last frame in an HTTP/2 stream.
      Specified by:
      endOfStream in interface HttpHeadersBuilder
    • contentLength

      RequestHeadersBuilder contentLength(long contentLength)
      Description copied from interface: HttpHeadersBuilder
      Sets the content-length header.
      Specified by:
      contentLength in interface HttpHeadersBuilder
    • contentType

      RequestHeadersBuilder contentType(MediaType contentType)
      Description copied from interface: HttpHeadersBuilder
      Sets the "content-type" header.
      Specified by:
      contentType in interface HttpHeadersBuilder
    • contentLengthUnknown

      RequestHeadersBuilder contentLengthUnknown()
      Description copied from interface: HttpHeadersBuilder
      Sets whether the content-length is unknown. Thus, content-length header is not automatically updated.
      Specified by:
      contentLengthUnknown in interface HttpHeadersBuilder
    • contentDisposition

      RequestHeadersBuilder contentDisposition(ContentDisposition contentDisposition)
      Description copied from interface: HttpHeadersBuilder
      Sets the "content-disposition" header.
      Specified by:
      contentDisposition in interface HttpHeadersBuilder
    • add

      Description copied from interface: HttpHeadersBuilder
      Adds a new header with the specified name and value.
      Specified by:
      add in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      value - the header value
      Returns:
      this
    • add

      Description copied from interface: HttpHeadersBuilder
      Adds new headers with the specified name and values. This method is semantically equivalent to
      
       for (String value : values) {
           builder.add(name, value);
       }
       
      Specified by:
      add in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      values - the header values
      Returns:
      this
    • add

      RequestHeadersBuilder add(CharSequence name, String... values)
      Description copied from interface: HttpHeadersBuilder
      Adds new headers with the specified name and values. This method is semantically equivalent to
      
       for (String value : values) {
           builder.add(name, value);
       }
       
      Specified by:
      add in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      values - the header values
      Returns:
      this
    • add

      RequestHeadersBuilder add(Iterable<? extends Map.Entry<? extends CharSequence,String>> entries)
      Description copied from interface: HttpHeadersBuilder
      Adds all header names and values of the specified entries.
      Specified by:
      add in interface HttpHeadersBuilder
      Returns:
      this
    • add

      default RequestHeadersBuilder add(Map<? extends CharSequence,String> entries)
      Description copied from interface: HttpHeadersBuilder
      Adds all header names and values of the specified entries.
      Specified by:
      add in interface HttpHeadersBuilder
      Returns:
      this
    • addObject

      RequestHeadersBuilder addObject(CharSequence name, Object value)
      Description copied from interface: HttpHeadersBuilder
      Adds a new header. The specified header value is converted into a String, as explained in Specifying a non-String header value.
      Specified by:
      addObject in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      value - the header value
      Returns:
      this
    • addObject

      RequestHeadersBuilder addObject(CharSequence name, Iterable<?> values)
      Description copied from interface: HttpHeadersBuilder
      Adds a new header with the specified name and values. The specified header values are converted into Strings, as explained in Specifying a non-String header value. This method is equivalent to:
      
       for (Object v : values) {
           builder.addObject(name, v);
       }
       
      Specified by:
      addObject in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      values - the header values
      Returns:
      this
    • addObject

      RequestHeadersBuilder addObject(CharSequence name, Object... values)
      Description copied from interface: HttpHeadersBuilder
      Adds a new header with the specified name and values. The specified header values are converted into Strings, as explained in Specifying a non-String header value. This method is equivalent to:
      
       for (Object v : values) {
           builder.addObject(name, v);
       }
       
      Specified by:
      addObject in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      values - the header values
      Returns:
      this
    • addObject

      RequestHeadersBuilder addObject(Iterable<? extends Map.Entry<? extends CharSequence,?>> entries)
      Description copied from interface: HttpHeadersBuilder
      Adds all header names and values of the specified entries. The specified header values are converted into Strings, as explained in Specifying a non-String header value.
      Specified by:
      addObject in interface HttpHeadersBuilder
      Returns:
      this
    • addInt

      RequestHeadersBuilder addInt(CharSequence name, int value)
      Description copied from interface: HttpHeadersBuilder
      Adds a new header.
      Specified by:
      addInt in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      value - the header value
      Returns:
      this
    • addLong

      RequestHeadersBuilder addLong(CharSequence name, long value)
      Description copied from interface: HttpHeadersBuilder
      Adds a new header.
      Specified by:
      addLong in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      value - the header value
      Returns:
      this
    • addFloat

      RequestHeadersBuilder addFloat(CharSequence name, float value)
      Description copied from interface: HttpHeadersBuilder
      Adds a new header.
      Specified by:
      addFloat in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      value - the header value
      Returns:
      this
    • addDouble

      RequestHeadersBuilder addDouble(CharSequence name, double value)
      Description copied from interface: HttpHeadersBuilder
      Adds a new header.
      Specified by:
      addDouble in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      value - the header value
      Returns:
      this
    • addTimeMillis

      RequestHeadersBuilder addTimeMillis(CharSequence name, long value)
      Description copied from interface: HttpHeadersBuilder
      Adds a new header.
      Specified by:
      addTimeMillis in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      value - the header value
      Returns:
      this
    • set

      Description copied from interface: HttpHeadersBuilder
      Sets a header with the specified name and value. Any existing headers with the same name are overwritten.
      Specified by:
      set in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      value - the header value
      Returns:
      this
    • set

      Description copied from interface: HttpHeadersBuilder
      Sets a new header with the specified name and values. This method is equivalent to
      
       builder.remove(name);
       for (String v : values) {
           builder.add(name, v);
       }
       
      Specified by:
      set in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      values - the header values
      Returns:
      this
    • set

      RequestHeadersBuilder set(CharSequence name, String... values)
      Description copied from interface: HttpHeadersBuilder
      Sets a header with the specified name and values. Any existing headers with the specified name are removed. This method is equivalent to:
      
       builder.remove(name);
       for (String v : values) {
           builder.add(name, v);
       }
       
      Specified by:
      set in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      values - the header values
      Returns:
      this
    • set

      RequestHeadersBuilder set(Iterable<? extends Map.Entry<? extends CharSequence,String>> entries)
      Description copied from interface: HttpHeadersBuilder
      Retains all current headers but calls HttpHeadersBuilder.set(CharSequence, String) for each header in the specified entries.
      Specified by:
      set in interface HttpHeadersBuilder
      Parameters:
      entries - the headers used to set the header values
      Returns:
      this
    • set

      default RequestHeadersBuilder set(Map<? extends CharSequence,String> entries)
      Description copied from interface: HttpHeadersBuilder
      Retains all current headers but calls HttpHeadersBuilder.set(CharSequence, String) for each header in the specified entries.
      Specified by:
      set in interface HttpHeadersBuilder
      Parameters:
      entries - the headers used to set the header values
      Returns:
      this
    • setIfAbsent

      RequestHeadersBuilder setIfAbsent(Iterable<? extends Map.Entry<? extends CharSequence,String>> entries)
      Description copied from interface: HttpHeadersBuilder
      Copies the entries missing in this headers from the specified entries. This method is a shortcut for:
      
       headers.names().forEach(name -> {
           if (!builder.contains(name)) {
               builder.set(name, headers.getAll(name));
           }
       });
       
      Specified by:
      setIfAbsent in interface HttpHeadersBuilder
      Returns:
      this
    • setObject

      RequestHeadersBuilder setObject(CharSequence name, Object value)
      Description copied from interface: HttpHeadersBuilder
      Sets a new header. Any existing headers with the specified name are removed. The specified header value is converted into a String, as explained in Specifying a non-String header value.
      Specified by:
      setObject in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • setObject

      RequestHeadersBuilder setObject(CharSequence name, Iterable<?> values)
      Description copied from interface: HttpHeadersBuilder
      Sets a header with the specified name and values. Any existing headers with the specified name are removed. The specified header values are converted into Strings, as explained in Specifying a non-String header value. This method is equivalent to:
      
       builder.remove(name);
       for (Object v : values) {
           builder.addObject(name, v);
       }
       
      Specified by:
      setObject in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      values - the values of the header
      Returns:
      this
    • setObject

      RequestHeadersBuilder setObject(CharSequence name, Object... values)
      Description copied from interface: HttpHeadersBuilder
      Sets a header with the specified name and values. Any existing headers with the specified name are removed. The specified header values are converted into Strings, as explained in Specifying a non-String header value. This method is equivalent to:
      
       builder.remove(name);
       for (Object v : values) {
           builder.addObject(name, v);
       }
       
      Specified by:
      setObject in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      values - the values of the header
      Returns:
      this
    • setObject

      RequestHeadersBuilder setObject(Iterable<? extends Map.Entry<? extends CharSequence,?>> entries)
      Description copied from interface: HttpHeadersBuilder
      Retains all current headers but calls HttpHeadersBuilder.setObject(CharSequence, Object) for each entry in the specified entries. The specified header values are converted into Strings, as explained in Specifying a non-String header value.
      Specified by:
      setObject in interface HttpHeadersBuilder
      Parameters:
      entries - the headers used to set the values in this instance
      Returns:
      this
    • setInt

      RequestHeadersBuilder setInt(CharSequence name, int value)
      Description copied from interface: HttpHeadersBuilder
      Sets a header with the specified name to value. This will remove all previous values associated with name.
      Specified by:
      setInt in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      value - the header value
      Returns:
      this
    • setLong

      RequestHeadersBuilder setLong(CharSequence name, long value)
      Description copied from interface: HttpHeadersBuilder
      Sets a header with the specified name to value. This will remove all previous values associated with name.
      Specified by:
      setLong in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      value - the header value
      Returns:
      this
    • setFloat

      RequestHeadersBuilder setFloat(CharSequence name, float value)
      Description copied from interface: HttpHeadersBuilder
      Sets a header with the specified name to value. This will remove all previous values associated with name.
      Specified by:
      setFloat in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      value - the header value
      Returns:
      this
    • setDouble

      RequestHeadersBuilder setDouble(CharSequence name, double value)
      Description copied from interface: HttpHeadersBuilder
      Sets a header with the specified name to value. This will remove all previous values associated with name.
      Specified by:
      setDouble in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      value - the header value
      Returns:
      this
    • setTimeMillis

      RequestHeadersBuilder setTimeMillis(CharSequence name, long value)
      Description copied from interface: HttpHeadersBuilder
      Sets a header with the specified name to value. This will remove all previous values associated with name.
      Specified by:
      setTimeMillis in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      value - the header value
      Returns:
      this
    • removeAndThen

      RequestHeadersBuilder removeAndThen(CharSequence name)
      Description copied from interface: HttpHeadersBuilder
      Removes all headers with the specified name. Unlike HttpHeadersBuilder.remove(CharSequence) this method returns itself so that the caller can chain the invocations.
      Specified by:
      removeAndThen in interface HttpHeadersBuilder
      Parameters:
      name - the header name
      Returns:
      this
    • clear

      Description copied from interface: HttpHeadersBuilder
      Removes all headers. After a call to this method, size() becomes 0.
      Specified by:
      clear in interface HttpHeadersBuilder
      Returns:
      this
    • isEndOfStream

      boolean isEndOfStream()
      Tells whether the headers correspond to the last frame in an HTTP/2 stream.
    • contentLength

      long contentLength()
      Returns the value of the content-length header, or -1 if this value is not known.
    • isContentLengthUnknown

      @UnstableApi boolean isContentLengthUnknown()
      Returns whether the content length is unknown. If true, content-length header is not automatically updated.
    • contentType

      Returns the parsed "content-type" header.
      Returns:
      the parsed MediaType if present and valid, or null otherwise.
    • contentDisposition

      @Nullable @Nullable ContentDisposition contentDisposition()
      Returns the parsed "content-disposition" header.
      Returns:
      the parsed MediaType if present and valid. null if not present or failed to parse "content-disposition" header.
    • get

      Returns the value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the first header value if the header is found, or null if there's no such header
    • get

      String get(CharSequence name, String defaultValue)
      Returns the value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the first header value or defaultValue if there is no such header
    • getLast

      Returns the value of a header with the specified name. If there are more than one value for the specified name, the last value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the last header value if the header is found, or null if there's no such header
    • getLast

      String getLast(CharSequence name, String defaultValue)
      Returns the value of a header with the specified name. If there are more than one value for the specified name, the last value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the last header value or defaultValue if there is no such header
    • getAll

      List<String> getAll(CharSequence name)
      Returns all values for the header with the specified name. The returned List can't be modified.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      a List of header values or an empty List if there is no such header.
    • getBoolean

      Returns the boolean value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      true if the first value in insertion order is one of "true", "TRUE", "1". false if the first value in insertion order is one of "false", "FALSE", "0". null if there is no such header or it can't be converted to boolean.
    • getBoolean

      boolean getBoolean(CharSequence name, boolean defaultValue)
      Returns the boolean value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      true if the first value in insertion order is one of "true", "TRUE", "1". false if the first value in insertion order is one of "false", "FALSE", "0". defaultValue if there is no such header or it can't be converted to boolean.
    • getLastBoolean

      @Nullable @Nullable Boolean getLastBoolean(CharSequence name)
      Returns the boolean value of a header with the specified name. If there are more than one value for the specified name, the last value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      true if the last value in insertion order is one of "true", "TRUE", "1". false if the last value in insertion order is one of "false", "FALSE", "0". null if there is no such header or it can't be converted to boolean.
    • getLastBoolean

      boolean getLastBoolean(CharSequence name, boolean defaultValue)
      Returns the boolean value of a header with the specified name. If there are more than one value for the specified name, the last value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      true if the last value in insertion order is one of "true", "TRUE", "1". false if the last value in insertion order is one of "false", "FALSE", "0". defaultValue if there is no such header or it can't be converted to boolean.
    • getLastInt

      Returns the int value of a header with the specified name. If there are more than one value for the specified name, the last value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the int value of the last value in insertion order or null if there is no such header or it can't be converted to int.
    • getLastInt

      int getLastInt(CharSequence name, int defaultValue)
      Returns the int value of a header with the specified name. If there are more than one value for the specified name, the last value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the int value of the last value in insertion order or defaultValue if there is no such header or it can't be converted to int.
    • getInt

      Returns the int value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the int value of the first value in insertion order or null if there is no such header or it can't be converted to int.
    • getInt

      int getInt(CharSequence name, int defaultValue)
      Returns the int value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the int value of the first value in insertion order or defaultValue if there is no such header or it can't be converted to int.
    • getLong

      Returns the long value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the long value of the first value in insertion order or null if there is no such header or it can't be converted to long.
    • getLong

      long getLong(CharSequence name, long defaultValue)
      Returns the long value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the long value of the first value in insertion order or defaultValue if there is no such header or it can't be converted to long.
    • getLastLong

      @Nullable @Nullable Long getLastLong(CharSequence name)
      Returns the long value of a header with the specified name. If there are more than one value for the specified name, the last value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the long value of the last value in insertion order or null if there is no such header or it can't be converted to long.
    • getLastLong

      long getLastLong(CharSequence name, long defaultValue)
      Returns the long value of a header with the specified name. If there are more than one value for the specified name, the last value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the long value of the last value in insertion order or defaultValue if there is no such header or it can't be converted to long.
    • getFloat

      Returns the float value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the float value of the first value in insertion order or null if there is no such header or it can't be converted to float.
    • getFloat

      float getFloat(CharSequence name, float defaultValue)
      Returns the float value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the float value of the first value in insertion order or defaultValue if there is no such header or it can't be converted to float.
    • getLastFloat

      @Nullable @Nullable Float getLastFloat(CharSequence name)
      Returns the float value of a header with the specified name. If there are more than one value for the specified name, the last value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the float value of the last value in insertion order or null if there is no such header or it can't be converted to float.
    • getLastFloat

      float getLastFloat(CharSequence name, float defaultValue)
      Returns the float value of a header with the specified name. If there are more than one value for the specified name, the last value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the float value of the last value in insertion order or defaultValue if there is no such header or it can't be converted to float.
    • getDouble

      Returns the double value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the double value of the first value in insertion order or null if there is no such header or it can't be converted to double.
    • getDouble

      double getDouble(CharSequence name, double defaultValue)
      Returns the double value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the double value of the first value in insertion order or defaultValue if there is no such header or it can't be converted to double.
    • getLastDouble

      @Nullable @Nullable Double getLastDouble(CharSequence name)
      Returns the double value of a header with the specified name. If there are more than one value for the specified name, the last value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the double value of the last value in insertion order or null if there is no such header or it can't be converted to double.
    • getLastDouble

      double getLastDouble(CharSequence name, double defaultValue)
      Returns the double value of a header with the specified name. If there are more than one value for the specified name, the last value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the double value of the last value in insertion order or defaultValue if there is no such header or it can't be converted to double.
    • getTimeMillis

      @Nullable @Nullable Long getTimeMillis(CharSequence name)
      Returns the value of a header with the specified name in milliseconds. If there are more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the milliseconds value of the first value in insertion order or null if there is no such header or it can't be converted to milliseconds.
    • getTimeMillis

      long getTimeMillis(CharSequence name, long defaultValue)
      Returns the value of a header with the specified name in milliseconds. If there are more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the milliseconds value of the first value in insertion order or defaultValue if there is no such header or it can't be converted to milliseconds.
    • getLastTimeMillis

      @Nullable @Nullable Long getLastTimeMillis(CharSequence name)
      Returns the value of a header with the specified name in milliseconds. If there are more than one value for the specified name, the last value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the milliseconds value of the last value in insertion order or null if there is no such header or it can't be converted to milliseconds.
    • getLastTimeMillis

      long getLastTimeMillis(CharSequence name, long defaultValue)
      Returns the value of a header with the specified name in milliseconds. If there are more than one value for the specified name, the last value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the milliseconds value of the last value in insertion order or defaultValue if there is no such header or it can't be converted to milliseconds.
    • contains

      boolean contains(CharSequence name)
      Returns true if a header with the name exists, false otherwise.
      Parameters:
      name - the header name
    • contains

      boolean contains(CharSequence name, String value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value of the header to find
    • containsObject

      boolean containsObject(CharSequence name, Object value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if the header exists. false otherwise
    • containsBoolean

      boolean containsBoolean(CharSequence name, boolean value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if the header with the name exist and value is true and header contains value that one of "true", "TRUE", "1" or value is false and header contains value that one of "false", "FALSE", "0". false otherwise
    • containsInt

      boolean containsInt(CharSequence name, int value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if the header exists. false otherwise
    • containsLong

      boolean containsLong(CharSequence name, long value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if the header exists. false otherwise
    • containsFloat

      boolean containsFloat(CharSequence name, float value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if the header exists. false otherwise
    • containsDouble

      boolean containsDouble(CharSequence name, double value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if the header exists. false otherwise
    • containsTimeMillis

      boolean containsTimeMillis(CharSequence name, long value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if the header exists. false otherwise
    • size

      int size()
      Returns the number of headers.
    • isEmpty

      boolean isEmpty()
      Returns true if this headers does not contain any entries.
    • names

      Set<io.netty.util.AsciiString> names()
      Returns a Set of all header names. The returned Set cannot be modified.
    • iterator

      Iterator<Map.Entry<io.netty.util.AsciiString,String>> iterator()
      Returns an Iterator that yields all header entries. The iteration order is as follows:
      1. All pseudo headers (order not specified).
      2. All non-pseudo headers (in insertion order).
      Specified by:
      iterator in interface Iterable<Map.Entry<io.netty.util.AsciiString,String>>
    • valueIterator

      Iterator<String> valueIterator(CharSequence name)
      Returns an Iterator that yields all values of the headers with the specified name.
    • forEach

      void forEach(BiConsumer<io.netty.util.AsciiString,String> action)
      Invokes the specified action for all header entries.
    • forEachValue

      void forEachValue(CharSequence name, Consumer<String> action)
      Invokes the specified action for all values of the headers with the specified name.
    • stream

      default Stream<Map.Entry<io.netty.util.AsciiString,String>> stream()
      Returns a Stream that yields all header entries.
    • valueStream

      default Stream<String> valueStream(CharSequence name)
      Returns a Stream that yields all values of the headers with the specified name.
    • uri

      URI uri()
      Returns the request URI generated from the ":scheme", ":authority" and ":path" headers.
      Throws:
      IllegalStateException - if any of the required headers do not exist or the resulting URI is not valid.
    • method

      HttpMethod method()
      Returns the value of the ":method" header as an HttpMethod. HttpMethod.UNKNOWN is returned if the value is not defined in HttpMethod.
      Throws:
      IllegalStateException - if there is no such header.
    • path

      String path()
      Returns the value of the ":path" header.
      Throws:
      IllegalStateException - if there is no such header.
    • scheme

      Returns the value of the ":scheme" header or null if there is no such header.
    • authority

      Returns the value of the ":authority" for HTTP/2 request or "Host" header for HTTP/1.1. null if there is no such headers.
    • acceptLanguages

      Returns a list of Locale.LanguageRanges that are specified in HttpHeaderNames.ACCEPT_LANGUAGE in the order of client preferences.
      Returns:
      All Locale.LanguageRanges of all matching headers or null if there is a parsing error or if there is no header.
    • selectLocale

      @Nullable @Nullable Locale selectLocale(Iterable<Locale> supportedLocales)
      Matches the Locales supported by the server to the HttpHeaderNames.ACCEPT_LANGUAGE and returns the best match according to client preference. It does this via Basic Filtering each Locale.LanguageRange and picking the first match. This is the "classic" algorithm described in RFC2616 Accept-Language (obsoleted) and also referenced in RFC7231 Accept-Language. See also Locale.lookup(java.util.List<java.util.Locale.LanguageRange>, java.util.Collection<java.util.Locale>) for another algorithm.
      Parameters:
      supportedLocales - a Iterable of Locales supported by the server.
      Returns:
      The best matching Locale or null if no locale matches.
    • selectLocale

      @Nullable default @Nullable Locale selectLocale(Locale... supportedLocales)
      Matches the Locales supported by the server to the HttpHeaderNames.ACCEPT_LANGUAGE and returns the best match according to client preference. It does this via Basic Filtering each Locale.LanguageRange and picking the first match. This is the "classic" algorithm described in RFC2616 Accept-Language (obsoleted) and also referenced in RFC7231 Accept-Language. See also Locale.lookup(java.util.List<java.util.Locale.LanguageRange>, java.util.Collection<java.util.Locale>) for another algorithm.
      Parameters:
      supportedLocales - Locales supported by the server.
      Returns:
      The best matching Locale or null if no locale matches.
    • cookies

      Cookies cookies()
      Returns the parsed cookie header.
      Returns:
      a Cookies or an empty Cookies if there is no such header.
    • accept

      List<MediaType> accept()
      Returns the parsed Accept header or an empty List if there is no such header. The returned MediaTypes will be sorted according to client preference.