Interface RequestHandler

All Known Implementing Classes:
NettyServerWebSocketUpgradeHandler, RoutingInBoundHandler

@Internal public interface RequestHandler
Handler for incoming requests.
Since:
4.0.0
Author:
Jonas Konrad
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accept(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpRequest request, ByteBody body, PipeliningServerHandler.OutboundAccess outboundAccess)
    Handle a request.
    void
    Handle an error that is not bound to a request, i.e.
    default void
    Called when the handler is removed.
    default void
    responseWritten(Object attachment)
    Called roughly when a response has been written.
  • Method Details

    • accept

      void accept(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpRequest request, ByteBody body, PipeliningServerHandler.OutboundAccess outboundAccess)
      Handle a request.
      Parameters:
      ctx - The context this request came in on
      request - The request line and headers
      body - The request body
      outboundAccess - The PipeliningServerHandler.OutboundAccess to use for writing the response
    • handleUnboundError

      void handleUnboundError(Throwable cause)
      Handle an error that is not bound to a request, i.e. happens outside a StreamedHttpRequest.
      Parameters:
      cause - The error
    • responseWritten

      default void responseWritten(Object attachment)
      Called roughly when a response has been written. In particular, it's called when the user is "done" with the response and has no way of adding further data. The bytes may not have been fully flushed yet, but e.g. the response Publisher has been fully consumed.
      This is used for cleaning up the request.
      Parameters:
      attachment - Object passed to PipeliningServerHandler.OutboundAccess.attachment(Object)
    • removed

      default void removed()
      Called when the handler is removed.