Interface RequestIntegration


public interface RequestIntegration

Provides notification services for request/response based containers. To use acquire an instance from the RequestIntegrationFactory.

The life-cycle of executing requests on any servers should be the following:

  1. Parse the request and prepare the environment for the given web application as usually.
  2. Invoke fireRawRequest(RebelServletContext, Object, Object)
  3. If false is received do the following:
    1. Invoke fireBeforeRequest(RebelServletContext).
    2. Handle the request as usually by executing a Filter chain or a Servlet directly.
    3. Invoke fireRequestFinally(RebelServletContext) (even if an error occurred).
  4. Finish processing the request as usually.
Author:
Igor Malinin, Rein Raudjärv
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addRequestListener(org.zeroturnaround.javarebel.RebelServletContext context, RequestListener listener)
    Add a request listener for a web application.
    void
    Add a global request listener.
    void
    fireBeforeRequest(org.zeroturnaround.javarebel.RebelServletContext context)
    This must be called before the server handles an HTTP request.
    boolean
    fireRawRequest(org.zeroturnaround.javarebel.RebelServletContext context, Object request, Object response)
    This must be called before the server handles an HTTP request to give a chance to request listeners to fully manage this request.
    void
    fireRequestFinally(org.zeroturnaround.javarebel.RebelServletContext context)
    This must be called at the end of the request (even if an exception occurred).
    void
    removeRequestListener(org.zeroturnaround.javarebel.RebelServletContext context, RequestListener listener)
    Remove a request listener of a web application.
    void
    Remove a global or a web application(s) specific request listener.
  • Method Details

    • fireRawRequest

      boolean fireRawRequest(org.zeroturnaround.javarebel.RebelServletContext context, Object request, Object response)
      This must be called before the server handles an HTTP request to give a chance to request listeners to fully manage this request.

      The request and response objects must be valid and ready to be used for rendering content, redirecting the request etc.

      This method must be invoked before any javax.servlet.Filter or javax.servlet.Servlet is invoked.

      If true is returned the server itself must not manage this request. In this case fireBeforeRequest(RebelServletContext) and fireRequestFinally(RebelServletContext) must not be called also.

      Parameters:
      context - the servlet context of this web application.
      request - an instance of javax.servlet.http.HttpServletRequest.
      response - an instance of javax.servlet.http.HttpServletResponse.
      Returns:
      true if any request listener has managed this request.
      Since:
      3.6
    • fireBeforeRequest

      void fireBeforeRequest(org.zeroturnaround.javarebel.RebelServletContext context)
      This must be called before the server handles an HTTP request.

      It must be also invoked before any javax.servlet.Filter or javax.servlet.Servlet is invoked. However the environment of the given web application must be active. E.g. Thread.currentThread().getContextClassLoader() must return the application class loader. In secure environments the corresponding AccessControlContext must be set etc.


      This must only be called if no request listener has managed this request.
      Parameters:
      context - the servlet context of this web application.
      Since:
      3.6
    • fireRequestFinally

      void fireRequestFinally(org.zeroturnaround.javarebel.RebelServletContext context)
      This must be called at the end of the request (even if an exception occurred).

      This must only be called if no request listener has managed this request.

      Parameters:
      context - the servlet context of this web application.
      Since:
      3.6
    • addRequestListener

      void addRequestListener(org.zeroturnaround.javarebel.RebelServletContext context, RequestListener listener)
      Add a request listener for a web application.
      Parameters:
      listener - the listener to add
      context - the servlet context of this web application.
      Since:
      3.6
    • removeRequestListener

      void removeRequestListener(org.zeroturnaround.javarebel.RebelServletContext context, RequestListener listener)
      Remove a request listener of a web application.
      Parameters:
      listener - the listener to remove
      context - the servlet context of this web application.
      Since:
      3.6
    • addRequestListener

      void addRequestListener(RequestListener listener)
      Add a global request listener.

      Global request listeners are invoked before web application specific listeners.

      Parameters:
      listener - the listener to add
      Since:
      3.6
    • removeRequestListener

      void removeRequestListener(RequestListener listener)
      Remove a global or a web application(s) specific request listener.
      Parameters:
      listener - the listener to remove
      Since:
      3.6