Interface RequestHeaders


public interface RequestHeaders

Represents the HTTP headers of a client request in a server exchange as defined by RFC 7230 Section 3.2.

Since:
1.0
Author:
Jeremy Kuhn
See Also:
Request
  • Method Details

    • getContentType

      String getContentType()

      Returns the content type header field value of the request.

      Returns:
      the content type
    • getContentLength

      Long getContentLength()

      Returns the content length of the request.

      Returns:
      the content length
    • contains

      boolean contains(CharSequence name)

      Determines whether a header with the specified name is present.

      Parameters:
      name - a header name
      Returns:
      true if a header is present, false otherwise
    • contains

      boolean contains(CharSequence name, CharSequence value)

      Determines whether a header with the specified name and value is present.

      Parameters:
      name - a header name
      value - a header value
      Returns:
      true if a header is present, false otherwise
    • getNames

      Set<String> getNames()

      Returns the names of the headers in the request.

      Returns:
      a list of header names
    • get

      Optional<String> get(CharSequence name)

      Returns the value of the header with the specified name.

      If there are multiple headers with the same name, this method returns the first one.

      Parameters:
      name - a header name
      Returns:
      an optional returning the value of the header or an empty optional if there's no header with the specified name
    • getAll

      List<String> getAll(CharSequence name)

      Returns the values of all headers with the specified name.

      Parameters:
      name - a header name
      Returns:
      a list of header values or an empty list if there's no header with the specified name
    • getAll

      List<Map.Entry<String,​String>> getAll()

      Returns all headers in the request.

      Returns:
      a list of header entries or an empty list if there's no header
    • getHeader

      <T extends Header> Optional<T> getHeader(CharSequence name)

      Decodes and returns the header with the specified name.

      If there are multiple headers with the same name, this method returns the first one.

      Type Parameters:
      T - the decoded header type
      Parameters:
      name - a header name
      Returns:
      an optional returning the decoded header or an empty optional if there's no header with the specified name
    • getAllHeader

      <T extends Header> List<T> getAllHeader(CharSequence name)

      Decodes and returns all headers with the specified name.

      Type Parameters:
      T - the decoded header type
      Parameters:
      name - a header name
      Returns:
      a list of header values or an empty list if there's no header with the specified name
    • getAllHeader

      List<Header> getAllHeader()

      Decodes and returns all headers in the request.

      Returns:
      a list of headers or an empty list if there's no header
    • getParameter

      Optional<Parameter> getParameter(CharSequence name)

      Returns the header with the specified name as a parameter.

      If there are multiple headers with the same name, this method returns the first one.

      Parameters:
      name - a header name
      Returns:
      an optional returning the parameter or an empty optional if there's no header with the specified name
    • getAllParameter

      List<Parameter> getAllParameter(CharSequence name)

      Returns all headers with the specified name as parameters.

      Parameters:
      name - a header name
      Returns:
      a list of parameters or an empty list if there's no header with the specified name
    • getAllParameter

      List<Parameter> getAllParameter()

      Returns all headers in the request as parameters.

      Returns:
      a list of parameters or an empty list if there's no header