Package io.netty5.handler.codec.http2
Class Http2StreamFrameToHttpObjectCodec
- java.lang.Object
-
- io.netty5.channel.ChannelHandlerAdapter
-
- io.netty5.handler.codec.MessageToMessageCodec<Http2StreamFrame,io.netty5.handler.codec.http.HttpObject>
-
- io.netty5.handler.codec.http2.Http2StreamFrameToHttpObjectCodec
-
- All Implemented Interfaces:
io.netty5.channel.ChannelHandler
@UnstableApi public class Http2StreamFrameToHttpObjectCodec extends io.netty5.handler.codec.MessageToMessageCodec<Http2StreamFrame,io.netty5.handler.codec.http.HttpObject>
This handler converts fromHttp2StreamFrametoHttpObject, and back. It can be used as an adapter in conjunction withHttp2MultiplexHandlerto 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 voiddecodeAndClose(io.netty5.channel.ChannelHandlerContext ctx, Http2StreamFrame frame)protected voidencodeAndClose(io.netty5.channel.ChannelHandlerContext ctx, io.netty5.handler.codec.http.HttpObject obj, List<Object> out)Encode from anHttpObjectto anHttp2StreamFrame.voidhandlerAdded(io.netty5.channel.ChannelHandlerContext ctx)booleanisSharable()protected booleanisSsl(io.netty5.channel.ChannelHandlerContext ctx)-
Methods inherited from class io.netty5.handler.codec.MessageToMessageCodec
acceptOutboundMessage, channelRead, decode, encode, write
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty5.channel.ChannelHandler
bind, channelActive, channelExceptionCaught, channelInactive, channelInboundEvent, channelReadComplete, channelRegistered, channelShutdown, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, flush, handlerRemoved, pendingOutboundBytes, read, register, sendOutboundEvent, shutdown
-
-
-
-
Method Detail
-
isSharable
public boolean isSharable()
-
acceptInboundMessage
public boolean acceptInboundMessage(Object msg) throws Exception
- Overrides:
acceptInboundMessagein classio.netty5.handler.codec.MessageToMessageCodec<Http2StreamFrame,io.netty5.handler.codec.http.HttpObject>- Throws:
Exception
-
decodeAndClose
protected void decodeAndClose(io.netty5.channel.ChannelHandlerContext ctx, Http2StreamFrame frame) throws Exception- Overrides:
decodeAndClosein classio.netty5.handler.codec.MessageToMessageCodec<Http2StreamFrame,io.netty5.handler.codec.http.HttpObject>- Throws:
Exception
-
encodeAndClose
protected void encodeAndClose(io.netty5.channel.ChannelHandlerContext ctx, io.netty5.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.- Overrides:
encodeAndClosein classio.netty5.handler.codec.MessageToMessageCodec<Http2StreamFrame,io.netty5.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.netty5.channel.ChannelHandlerContext ctx) throws Exception- Throws:
Exception
-
isSsl
protected boolean isSsl(io.netty5.channel.ChannelHandlerContext ctx)
-
-