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
  • Constructor Details

    • PipeliningServerHandler

      public PipeliningServerHandler(RequestHandler requestHandler)
  • Method Details

    • setCompressionStrategy

      public void setCompressionStrategy(HttpCompressionStrategy compressionStrategy)
    • setBodySizeLimits

      public void setBodySizeLimits(BodySizeLimits bodySizeLimits)
    • canHaveBody

      public static boolean canHaveBody(io.netty.handler.codec.http.HttpResponseStatus status)
    • handlerAdded

      public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      handlerAdded in interface io.netty.channel.ChannelHandler
      Overrides:
      handlerAdded in class io.netty.channel.ChannelHandlerAdapter
      Throws:
      Exception
    • handlerRemoved

      public void handlerRemoved(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      handlerRemoved in interface io.netty.channel.ChannelHandler
      Overrides:
      handlerRemoved in class io.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 interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelRead in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • channelReadComplete

      public void channelReadComplete(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      channelReadComplete in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelReadComplete in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • exceptionCaught

      public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelHandler
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      exceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • channelWritabilityChanged

      public void channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      channelWritabilityChanged in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelWritabilityChanged in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • userEventTriggered

      public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception
      Specified by:
      userEventTriggered in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      userEventTriggered in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • reportActiveTasks

      public OptionalLong reportActiveTasks()
      Description copied from interface: GracefulShutdownCapable
      After a call to GracefulShutdownCapable.shutdownGracefully() report the state of the shutdown. If GracefulShutdownCapable.shutdownGracefully() has not been called the behavior of this method is undefined.
      Specified by:
      reportActiveTasks in interface GracefulShutdownCapable
      Returns:
      The current number of still-active tasks before the shutdown completes, or Optional.empty() if no state can be reported
    • shutdownGracefully

      public CompletionStage<?> shutdownGracefully()
      Description copied from interface: GracefulShutdownCapable
      Trigger a graceful shutdown. The returned CompletionStage 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 interface GracefulShutdownCapable
      Returns:
      A future that completes when this bean is fully shut down