Class PipeliningServerHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.micronaut.http.server.netty.handler.PipeliningServerHandler
- All Implemented Interfaces:
GracefulShutdownCapable
,io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
@Internal
public final class PipeliningServerHandler
extends io.netty.channel.ChannelInboundHandlerAdapter
implements GracefulShutdownCapable
Netty handler that handles incoming
HttpRequest
s and forwards them to a
RequestHandler
.- Since:
- 4.0.0
- Author:
- Jonas Konrad
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal class
Class that allows writing the response for the request this object is associated with.Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
canHaveBody
(io.netty.handler.codec.http.HttpResponseStatus status) void
channelRead
(@NonNull io.netty.channel.ChannelHandlerContext ctx, @NonNull Object msg) void
channelReadComplete
(io.netty.channel.ChannelHandlerContext ctx) void
channelWritabilityChanged
(io.netty.channel.ChannelHandlerContext ctx) void
exceptionCaught
(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) void
handlerAdded
(io.netty.channel.ChannelHandlerContext ctx) void
handlerRemoved
(io.netty.channel.ChannelHandlerContext ctx) After a call toGracefulShutdownCapable.shutdownGracefully()
report the state of the shutdown.void
setBodySizeLimits
(BodySizeLimits bodySizeLimits) void
setCompressionStrategy
(HttpCompressionStrategy compressionStrategy) void
setRequestDecompressionEnabled
(boolean requestDecompressionEnabled) Enable or disable automatic request content decompression in the Netty HTTP server.Trigger a graceful shutdown.void
userEventTriggered
(io.netty.channel.ChannelHandlerContext ctx, Object evt) Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelRegistered, channelUnregistered
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, isSharable
-
Constructor Details
-
PipeliningServerHandler
-
-
Method Details
-
setCompressionStrategy
-
setBodySizeLimits
-
setRequestDecompressionEnabled
public void setRequestDecompressionEnabled(boolean requestDecompressionEnabled) Enable or disable automatic request content decompression in the Netty HTTP server. When disabled, the server will not decode Content-Encoding or Transfer-Encoding on requests and will pass the compressed body and headers through unchanged. Default: true.- Parameters:
requestDecompressionEnabled
- true to enable decompression, false to disable it
-
canHaveBody
public static boolean canHaveBody(io.netty.handler.codec.http.HttpResponseStatus status) -
handlerAdded
- Specified by:
handlerAdded
in interfaceio.netty.channel.ChannelHandler
- Overrides:
handlerAdded
in classio.netty.channel.ChannelHandlerAdapter
- Throws:
Exception
-
handlerRemoved
- Specified by:
handlerRemoved
in interfaceio.netty.channel.ChannelHandler
- Overrides:
handlerRemoved
in classio.netty.channel.ChannelHandlerAdapter
- Throws:
Exception
-
channelRead
public void channelRead(@NonNull @NonNull io.netty.channel.ChannelHandlerContext ctx, @NonNull @NonNull Object msg) throws Exception - Specified by:
channelRead
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelRead
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
channelReadComplete
- Specified by:
channelReadComplete
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelReadComplete
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception - Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelHandler
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
exceptionCaught
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
channelWritabilityChanged
- Specified by:
channelWritabilityChanged
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelWritabilityChanged
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception - Specified by:
userEventTriggered
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
userEventTriggered
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
reportActiveTasks
Description copied from interface:GracefulShutdownCapable
After a call toGracefulShutdownCapable.shutdownGracefully()
report the state of the shutdown. IfGracefulShutdownCapable.shutdownGracefully()
has not been called the behavior of this method is undefined.- Specified by:
reportActiveTasks
in interfaceGracefulShutdownCapable
- Returns:
- The current number of still-active tasks before the shutdown completes, or
Optional.empty()
if no state can be reported
-
shutdownGracefully
Description copied from interface:GracefulShutdownCapable
Trigger a graceful shutdown. The returnedCompletionStage
will complete when the shutdown is complete.Note that the completion of the returned future may be user-dependent. If a user does not close their connection, the future may never terminate. Always add a timeout for a hard shutdown.
This method should not throw an exception, nor should the returned stage complete exceptionally. Just log an error instead.
- Specified by:
shutdownGracefully
in interfaceGracefulShutdownCapable
- Returns:
- A future that completes when this bean is fully shut down
-