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 fromHttp3RequestStreamFrame
toHttpObject
, and back. It can be used as an adapter in conjunction withHttp3ServerConnectionHandler
orHttp3ClientConnectionHandler
to make http/3 connections backward-compatible withChannelHandler
s 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 void
bind(ChannelHandlerContext ctx, java.net.SocketAddress localAddress, ChannelPromise promise)
Called once a bind operation is made.protected void
channelInputClosed(ChannelHandlerContext ctx)
Called once the input is closed and so no more inbound data is received on it.protected void
channelRead(ChannelHandlerContext ctx, Http3DataFrame frame)
Called once aHttp3DataFrame
is ready for this stream to process.protected void
channelRead(ChannelHandlerContext ctx, Http3HeadersFrame frame)
Called once aHttp3HeadersFrame
is ready for this stream to process.void
close(ChannelHandlerContext ctx, ChannelPromise promise)
Called once a close operation is made.void
connect(ChannelHandlerContext ctx, java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise)
Called once a connect operation is made.void
deregister(ChannelHandlerContext ctx, ChannelPromise promise)
Called once a deregister operation is made from the current registeredEventLoop
.void
disconnect(ChannelHandlerContext ctx, ChannelPromise promise)
Called once a disconnect operation is made.void
flush(ChannelHandlerContext ctx)
Called once a flush operation is made.boolean
isSharable()
Returntrue
if the implementation isChannelHandler.Sharable
and so can be added to differentChannelPipeline
s.void
read(ChannelHandlerContext ctx)
InterceptsChannelHandlerContext.read()
.void
write(ChannelHandlerContext ctx, java.lang.Object msg, ChannelPromise promise)
Encode from anHttpObject
to 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:ChannelHandlerAdapter
Returntrue
if the implementation isChannelHandler.Sharable
and so can be added to differentChannelPipeline
s.- Overrides:
isSharable
in classChannelHandlerAdapter
-
channelRead
protected void channelRead(ChannelHandlerContext ctx, Http3HeadersFrame frame) throws java.lang.Exception
Description copied from class:Http3RequestStreamInboundHandler
Called once aHttp3HeadersFrame
is ready for this stream to process.- Specified by:
channelRead
in classHttp3RequestStreamInboundHandler
- Parameters:
ctx
- theChannelHandlerContext
of this handler.frame
- theHttp3HeadersFrame
that 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:Http3RequestStreamInboundHandler
Called once aHttp3DataFrame
is ready for this stream to process.- Specified by:
channelRead
in classHttp3RequestStreamInboundHandler
- Parameters:
ctx
- theChannelHandlerContext
of this handler.frame
- theHttp3DataFrame
that 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:Http3RequestStreamInboundHandler
Called once the input is closed and so no more inbound data is received on it.- Specified by:
channelInputClosed
in classHttp3RequestStreamInboundHandler
- Parameters:
ctx
- theChannelHandlerContext
of 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 anHttpObject
to anHttp3RequestStreamFrame
. This method will be called for each written message that can be handled by this encoder. NOTE: 100-Continue responses that are NOTFullHttpResponse
will be rejected.- Specified by:
write
in interfaceChannelOutboundHandler
- Parameters:
ctx
- theChannelHandlerContext
which this handler belongs tomsg
- theHttpObject
message to encodepromise
- theChannelPromise
to 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:ChannelOutboundHandler
Called once a flush operation is made. The flush operation will try to flush out all previous written messages that are pending.- Specified by:
flush
in interfaceChannelOutboundHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the flush operation is made
-
bind
public void bind(ChannelHandlerContext ctx, java.net.SocketAddress localAddress, ChannelPromise promise)
Description copied from interface:ChannelOutboundHandler
Called once a bind operation is made.- Specified by:
bind
in interfaceChannelOutboundHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the bind operation is madelocalAddress
- theSocketAddress
to which it should boundpromise
- theChannelPromise
to 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:ChannelOutboundHandler
Called once a connect operation is made.- Specified by:
connect
in interfaceChannelOutboundHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the connect operation is maderemoteAddress
- theSocketAddress
to which it should connectlocalAddress
- theSocketAddress
which is used as source on connectpromise
- theChannelPromise
to notify once the operation completes
-
disconnect
public void disconnect(ChannelHandlerContext ctx, ChannelPromise promise)
Description copied from interface:ChannelOutboundHandler
Called once a disconnect operation is made.- Specified by:
disconnect
in interfaceChannelOutboundHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the disconnect operation is madepromise
- theChannelPromise
to notify once the operation completes
-
close
public void close(ChannelHandlerContext ctx, ChannelPromise promise)
Description copied from interface:ChannelOutboundHandler
Called once a close operation is made.- Specified by:
close
in interfaceChannelOutboundHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the close operation is madepromise
- theChannelPromise
to notify once the operation completes
-
deregister
public void deregister(ChannelHandlerContext ctx, ChannelPromise promise)
Description copied from interface:ChannelOutboundHandler
Called once a deregister operation is made from the current registeredEventLoop
.- Specified by:
deregister
in interfaceChannelOutboundHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the close operation is madepromise
- theChannelPromise
to notify once the operation completes
-
read
public void read(ChannelHandlerContext ctx) throws java.lang.Exception
Description copied from interface:ChannelOutboundHandler
InterceptsChannelHandlerContext.read()
.- Specified by:
read
in interfaceChannelOutboundHandler
- Throws:
java.lang.Exception
-
-