Package io.netty.handler.codec.http2
Class Http2StreamFrameToHttpObjectCodec
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.ChannelDuplexHandler
-
- io.netty.handler.codec.MessageToMessageCodec<Http2StreamFrame,io.netty.handler.codec.http.HttpObject>
-
- io.netty.handler.codec.http2.Http2StreamFrameToHttpObjectCodec
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,io.netty.channel.ChannelOutboundHandler
@Sharable public class Http2StreamFrameToHttpObjectCodec extends io.netty.handler.codec.MessageToMessageCodec<Http2StreamFrame,io.netty.handler.codec.http.HttpObject>
This handler converts fromHttp2StreamFrametoHttpObject, and back. It can be used as an adapter in conjunction withHttp2MultiplexCodecto make http/2 connections backward-compatible withChannelHandlers expectingHttpObjectFor simplicity, it converts to chunked encoding unless the entire stream is a single header.
-
-
Constructor Summary
Constructors Constructor Description Http2StreamFrameToHttpObjectCodec(boolean isServer)Http2StreamFrameToHttpObjectCodec(boolean isServer, boolean validateHeaders)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptInboundMessage(Object msg)protected voiddecode(io.netty.channel.ChannelHandlerContext ctx, Http2StreamFrame frame, List<Object> out)protected voidencode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpObject obj, List<Object> out)Encode from anHttpObjectto anHttp2StreamFrame.voidhandlerAdded(io.netty.channel.ChannelHandlerContext ctx)protected booleanisSsl(io.netty.channel.ChannelHandlerContext ctx)-
Methods inherited from class io.netty.handler.codec.MessageToMessageCodec
acceptOutboundMessage, channelRead, channelReadComplete, write
-
Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, flush, read
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerRemoved, isSharable
-
-
-
-
Method Detail
-
acceptInboundMessage
public boolean acceptInboundMessage(Object msg) throws Exception
- Overrides:
acceptInboundMessagein classio.netty.handler.codec.MessageToMessageCodec<Http2StreamFrame,io.netty.handler.codec.http.HttpObject>- Throws:
Exception
-
decode
protected void decode(io.netty.channel.ChannelHandlerContext ctx, Http2StreamFrame frame, List<Object> out) throws Exception- Specified by:
decodein classio.netty.handler.codec.MessageToMessageCodec<Http2StreamFrame,io.netty.handler.codec.http.HttpObject>- Throws:
Exception
-
encode
protected void encode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpObject obj, List<Object> out) throws ExceptionEncode 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 classio.netty.handler.codec.MessageToMessageCodec<Http2StreamFrame,io.netty.handler.codec.http.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
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) throws Exception- Specified by:
handlerAddedin interfaceio.netty.channel.ChannelHandler- Overrides:
handlerAddedin classio.netty.channel.ChannelHandlerAdapter- Throws:
Exception
-
isSsl
protected boolean isSsl(io.netty.channel.ChannelHandlerContext ctx)
-
-