Class Http2FrameCodec

    • Method Detail

      • handlerAdded

        public final void handlerAdded​(io.netty.channel.ChannelHandlerContext ctx)
                                throws Exception
        Specified by:
        handlerAdded in interface io.netty.channel.ChannelHandler
        Overrides:
        handlerAdded in class Http2ConnectionHandler
        Throws:
        Exception
      • userEventTriggered

        public final void userEventTriggered​(io.netty.channel.ChannelHandlerContext ctx,
                                             Object evt)
                                      throws Exception
        Handles the cleartext HTTP upgrade event. If an upgrade occurred, sends a simple response via HTTP/2 on stream 1 (the stream specifically reserved for cleartext HTTP upgrade).
        Specified by:
        userEventTriggered in interface io.netty.channel.ChannelInboundHandler
        Overrides:
        userEventTriggered in class io.netty.handler.codec.ByteToMessageDecoder
        Throws:
        Exception
      • write

        public void write​(io.netty.channel.ChannelHandlerContext ctx,
                          Object msg,
                          io.netty.channel.ChannelPromise promise)
        Processes all Http2Frames. Http2StreamFrames may only originate in child streams.
        Specified by:
        write in interface io.netty.channel.ChannelOutboundHandler
        Overrides:
        write in class Http2ConnectionHandler
      • onConnectionError

        protected void onConnectionError​(io.netty.channel.ChannelHandlerContext ctx,
                                         boolean outbound,
                                         Throwable cause,
                                         Http2Exception http2Ex)
        Description copied from class: Http2ConnectionHandler
        Handler for a connection error. Sends a GO_AWAY frame to the remote endpoint. Once all streams are closed, the connection is shut down.
        Overrides:
        onConnectionError in class Http2ConnectionHandler
        Parameters:
        ctx - the channel context
        outbound - true if the error was caused by an outbound operation.
        cause - the exception that was caught
        http2Ex - the Http2Exception that is embedded in the causality chain. This may be null if it's an unknown exception.
      • onStreamError

        protected final void onStreamError​(io.netty.channel.ChannelHandlerContext ctx,
                                           boolean outbound,
                                           Throwable cause,
                                           Http2Exception.StreamException streamException)
        Exceptions for unknown streams, that is streams that have no Http2FrameStream object attached are simply logged and replied to by sending a RST_STREAM frame.
        Overrides:
        onStreamError in class Http2ConnectionHandler
        Parameters:
        ctx - the channel context
        outbound - true if the error was caused by an outbound operation.
        cause - the exception that was caught
        streamException - the Http2Exception.StreamException that is embedded in the causality chain.
      • isGracefulShutdownComplete

        protected final boolean isGracefulShutdownComplete()
        Description copied from class: Http2ConnectionHandler
        Called by the graceful shutdown logic to determine when it is safe to close the connection. Returns true if the graceful shutdown has completed and the connection can be safely closed. This implementation just guarantees that there are no active streams. Subclasses may override to provide additional checks.
        Overrides:
        isGracefulShutdownComplete in class Http2ConnectionHandler
      • newHttp2UnknownFrame

        protected Http2StreamFrame newHttp2UnknownFrame​(byte frameType,
                                                        int streamId,
                                                        Http2Flags flags,
                                                        io.netty.buffer.ByteBuf payload)
        Create a Http2UnknownFrame. The ownership of the ByteBuf is transferred.