Interface RequestListener


  • public interface RequestListener
    An HTTP request listener.
    Since:
    3.6
    Author:
    Rein Raudjärv
    See Also:
    RequestIntegration
    • Method Summary

      All Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default void beforeRequest()
      Called before the server handles an HTTP request.
      default int priority()
      Returns the priority of the listener that defines the order of listener invocation.
      default boolean rawRequest​(Object context, Object request, Object response)
      Give a chance to this listener to fully manage this request.
      default void requestFinally()
      Called at the end of the request (even if an exception occurred).
    • Method Detail

      • rawRequest

        default boolean rawRequest​(Object context,
                                   Object request,
                                   Object response)
                            throws Exception
        Give a chance to this listener to fully manage this request.

        If true is returned neither the server itself nor any other request listener have a chance to manage this request.

        Any exceptions will be caught and logged to the standard output.

        Parameters:
        context - an instance of org.zeroturnaround.javarebel.RebelServletContext.
        request - an instance of javax.servlet.http.HttpServletRequest.
        response - an instance of javax.servlet.http.HttpServletResponse.
        Returns:
        true if this listener has managed this request.
        Throws:
        Exception
      • beforeRequest

        default void beforeRequest()
                            throws Exception
        Called before the server handles an HTTP request.

        Only called if no listener managed this request.

        Any exceptions will be caught and logged to the standard output.

        Throws:
        Exception
      • requestFinally

        default void requestFinally()
                             throws Exception
        Called at the end of the request (even if an exception occurred).

        Only called if no listener managed this request.

        Any exceptions will be caught and logged to the standard output.

        Throws:
        Exception
      • priority

        default int priority()
        Returns the priority of the listener that defines the order of listener invocation. First run the listener with greatest priority value. Negative values are the latest.