Class CleartextHttp2ServerUpgradeHandler

  • All Implemented Interfaces:
    io.netty5.channel.ChannelHandler

    @UnstableApi
    public final class CleartextHttp2ServerUpgradeHandler
    extends io.netty5.handler.codec.ByteToMessageDecoder
    Performing clear-text upgrade, by h2c HTTP upgrade or Prior Knowledge. This handler config pipeline for h2c upgrade when handler added. And will update pipeline once it detects 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.netty5.handler.codec.ByteToMessageDecoder

        io.netty5.handler.codec.ByteToMessageDecoder.Cumulator
    • Field Summary

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

        COMPOSITE_CUMULATOR, MERGE_CUMULATOR
    • Constructor Summary

      Constructors 
      Constructor Description
      CleartextHttp2ServerUpgradeHandler​(io.netty5.handler.codec.http.HttpServerCodec httpServerCodec, io.netty5.handler.codec.http.HttpServerUpgradeHandler<?> httpServerUpgradeHandler, io.netty5.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.netty5.channel.ChannelHandlerContext ctx, io.netty5.buffer.Buffer in)
      Peek inbound message to determine current connection wants to start HTTP/2 by HTTP upgrade or prior knowledge
      void handlerAdded0​(io.netty5.channel.ChannelHandlerContext ctx)  
      • Methods inherited from class io.netty5.handler.codec.ByteToMessageDecoder

        actualReadableBytes, channelInactive, channelRead, channelReadComplete, channelShutdown, decodeLast, discardSomeReadBytes, handlerAdded, handlerRemoved, handlerRemoved0, internalBuffer, isSharable, isSingleDecode, setSingleDecode
      • Methods inherited from interface io.netty5.channel.ChannelHandler

        bind, channelActive, channelExceptionCaught, channelInboundEvent, channelRegistered, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, flush, pendingOutboundBytes, read, register, sendOutboundEvent, shutdown, write
    • Constructor Detail

      • CleartextHttp2ServerUpgradeHandler

        public CleartextHttp2ServerUpgradeHandler​(io.netty5.handler.codec.http.HttpServerCodec httpServerCodec,
                                                  io.netty5.handler.codec.http.HttpServerUpgradeHandler<?> httpServerUpgradeHandler,
                                                  io.netty5.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

      • handlerAdded0

        public void handlerAdded0​(io.netty5.channel.ChannelHandlerContext ctx)
                           throws Exception
        Overrides:
        handlerAdded0 in class io.netty5.handler.codec.ByteToMessageDecoder
        Throws:
        Exception
      • decode

        protected void decode​(io.netty5.channel.ChannelHandlerContext ctx,
                              io.netty5.buffer.Buffer in)
                       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.netty5.handler.codec.ByteToMessageDecoder
        Throws:
        Exception