Class Http2ClientStream

java.lang.Object
io.helidon.webclient.http2.Http2ClientStream
All Implemented Interfaces:
Http2Stream, ReleasableResource

public class Http2ClientStream extends Object implements Http2Stream, ReleasableResource
Represents an HTTP2 client stream. This class is not intended to be used by applications, it is only public internally within Helidon.
  • Constructor Details

  • Method Details

    • streamId

      public int streamId()
      Description copied from interface: Http2Stream
      Stream ID.
      Specified by:
      streamId in interface Http2Stream
      Returns:
      id of this stream
    • streamState

      public Http2StreamState streamState()
      Description copied from interface: Http2Stream
      State of this stream.
      Specified by:
      streamState in interface Http2Stream
      Returns:
      state
    • headers

      public void headers(Http2Headers headers, boolean endOfStream)
      Description copied from interface: Http2Stream
      Headers received.
      Specified by:
      headers in interface Http2Stream
      Parameters:
      headers - headers
      endOfStream - whether these headers are the last data that would be received
    • rstStream

      public boolean rstStream(Http2RstStream rstStream)
      Description copied from interface: Http2Stream
      Close the stream.
      Specified by:
      rstStream in interface Http2Stream
      Parameters:
      rstStream - rst stream frame
      Returns:
      true if rapid reset(rst received before any data are sent)
    • windowUpdate

      public void windowUpdate(Http2WindowUpdate windowUpdate)
      Description copied from interface: Http2Stream
      Flow control window update.
      Specified by:
      windowUpdate in interface Http2Stream
      Parameters:
      windowUpdate - window update frame
    • data

      public void data(Http2FrameHeader header, BufferData data, boolean endOfStream)
      Description copied from interface: Http2Stream
      Data frame.
      Specified by:
      data in interface Http2Stream
      Parameters:
      header - frame header
      data - frame data
      endOfStream - whether this is the last data that would be received
    • priority

      public void priority(Http2Priority http2Priority)
      Description copied from interface: Http2Stream
      Priority.
      Specified by:
      priority in interface Http2Stream
      Parameters:
      http2Priority - priority frame
    • flowControl

      public StreamFlowControl flowControl()
      Description copied from interface: Http2Stream
      Outbound flow control of this stream.
      Specified by:
      flowControl in interface Http2Stream
      Returns:
      flow control
    • closeResource

      public void closeResource()
      Description copied from interface: ReleasableResource
      Closes the resource, we cannot use name close, as that would conflict with AutoCloseable, as we do not want to have a checked exception thrown.
      Specified by:
      closeResource in interface ReleasableResource
    • trailers

      public CompletableFuture<Headers> trailers()
      Future that shall be completed once trailers are received.
      Returns:
      the completable future
    • hasEntity

      public boolean hasEntity()
      Determines if an entity is expected. Set to false when an EOS flag is received.
      Returns:
      true if entity expected, false otherwise.
    • cancel

      public void cancel()
      Cancels this client stream.
    • close

      public void close()
      Removes the stream from underlying connection.
    • read

      public BufferData read()
      Reads a buffer data from the stream.
      Returns:
      the buffer data
    • writeHeaders

      public void writeHeaders(Http2Headers http2Headers, boolean endOfStream)
      Writes HTTP2 headers to the stream.
      Parameters:
      http2Headers - the headers
      endOfStream - end of stream marker
    • writeData

      public void writeData(BufferData entityBytes, boolean endOfStream)
      Writes a buffer data into the stream.
      Parameters:
      entityBytes - buffer data
      endOfStream - end of stream marker
    • sendPing

      public void sendPing()
      Sends PING frame to server. Can be used to check if connection is healthy.
    • readHeaders

      public Http2Headers readHeaders()
      Reads headers from this stream.
      Returns:
      the headers
    • ctx

      public SocketContext ctx()
      Returns the socket context associated with the stream.
      Returns:
      the socket context
    • readOne

      public Http2FrameData readOne(Duration pollTimeout)
      Reads an HTTP2 frame from the stream.
      Parameters:
      pollTimeout - timeout
      Returns:
      the data frame