Class Http2ConnectionWriter

java.lang.Object
io.helidon.http.http2.Http2ConnectionWriter
All Implemented Interfaces:
Http2StreamWriter

public class Http2ConnectionWriter extends Object implements Http2StreamWriter
HTTP/2 connection writer.
  • Constructor Details

    • Http2ConnectionWriter

      public Http2ConnectionWriter(SocketContext ctx, DataWriter writer, List<Http2FrameListener> sendFrameListeners)
      A new writer.
      Parameters:
      ctx - connection context
      writer - data writer
      sendFrameListeners - send frame listeners
  • Method Details

    • write

      public void write(Http2FrameData frame)
      Description copied from interface: Http2StreamWriter
      Write a frame.
      Specified by:
      write in interface Http2StreamWriter
      Parameters:
      frame - frame to write
    • tryWrite

      public boolean tryWrite(Http2FrameData frame, Runnable beforeWrite)
      Attempts to write a frame without waiting for another frame write to finish.
      Parameters:
      frame - frame to write
      beforeWrite - action to invoke after acquiring the frame serialization lock and before writing
      Returns:
      true if the frame was written, false if another frame write is in progress
    • writeData

      public void writeData(Http2FrameData frame, FlowControl.Outbound flowControl)
      Description copied from interface: Http2StreamWriter
      Write a frame with flow control.
      Specified by:
      writeData in interface Http2StreamWriter
      Parameters:
      frame - data frame
      flowControl - outbound flow control
    • writeData

      public int writeData(Http2FrameData frame, FlowControl.Outbound flowControl, Runnable onEndStreamFrameWritten)
      Write a frame with flow control and notify when an END_STREAM data frame has been written and accounted for.
      Parameters:
      frame - data frame
      flowControl - outbound flow control
      onEndStreamFrameWritten - action to run after the END_STREAM data frame is written and accounted for
      Returns:
      number of bytes written
    • writeHeaders

      public int writeHeaders(Http2Headers headers, int streamId, Http2Flag.HeaderFlags flags, FlowControl.Outbound flowControl)
      Description copied from interface: Http2StreamWriter
      Write headers with no (or streaming) entity.
      Specified by:
      writeHeaders in interface Http2StreamWriter
      Parameters:
      headers - headers
      streamId - stream ID
      flags - flags to use
      flowControl - flow control
      Returns:
      number of bytes written
    • writeHeaders

      public int writeHeaders(Http2Headers headers, int streamId, Http2Flag.HeaderFlags flags, FlowControl.Outbound flowControl, Runnable onEndStreamFrameWritten)
      Write headers and notify when an END_STREAM headers frame has been written.
      Parameters:
      headers - headers
      streamId - stream ID
      flags - flags to use
      flowControl - flow control
      onEndStreamFrameWritten - action to run after the END_STREAM headers frame is written
      Returns:
      number of bytes written
    • writeHeaders

      public int writeHeaders(Http2Headers headers, int streamId, Http2Flag.HeaderFlags flags, Http2FrameData dataFrame, FlowControl.Outbound flowControl)
      Description copied from interface: Http2StreamWriter
      Write headers and entity.
      Specified by:
      writeHeaders in interface Http2StreamWriter
      Parameters:
      headers - headers
      streamId - stream ID
      flags - header flags
      dataFrame - data frame
      flowControl - flow control
      Returns:
      number of bytes written
    • writeHeaders

      public int writeHeaders(Http2Headers headers, int streamId, Http2Flag.HeaderFlags flags, Http2FrameData dataFrame, FlowControl.Outbound flowControl, Runnable onEndStreamFrameWritten)
      Write headers and entity, and notify when an END_STREAM data frame has been written and accounted for.
      Parameters:
      headers - headers
      streamId - stream ID
      flags - header flags
      dataFrame - data frame
      flowControl - flow control
      onEndStreamFrameWritten - action to run after the END_STREAM data frame is written and accounted for
      Returns:
      number of bytes written
    • updateHeaderTableSize

      public void updateHeaderTableSize(long newSize) throws InterruptedException
      Update header table size.
      Parameters:
      newSize - in bytes
      Throws:
      InterruptedException - in case we fail to lock on the stream