Class Http2StreamFrameToHttpObjectCodec
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
io.netty.handler.codec.MessageToMessageCodec<Http2StreamFrame, HttpObject>
io.netty.handler.codec.http2.Http2StreamFrameToHttpObjectCodec
- All Implemented Interfaces:
ChannelHandler, ChannelInboundHandler, ChannelOutboundHandler
@Sharable
public class Http2StreamFrameToHttpObjectCodec
extends MessageToMessageCodec<Http2StreamFrame, HttpObject>
This handler converts from
Http2StreamFrame to HttpObject,
and back. It can be used as an adapter in conjunction with Http2MultiplexCodec to make http/2 connections backward-compatible with
ChannelHandlers expecting HttpObject
For simplicity, it converts to chunked encoding unless the entire stream
is a single header.-
Nested Class Summary
Nested classes/interfaces inherited from interface ChannelHandler
ChannelHandler.Sharable -
Constructor Summary
ConstructorsConstructorDescriptionHttp2StreamFrameToHttpObjectCodec(boolean isServer) Http2StreamFrameToHttpObjectCodec(boolean isServer, boolean validateHeaders) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif and only if the specified message can be decoded by this codec.protected voiddecode(ChannelHandlerContext ctx, Http2StreamFrame frame, List<Object> out) protected voidencode(ChannelHandlerContext ctx, HttpObject obj, List<Object> out) Encode from anHttpObjectto anHttp2StreamFrame.voidDo nothing by default, sub-classes may override this method.protected booleanMethods inherited from class MessageToMessageCodec
acceptOutboundMessage, channelRead, channelReadComplete, writeMethods inherited from class ChannelDuplexHandler
bind, close, connect, deregister, disconnect, flush, readMethods inherited from class ChannelInboundHandlerAdapter
channelActive, channelInactive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredMethods inherited from class ChannelHandlerAdapter
ensureNotSharable, handlerRemoved, isSharableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChannelHandler
handlerRemoved
-
Constructor Details
-
Http2StreamFrameToHttpObjectCodec
public Http2StreamFrameToHttpObjectCodec(boolean isServer, boolean validateHeaders) -
Http2StreamFrameToHttpObjectCodec
public Http2StreamFrameToHttpObjectCodec(boolean isServer)
-
-
Method Details
-
acceptInboundMessage
Description copied from class:MessageToMessageCodecReturnstrueif and only if the specified message can be decoded by this codec.- Overrides:
acceptInboundMessagein classMessageToMessageCodec<Http2StreamFrame, HttpObject>- Parameters:
msg- the message- Throws:
Exception
-
decode
protected void decode(ChannelHandlerContext ctx, Http2StreamFrame frame, List<Object> out) throws Exception - Specified by:
decodein classMessageToMessageCodec<Http2StreamFrame, HttpObject>- Throws:
Exception- See Also:
-
encode
Encode from anHttpObjectto anHttp2StreamFrame. This method will be called for each written message that can be handled by this encoder. NOTE: 100-Continue responses that are NOTFullHttpResponsewill be rejected.- Specified by:
encodein classMessageToMessageCodec<Http2StreamFrame, HttpObject>- Parameters:
ctx- theChannelHandlerContextwhich this handler belongs toobj- theHttpObjectmessage to encodeout- theListinto which the encoded msg should be added needs to do some kind of aggregation- Throws:
Exception- is thrown if an error occurs- See Also:
-
handlerAdded
Description copied from class:ChannelHandlerAdapterDo nothing by default, sub-classes may override this method.- Specified by:
handlerAddedin interfaceChannelHandler- Overrides:
handlerAddedin classChannelHandlerAdapter- Throws:
Exception
-
isSsl
-