Class Http3FrameToHttpObjectCodec
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.handler.codec.http3.Http3RequestStreamInboundHandler
io.netty.handler.codec.http3.Http3FrameToHttpObjectCodec
- All Implemented Interfaces:
ChannelHandler, ChannelInboundHandler, ChannelOutboundHandler
public final class Http3FrameToHttpObjectCodec
extends Http3RequestStreamInboundHandler
implements ChannelOutboundHandler
This handler converts from
Http3RequestStreamFrame to HttpObject,
and back. It can be used as an adapter in conjunction with Http3ServerConnectionHandler or Http3ClientConnectionHandler to make http/3 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.SharableModifier and TypeInterfaceDescriptionstatic @interfaceIndicates that the same instance of the annotatedChannelHandlercan be added to one or moreChannelPipelines multiple times without a race condition. -
Constructor Summary
ConstructorsConstructorDescriptionHttp3FrameToHttpObjectCodec(boolean isServer) Http3FrameToHttpObjectCodec(boolean isServer, boolean validateHeaders) -
Method Summary
Modifier and TypeMethodDescriptionvoidbind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) Called once a bind operation is made.protected voidCalled once the input is closed and so no more inbound data is received on it.protected voidchannelRead(ChannelHandlerContext ctx, Http3DataFrame frame) Called once aHttp3DataFrameis ready for this stream to process.protected voidchannelRead(ChannelHandlerContext ctx, Http3HeadersFrame frame) Called once aHttp3HeadersFrameis ready for this stream to process.voidclose(ChannelHandlerContext ctx, ChannelPromise promise) Called once a close operation is made.voidconnect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) Called once a connect operation is made.voidderegister(ChannelHandlerContext ctx, ChannelPromise promise) Called once a deregister operation is made from the current registeredEventLoop.voiddisconnect(ChannelHandlerContext ctx, ChannelPromise promise) Called once a disconnect operation is made.voidCalled once a flush operation is made.booleanReturntrueif the implementation isChannelHandler.Sharableand so can be added to differentChannelPipelines.voidInterceptsChannelHandlerContext.read().voidwrite(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) Encode from anHttpObjectto anHttp3RequestStreamFrame.Methods inherited from class Http3RequestStreamInboundHandler
channelRead, channelRead, controlStream, exceptionCaught, handleHttp3Exception, handleQuicException, userEventTriggeredModifier and TypeMethodDescriptionprotected voidchannelRead(ChannelHandlerContext ctx, Http3UnknownFrame frame) Called once aHttp3UnknownFrameis ready for this stream to process.final voidchannelRead(ChannelHandlerContext ctx, Object msg) CallsChannelHandlerContext.fireChannelRead(Object)to forward to the nextChannelInboundHandlerin theChannelPipeline.protected final @Nullable QuicStreamChannelReturn the local control stream for this HTTP/3 connection.voidexceptionCaught(ChannelHandlerContext ctx, Throwable cause) CallsChannelHandlerContext.fireExceptionCaught(Throwable)to forward to the nextChannelHandlerin theChannelPipeline.protected voidhandleHttp3Exception(ChannelHandlerContext ctx, Http3Exception exception) Called once aHttp3Exceptionshould be handled.protected voidhandleQuicException(ChannelHandlerContext ctx, QuicException exception) Called once aQuicExceptionshould be handled.voiduserEventTriggered(ChannelHandlerContext ctx, Object evt) CallsChannelHandlerContext.fireUserEventTriggered(Object)to forward to the nextChannelInboundHandlerin theChannelPipeline.Methods inherited from class ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChangedModifier and TypeMethodDescriptionvoidCallsChannelHandlerContext.fireChannelActive()to forward to the nextChannelInboundHandlerin theChannelPipeline.voidCallsChannelHandlerContext.fireChannelInactive()to forward to the nextChannelInboundHandlerin theChannelPipeline.voidCallsChannelHandlerContext.fireChannelReadComplete()to forward to the nextChannelInboundHandlerin theChannelPipeline.voidCallsChannelHandlerContext.fireChannelRegistered()to forward to the nextChannelInboundHandlerin theChannelPipeline.voidCallsChannelHandlerContext.fireChannelUnregistered()to forward to the nextChannelInboundHandlerin theChannelPipeline.voidCallsChannelHandlerContext.fireChannelWritabilityChanged()to forward to the nextChannelInboundHandlerin theChannelPipeline.Methods inherited from class ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemovedModifier and TypeMethodDescriptionprotected voidvoidDo nothing by default, sub-classes may override this method.voidDo nothing by default, sub-classes may override this method.
-
Constructor Details
-
Http3FrameToHttpObjectCodec
public Http3FrameToHttpObjectCodec(boolean isServer, boolean validateHeaders) -
Http3FrameToHttpObjectCodec
public Http3FrameToHttpObjectCodec(boolean isServer)
-
-
Method Details
-
isSharable
public boolean isSharable()Description copied from class:ChannelHandlerAdapterReturntrueif the implementation isChannelHandler.Sharableand so can be added to differentChannelPipelines.- Overrides:
isSharablein classChannelHandlerAdapter
-
channelRead
Description copied from class:Http3RequestStreamInboundHandlerCalled once aHttp3HeadersFrameis ready for this stream to process.- Specified by:
channelReadin classHttp3RequestStreamInboundHandler- Parameters:
ctx- theChannelHandlerContextof this handler.frame- theHttp3HeadersFramethat was read- Throws:
Exception- thrown if an error happens during processing.
-
channelRead
Description copied from class:Http3RequestStreamInboundHandlerCalled once aHttp3DataFrameis ready for this stream to process.- Specified by:
channelReadin classHttp3RequestStreamInboundHandler- Parameters:
ctx- theChannelHandlerContextof this handler.frame- theHttp3DataFramethat was read- Throws:
Exception- thrown if an error happens during processing.
-
channelInputClosed
Description copied from class:Http3RequestStreamInboundHandlerCalled once the input is closed and so no more inbound data is received on it.- Specified by:
channelInputClosedin classHttp3RequestStreamInboundHandler- Parameters:
ctx- theChannelHandlerContextof this handler.- Throws:
Exception- thrown if an error happens during processing.
-
write
Encode from anHttpObjectto anHttp3RequestStreamFrame. 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:
writein interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextwhich this handler belongs tomsg- theHttpObjectmessage to encodepromise- theChannelPromiseto notify once the operation completes- Throws:
Exception- is thrown if an error occurs
-
flush
Description copied from interface:ChannelOutboundHandlerCalled once a flush operation is made. The flush operation will try to flush out all previous written messages that are pending.- Specified by:
flushin interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the flush operation is made
-
bind
Description copied from interface:ChannelOutboundHandlerCalled once a bind operation is made.- Specified by:
bindin interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the bind operation is madelocalAddress- theSocketAddressto which it should boundpromise- theChannelPromiseto notify once the operation completes
-
connect
public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) Description copied from interface:ChannelOutboundHandlerCalled once a connect operation is made.- Specified by:
connectin interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the connect operation is maderemoteAddress- theSocketAddressto which it should connectlocalAddress- theSocketAddresswhich is used as source on connectpromise- theChannelPromiseto notify once the operation completes
-
disconnect
Description copied from interface:ChannelOutboundHandlerCalled once a disconnect operation is made.- Specified by:
disconnectin interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the disconnect operation is madepromise- theChannelPromiseto notify once the operation completes
-
close
Description copied from interface:ChannelOutboundHandlerCalled once a close operation is made.- Specified by:
closein interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the close operation is madepromise- theChannelPromiseto notify once the operation completes
-
deregister
Description copied from interface:ChannelOutboundHandlerCalled once a deregister operation is made from the current registeredEventLoop.- Specified by:
deregisterin interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the close operation is madepromise- theChannelPromiseto notify once the operation completes
-
read
Description copied from interface:ChannelOutboundHandlerInterceptsChannelHandlerContext.read().- Specified by:
readin interfaceChannelOutboundHandler- Throws:
Exception
-