Interface Http2FrameListener

    • Method Detail

      • onDataRead

        int onDataRead​(ChannelHandlerContext ctx,
                       int streamId,
                       Buffer data,
                       int padding,
                       boolean endOfStream)
                throws Http2Exception
        Handles an inbound DATA frame.
        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 <= data.readableBytes() + padding.
        Throws:
        Http2Exception
      • onPriorityRead

        void onPriorityRead​(ChannelHandlerContext ctx,
                            int streamId,
                            int streamDependency,
                            short weight,
                            boolean exclusive)
                     throws Http2Exception
        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.

        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.
        Throws:
        Http2Exception
      • onRstStreamRead

        void onRstStreamRead​(ChannelHandlerContext ctx,
                             int streamId,
                             long errorCode)
                      throws Http2Exception
        Handles an inbound RST_STREAM frame.
        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.
        Throws:
        Http2Exception
      • onPingRead

        void onPingRead​(ChannelHandlerContext ctx,
                        long data)
                 throws Http2Exception
        Handles an inbound PING frame.
        Parameters:
        ctx - the context from the handler where the frame was read.
        data - the payload of the frame.
        Throws:
        Http2Exception
      • onPingAckRead

        void onPingAckRead​(ChannelHandlerContext ctx,
                           long data)
                    throws Http2Exception
        Handles an inbound PING acknowledgment.
        Parameters:
        ctx - the context from the handler where the frame was read.
        data - the payload of the frame.
        Throws:
        Http2Exception
      • onGoAwayRead

        void onGoAwayRead​(ChannelHandlerContext ctx,
                          int lastStreamId,
                          long errorCode,
                          Buffer debugData)
                   throws Http2Exception
        Handles an inbound GO_AWAY frame.
        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.
        Throws:
        Http2Exception
      • onWindowUpdateRead

        void onWindowUpdateRead​(ChannelHandlerContext ctx,
                                int streamId,
                                int windowSizeIncrement)
                         throws Http2Exception
        Handles an inbound WINDOW_UPDATE frame.
        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.
        Throws:
        Http2Exception
      • onUnknownFrame

        void onUnknownFrame​(ChannelHandlerContext ctx,
                            byte frameType,
                            int streamId,
                            Http2Flags flags,
                            Buffer payload)
                     throws Http2Exception
        Handler for a frame not defined by the HTTP/2 spec.
        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.
        Throws:
        Http2Exception