Class Http2Headers

java.lang.Object
io.helidon.http.http2.Http2Headers

public class Http2Headers extends Object
HTTP/2 headers combining pseudo headers and Headers. HTTP/2 headers are all lower case.
  • Field Details

    • AUTHORITY_NAME

      public static final HeaderName AUTHORITY_NAME
      Header name of the authority pseudo header.
    • METHOD_NAME

      public static final HeaderName METHOD_NAME
      Header name of the method pseudo header.
    • PATH_NAME

      public static final HeaderName PATH_NAME
      Header name of the path pseudo header.
    • SCHEME_NAME

      public static final HeaderName SCHEME_NAME
      Header name of the scheme pseudo header.
    • STATUS_NAME

      public static final HeaderName STATUS_NAME
      Header name of the status pseudo header.
  • Method Details

    • create

      public static Http2Headers create(Http2Stream stream, Http2Headers.DynamicTable table, Http2HuffmanDecoder huffman, Http2Headers headers, Http2FrameData... frames)
      Create headers from HTTP request.
      Parameters:
      stream - stream that owns these headers
      table - dynamic table for this connection
      huffman - huffman decoder
      headers - http2 headers
      frames - frames of the headers
      Returns:
      new headers parsed from the frames
      Throws:
      Http2Exception - in case of protocol errors
    • create

      public static Http2Headers create(Http2Stream stream, Http2Headers.DynamicTable table, Http2HuffmanDecoder huffman, Http2FrameData... frames)
      Create headers from HTTP request.
      Parameters:
      stream - stream that owns these headers
      table - dynamic table for this connection
      huffman - huffman decoder
      frames - frames of the headers
      Returns:
      new headers parsed from the frames
      Throws:
      Http2Exception - in case of protocol errors
    • create

      public static Http2Headers create(Headers headers)
      Create HTTP/2 headers from HTTP headers.
      Parameters:
      headers - headers to base these headers on
      Returns:
      new HTTP/2 headers
    • create

      public static Http2Headers create(WritableHeaders<?> writableHeaders)
      Create from writable HTTP headers.
      Parameters:
      writableHeaders - header to use
      Returns:
      new HTTP/2 headers
    • status

      public Status status()
      Status pseudo header.
      Returns:
      status or null if none defined
    • path

      public String path()
      Path pseudo header.
      Returns:
      path or null if none defined
    • method

      public Method method()
      Method pseudo header.
      Returns:
      method or null if none defined
    • scheme

      public String scheme()
      Scheme pseudo header.
      Returns:
      method or null if none defined
    • authority

      public String authority()
      Authority pseudo header.
      Returns:
      authority or null if none defined
    • path

      public Http2Headers path(String path)
      Path of the request.
      Parameters:
      path - HTTP path of the request
      Returns:
      updated headers
    • method

      public Http2Headers method(Method method)
      HTTP method to be used.
      Parameters:
      method - HTTP method of the request
      Returns:
      updated headers
    • authority

      public Http2Headers authority(String authority)
      Authority of the request. This is an HTTP/2 pseudo-header. This is an equivalent of HOST header in HTTP/1.
      Parameters:
      authority - authority of the request, such as localhost:8080
      Returns:
      updated headers
    • scheme

      public Http2Headers scheme(String scheme)
      HTTP scheme, such as http or https.
      Parameters:
      scheme - scheme of the request
      Returns:
      updated headeres
    • httpHeaders

      public Headers httpHeaders()
      HTTP headers.
      Returns:
      headers
    • validateResponse

      public void validateResponse() throws Http2Exception
      Validate server response or client response.
      Throws:
      Http2Exception - in case the response is invalid
    • validateRequest

      public void validateRequest() throws Http2Exception
      Validate client or server request.
      Throws:
      Http2Exception - in case the request is invalid
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • status

      public Http2Headers status(Status status)
      Status pseudo header.
      Parameters:
      status - status to use
      Returns:
      updated headers
    • write

      public void write(Http2Headers.DynamicTable table, Http2HuffmanEncoder huffman, BufferData growingBuffer)
      Write headers to a buffer.
      Parameters:
      table - dynamic table to use
      huffman - huffman encoder to use
      growingBuffer - buffer to write to