Class HeadersFrame

java.lang.Object
robaho.net.httpserver.http2.frame.BaseFrame
robaho.net.httpserver.http2.frame.HeadersFrame

public class HeadersFrame extends BaseFrame
[rfc7540 Section 6.2] The HEADERS frame (type=0x1) is used to open a stream (Section 5.1), and additionally carries a header block fragment. HEADERS frames can be sent on a stream in the "idle", "reserved (local)", "open", or "half-closed (remote)" state.
  • Constructor Details

    • HeadersFrame

      public HeadersFrame()
    • HeadersFrame

      public HeadersFrame(FrameHeader header)
  • Method Details

    • getPadLength

      public int getPadLength()
      An 8-bit field containing the length of the frame padding in units of octets. This field is only present if the PADDED flag is set.
    • setPadLength

      public void setPadLength(int padLength)
    • getIsExclusive

      public boolean getIsExclusive()
      A single-bit flag indicating that the stream dependency is exclusive (see Section 5.3). This field is only present if the PRIORITY flag is set.
    • setIsExclusive

      public void setIsExclusive(boolean isExclusive)
    • getDependentStream

      public long getDependentStream()
      A 31-bit stream identifier for the stream that this stream depends on (see Section 5.3). This field is only present if the PRIORITY flag is set.
    • setDependentStream

      public void setDependentStream(long streamIdentifier)
    • getWeight

      public int getWeight()
      An unsigned 8-bit integer representing a priority weight for the stream (see Section 5.3). Add one to the value to obtain a weight between 1 and 256. This field is only present if the PRIORITY flag is set.
    • setWeight

      public void setWeight(int weight)
    • getHeaderBlock

      public byte[] getHeaderBlock()
      A header block fragment (Section 4.3).
    • setHeaderBlock

      public void setHeaderBlock(byte[] headerBlock)
    • getPadding

      public byte[] getPadding()
      Padding octets.
    • setPadding

      public void setPadding(byte[] padding)
    • parse

      public static HeadersFrame parse(byte[] frameBody, FrameHeader header) throws HTTP2Exception, Exception
      Parameters:
      frameBody - payload of the HeadersFrame after consuming the FrameHeader
      header - FrameHeader
      Returns:
      HeadersFrame object
      Throws:
      HTTP2Exception
      Exception
    • writeTo

      public void writeTo(OutputStream os) throws IOException
      Specified by:
      writeTo in class BaseFrame
      Throws:
      IOException
    • encode

      public byte[] encode()
      Overrides:
      encode in class BaseFrame