Package io.netty.handler.codec.http3
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 fromHttp3RequestStreamFrametoHttpObject, and back. It can be used as an adapter in conjunction withHttp3ServerConnectionHandlerorHttp3ClientConnectionHandlerto make http/3 connections backward-compatible withChannelHandlers expectingHttpObject.For simplicity, it converts to chunked encoding unless the entire stream is a single header.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Constructor Summary
Constructors Constructor Description Http3FrameToHttpObjectCodec(boolean isServer)Http3FrameToHttpObjectCodec(boolean isServer, boolean validateHeaders)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind(ChannelHandlerContext ctx, java.net.SocketAddress localAddress, ChannelPromise promise)Called once a bind operation is made.protected voidchannelInputClosed(ChannelHandlerContext ctx)Called 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, java.net.SocketAddress remoteAddress, java.net.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.voidflush(ChannelHandlerContext ctx)Called once a flush operation is made.booleanisSharable()Returntrueif the implementation isChannelHandler.Sharableand so can be added to differentChannelPipelines.voidread(ChannelHandlerContext ctx)InterceptsChannelHandlerContext.read().voidwrite(ChannelHandlerContext ctx, java.lang.Object msg, ChannelPromise promise)Encode from anHttpObjectto anHttp3RequestStreamFrame.-
Methods inherited from class io.netty.handler.codec.http3.Http3RequestStreamInboundHandler
channelRead, channelRead, controlStream, exceptionCaught, handleHttp3Exception, handleQuicException, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
-
-
-
Method Detail
-
isSharable
public boolean isSharable()
Description copied from class:ChannelHandlerAdapterReturntrueif the implementation isChannelHandler.Sharableand so can be added to differentChannelPipelines.- Overrides:
isSharablein classChannelHandlerAdapter
-
channelRead
protected void channelRead(ChannelHandlerContext ctx, Http3HeadersFrame frame) throws java.lang.Exception
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:
java.lang.Exception- thrown if an error happens during processing.
-
channelRead
protected void channelRead(ChannelHandlerContext ctx, Http3DataFrame frame) throws java.lang.Exception
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:
java.lang.Exception- thrown if an error happens during processing.
-
channelInputClosed
protected void channelInputClosed(ChannelHandlerContext ctx) throws java.lang.Exception
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:
java.lang.Exception- thrown if an error happens during processing.
-
write
public void write(ChannelHandlerContext ctx, java.lang.Object msg, ChannelPromise promise) throws java.lang.Exception
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:
java.lang.Exception- is thrown if an error occurs
-
flush
public void flush(ChannelHandlerContext ctx)
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
public void bind(ChannelHandlerContext ctx, java.net.SocketAddress localAddress, ChannelPromise promise)
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, java.net.SocketAddress remoteAddress, java.net.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
public void disconnect(ChannelHandlerContext ctx, ChannelPromise promise)
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
public void close(ChannelHandlerContext ctx, ChannelPromise promise)
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
public void deregister(ChannelHandlerContext ctx, ChannelPromise promise)
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
public void read(ChannelHandlerContext ctx) throws java.lang.Exception
Description copied from interface:ChannelOutboundHandlerInterceptsChannelHandlerContext.read().- Specified by:
readin interfaceChannelOutboundHandler- Throws:
java.lang.Exception
-
-