Package io.netty.handler.codec.http2
Class CleartextHttp2ServerUpgradeHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.handler.codec.ByteToMessageDecoder
io.netty.handler.codec.http2.CleartextHttp2ServerUpgradeHandler
- All Implemented Interfaces:
ChannelHandler
,ChannelInboundHandler
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 ClassesModifier and TypeClassDescriptionstatic final class
User event that is fired to notify about HTTP/2 protocol is started.Nested classes/interfaces inherited from class io.netty.handler.codec.ByteToMessageDecoder
ByteToMessageDecoder.Cumulator
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ByteBuf
private final ChannelHandler
private final HttpServerCodec
private final HttpServerUpgradeHandler
Fields inherited from class io.netty.handler.codec.ByteToMessageDecoder
COMPOSITE_CUMULATOR, MERGE_CUMULATOR
-
Constructor Summary
ConstructorsConstructorDescriptionCleartextHttp2ServerUpgradeHandler
(HttpServerCodec httpServerCodec, HttpServerUpgradeHandler httpServerUpgradeHandler, ChannelHandler http2ServerHandler) Creates the channel handler provide cleartext HTTP/2 upgrade from HTTP upgrade or prior knowledge -
Method Summary
Modifier and TypeMethodDescriptionprotected void
decode
(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) Peek inbound message to determine current connection wants to start HTTP/2 by HTTP upgrade or prior knowledgevoid
Do nothing by default, sub-classes may override this method.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
-
Field Details
-
CONNECTION_PREFACE
-
httpServerCodec
-
httpServerUpgradeHandler
-
http2ServerHandler
-
-
Constructor Details
-
CleartextHttp2ServerUpgradeHandler
public CleartextHttp2ServerUpgradeHandler(HttpServerCodec httpServerCodec, HttpServerUpgradeHandler httpServerUpgradeHandler, ChannelHandler http2ServerHandler) Creates the channel handler provide cleartext HTTP/2 upgrade from HTTP upgrade or prior knowledge- Parameters:
httpServerCodec
- the http server codechttpServerUpgradeHandler
- the http server upgrade handler for HTTP/2http2ServerHandler
- the http2 server handler, will be added into pipeline when starting HTTP/2 by prior knowledge
-
-
Method Details
-
handlerAdded
Description copied from class:ChannelHandlerAdapter
Do nothing by default, sub-classes may override this method.- Specified by:
handlerAdded
in interfaceChannelHandler
- Overrides:
handlerAdded
in classChannelHandlerAdapter
- Throws:
Exception
-
decode
Peek inbound message to determine current connection wants to start HTTP/2 by HTTP upgrade or prior knowledge- Specified by:
decode
in classByteToMessageDecoder
- Parameters:
ctx
- theChannelHandlerContext
which thisByteToMessageDecoder
belongs toin
- theByteBuf
from which to read dataout
- theList
to which decoded messages should be added- Throws:
Exception
- is thrown if an error occurs
-