Class CleartextHttp2ServerUpgradeHandler

  • All Implemented Interfaces:
    io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

    public final class CleartextHttp2ServerUpgradeHandler
    extends io.netty.handler.codec.ByteToMessageDecoder
    Performing cleartext upgrade, by h2c HTTP upgrade or Prior Knowledge. This handler config pipeline for h2c upgrade when handler added. And will update pipeline once it detect the connection is starting HTTP/2 by prior knowledge or not.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  CleartextHttp2ServerUpgradeHandler.PriorKnowledgeUpgradeEvent
      User event that is fired to notify about HTTP/2 protocol is started.
      • Nested classes/interfaces inherited from class io.netty.handler.codec.ByteToMessageDecoder

        io.netty.handler.codec.ByteToMessageDecoder.Cumulator
      • Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

        io.netty.channel.ChannelHandler.Sharable
    • Field Summary

      • Fields inherited from class io.netty.handler.codec.ByteToMessageDecoder

        COMPOSITE_CUMULATOR, MERGE_CUMULATOR
    • Constructor Summary

      Constructors 
      Constructor Description
      CleartextHttp2ServerUpgradeHandler​(io.netty.handler.codec.http.HttpServerCodec httpServerCodec, io.netty.handler.codec.http.HttpServerUpgradeHandler httpServerUpgradeHandler, io.netty.channel.ChannelHandler http2ServerHandler)
      Creates the channel handler provide cleartext HTTP/2 upgrade from HTTP upgrade or prior knowledge
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void decode​(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, List<Object> out)
      Peek inbound message to determine current connection wants to start HTTP/2 by HTTP upgrade or prior knowledge
      void handlerAdded​(io.netty.channel.ChannelHandlerContext ctx)  
      • Methods inherited from class io.netty.handler.codec.ByteToMessageDecoder

        actualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggered
      • Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

        channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught
      • Methods inherited from class io.netty.channel.ChannelHandlerAdapter

        ensureNotSharable, isSharable
    • Constructor Detail

      • CleartextHttp2ServerUpgradeHandler

        public CleartextHttp2ServerUpgradeHandler​(io.netty.handler.codec.http.HttpServerCodec httpServerCodec,
                                                  io.netty.handler.codec.http.HttpServerUpgradeHandler httpServerUpgradeHandler,
                                                  io.netty.channel.ChannelHandler http2ServerHandler)
        Creates the channel handler provide cleartext HTTP/2 upgrade from HTTP upgrade or prior knowledge
        Parameters:
        httpServerCodec - the http server codec
        httpServerUpgradeHandler - the http server upgrade handler for HTTP/2
        http2ServerHandler - the http2 server handler, will be added into pipeline when starting HTTP/2 by prior knowledge
    • Method Detail

      • handlerAdded

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

        protected void decode​(io.netty.channel.ChannelHandlerContext ctx,
                              io.netty.buffer.ByteBuf in,
                              List<Object> out)
                       throws Exception
        Peek inbound message to determine current connection wants to start HTTP/2 by HTTP upgrade or prior knowledge
        Specified by:
        decode in class io.netty.handler.codec.ByteToMessageDecoder
        Throws:
        Exception