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
HttpRequests and forwards them to a
RequestHandler.- Since:
- 4.0.0
- Author:
- Jonas Konrad
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classClass 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 booleancanHaveBody(io.netty.handler.codec.http.HttpResponseStatus status) voidchannelRead(@NonNull io.netty.channel.ChannelHandlerContext ctx, @NonNull Object msg) voidchannelReadComplete(io.netty.channel.ChannelHandlerContext ctx) voidchannelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) voidhandlerAdded(io.netty.channel.ChannelHandlerContext ctx) voidhandlerRemoved(io.netty.channel.ChannelHandlerContext ctx) After a call toGracefulShutdownCapable.shutdownGracefully()report the state of the shutdown.voidsetBodySizeLimits(BodySizeLimits bodySizeLimits) voidsetCompressionStrategy(HttpCompressionStrategy compressionStrategy) Trigger a graceful shutdown.voiduserEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelRegistered, channelUnregisteredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, isSharable
-
Constructor Details
-
PipeliningServerHandler
-
-
Method Details
-
setCompressionStrategy
-
setBodySizeLimits
-
canHaveBody
public static boolean canHaveBody(io.netty.handler.codec.http.HttpResponseStatus status) -
handlerAdded
- Specified by:
handlerAddedin interfaceio.netty.channel.ChannelHandler- Overrides:
handlerAddedin classio.netty.channel.ChannelHandlerAdapter- Throws:
Exception
-
handlerRemoved
- Specified by:
handlerRemovedin interfaceio.netty.channel.ChannelHandler- Overrides:
handlerRemovedin 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:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelReadComplete
- Specified by:
channelReadCompletein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadCompletein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception - Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelWritabilityChanged
- Specified by:
channelWritabilityChangedin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelWritabilityChangedin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception - Specified by:
userEventTriggeredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
userEventTriggeredin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
reportActiveTasks
Description copied from interface:GracefulShutdownCapableAfter 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:
reportActiveTasksin 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:GracefulShutdownCapableTrigger a graceful shutdown. The returnedCompletionStagewill 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:
shutdownGracefullyin interfaceGracefulShutdownCapable- Returns:
- A future that completes when this bean is fully shut down
-