Class Http2FrameCodec.FrameListener

java.lang.Object
io.netty.handler.codec.http2.Http2FrameCodec.FrameListener
All Implemented Interfaces:
Http2FrameListener
Enclosing class:
Http2FrameCodec

private final class Http2FrameCodec.FrameListener extends Object implements Http2FrameListener
  • Constructor Details

    • FrameListener

      private FrameListener()
  • Method Details

    • onUnknownFrame

      public void onUnknownFrame(ChannelHandlerContext ctx, byte frameType, int streamId, Http2Flags flags, ByteBuf payload)
      Description copied from interface: Http2FrameListener
      Handler for a frame not defined by the HTTP/2 spec.
      Specified by:
      onUnknownFrame in interface Http2FrameListener
      Parameters:
      ctx - the context from the handler where the frame was read.
      frameType - the frame type from the HTTP/2 header.
      streamId - the stream the frame was sent on.
      flags - the flags in the frame header.
      payload - the payload of the frame.
    • onSettingsRead

      public void onSettingsRead(ChannelHandlerContext ctx, Http2Settings settings)
      Description copied from interface: Http2FrameListener
      Handles an inbound SETTINGS frame.
      Specified by:
      onSettingsRead in interface Http2FrameListener
      Parameters:
      ctx - the context from the handler where the frame was read.
      settings - the settings received from the remote endpoint.
    • onPingRead

      public void onPingRead(ChannelHandlerContext ctx, long data)
      Description copied from interface: Http2FrameListener
      Handles an inbound PING frame.
      Specified by:
      onPingRead in interface Http2FrameListener
      Parameters:
      ctx - the context from the handler where the frame was read.
      data - the payload of the frame.
    • onPingAckRead

      public void onPingAckRead(ChannelHandlerContext ctx, long data)
      Description copied from interface: Http2FrameListener
      Handles an inbound PING acknowledgment.
      Specified by:
      onPingAckRead in interface Http2FrameListener
      Parameters:
      ctx - the context from the handler where the frame was read.
      data - the payload of the frame.
    • onRstStreamRead

      public void onRstStreamRead(ChannelHandlerContext ctx, int streamId, long errorCode)
      Description copied from interface: Http2FrameListener
      Handles an inbound RST_STREAM frame.
      Specified by:
      onRstStreamRead in interface Http2FrameListener
      Parameters:
      ctx - the context from the handler where the frame was read.
      streamId - the stream that is terminating.
      errorCode - the error code identifying the type of failure.
    • onWindowUpdateRead

      public void onWindowUpdateRead(ChannelHandlerContext ctx, int streamId, int windowSizeIncrement)
      Description copied from interface: Http2FrameListener
      Handles an inbound WINDOW_UPDATE frame.
      Specified by:
      onWindowUpdateRead in interface Http2FrameListener
      Parameters:
      ctx - the context from the handler where the frame was read.
      streamId - the stream the frame was sent on.
      windowSizeIncrement - the increased number of bytes of the remote endpoint's flow control window.
    • onHeadersRead

      public void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int streamDependency, short weight, boolean exclusive, int padding, boolean endStream)
      Description copied from interface: Http2FrameListener
      Handles an inbound HEADERS frame with priority information specified. Only called if END_HEADERS encountered.

      Only one of the following methods will be called for each HEADERS frame sequence. One will be called when the END_HEADERS flag has been received.

      To say it another way; the Http2Headers will contain all of the headers for the current message exchange step (additional queuing is not necessary).

      Specified by:
      onHeadersRead in interface Http2FrameListener
      Parameters:
      ctx - the context from the handler where the frame was read.
      streamId - the subject stream for the frame.
      headers - the received headers.
      streamDependency - the stream on which this stream depends, or 0 if dependent on the connection.
      weight - the new weight for the stream.
      exclusive - whether or not the stream should be the exclusive dependent of its parent.
      padding - additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).
      endStream - Indicates whether this is the last frame to be sent from the remote endpoint for this stream.
    • onHeadersRead

      public void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int padding, boolean endOfStream)
      Description copied from interface: Http2FrameListener
      Handles an inbound HEADERS frame.

      Only one of the following methods will be called for each HEADERS frame sequence. One will be called when the END_HEADERS flag has been received.

      To say it another way; the Http2Headers will contain all of the headers for the current message exchange step (additional queuing is not necessary).

      Specified by:
      onHeadersRead in interface Http2FrameListener
      Parameters:
      ctx - the context from the handler where the frame was read.
      streamId - the subject stream for the frame.
      headers - the received headers.
      padding - additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).
      endOfStream - Indicates whether this is the last frame to be sent from the remote endpoint for this stream.
    • onDataRead

      public int onDataRead(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding, boolean endOfStream)
      Description copied from interface: Http2FrameListener
      Handles an inbound DATA frame.
      Specified by:
      onDataRead in interface Http2FrameListener
      Parameters:
      ctx - the context from the handler where the frame was read.
      streamId - the subject stream for the frame.
      data - payload buffer for the frame. This buffer will be released by the codec.
      padding - additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).
      endOfStream - Indicates whether this is the last frame to be sent from the remote endpoint for this stream.
      Returns:
      the number of bytes that have been processed by the application. The returned bytes are used by the inbound flow controller to determine the appropriate time to expand the inbound flow control window (i.e. send WINDOW_UPDATE). Returning a value equal to the length of data + padding will effectively opt-out of application-level flow control for this frame. Returning a value less than the length of data + padding will defer the returning of the processed bytes, which the application must later return via Http2LocalFlowController.consumeBytes(Http2Stream, int). The returned value must be >= 0 and invalid input: '<'= data.readableBytes() + padding.
    • onGoAwayRead

      public void onGoAwayRead(ChannelHandlerContext ctx, int lastStreamId, long errorCode, ByteBuf debugData)
      Description copied from interface: Http2FrameListener
      Handles an inbound GO_AWAY frame.
      Specified by:
      onGoAwayRead in interface Http2FrameListener
      Parameters:
      ctx - the context from the handler where the frame was read.
      lastStreamId - the last known stream of the remote endpoint.
      errorCode - the error code, if abnormal closure.
      debugData - application-defined debug data. If this buffer needs to be retained by the listener they must make a copy.
    • onPriorityRead

      public void onPriorityRead(ChannelHandlerContext ctx, int streamId, int streamDependency, short weight, boolean exclusive)
      Description copied from interface: Http2FrameListener
      Handles an inbound PRIORITY frame.

      Note that is it possible to have this method called and no stream object exist for either streamId, streamDependency, or both. This is because the PRIORITY frame can be sent/received when streams are in the CLOSED state.

      Specified by:
      onPriorityRead in interface Http2FrameListener
      Parameters:
      ctx - the context from the handler where the frame was read.
      streamId - the subject stream for the frame.
      streamDependency - the stream on which this stream depends, or 0 if dependent on the connection.
      weight - the new weight for the stream.
      exclusive - whether or not the stream should be the exclusive dependent of its parent.
    • onSettingsAckRead

      public void onSettingsAckRead(ChannelHandlerContext ctx)
      Description copied from interface: Http2FrameListener
      Handles an inbound SETTINGS acknowledgment frame.
      Specified by:
      onSettingsAckRead in interface Http2FrameListener
      Parameters:
      ctx - the context from the handler where the frame was read.
    • onPushPromiseRead

      public void onPushPromiseRead(ChannelHandlerContext ctx, int streamId, int promisedStreamId, Http2Headers headers, int padding)
      Description copied from interface: Http2FrameListener
      Handles an inbound PUSH_PROMISE frame. Only called if END_HEADERS encountered.

      Promised requests MUST be authoritative, cacheable, and safe. See [RFC 7540], Section 8.2.

      Only one of the following methods will be called for each HEADERS frame sequence. One will be called when the END_HEADERS flag has been received.

      To say it another way; the Http2Headers will contain all of the headers for the current message exchange step (additional queuing is not necessary).

      Specified by:
      onPushPromiseRead in interface Http2FrameListener
      Parameters:
      ctx - the context from the handler where the frame was read.
      streamId - the stream the frame was sent on.
      promisedStreamId - the ID of the promised stream.
      headers - the received headers.
      padding - additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).
    • requireStream

      private Http2FrameStream requireStream(int streamId)