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:
- Parse the request and prepare the environment for the given web application as usually.
- Invoke
fireRawRequest(RebelServletContext, Object, Object) - If
falseis received do the following:- Invoke
fireBeforeRequest(RebelServletContext). - Handle the request as usually by executing a Filter chain or a Servlet directly.
- Invoke
fireRequestFinally(RebelServletContext)(even if an error occurred).
- Invoke
- Finish processing the request as usually.
- Author:
- Igor Malinin, Rein Raudjärv
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddRequestListener(org.zeroturnaround.javarebel.RebelServletContext context, RequestListener listener) Add a request listener for a web application.voidaddRequestListener(RequestListener listener) Add a global request listener.voidfireBeforeRequest(org.zeroturnaround.javarebel.RebelServletContext context) This must be called before the server handles an HTTP request.booleanfireRawRequest(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.voidfireRequestFinally(org.zeroturnaround.javarebel.RebelServletContext context) This must be called at the end of the request (even if an exception occurred).voidremoveRequestListener(org.zeroturnaround.javarebel.RebelServletContext context, RequestListener listener) Remove a request listener of a web application.voidremoveRequestListener(RequestListener listener) 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
requestandresponseobjects must be valid and ready to be used for rendering content, redirecting the request etc.This method must be invoked before any
javax.servlet.Filterorjavax.servlet.Servletis invoked.If
trueis returned the server itself must not manage this request. In this casefireBeforeRequest(RebelServletContext)andfireRequestFinally(RebelServletContext)must not be called also.- Parameters:
context- the servlet context of this web application.request- an instance ofjavax.servlet.http.HttpServletRequest.response- an instance ofjavax.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.Filterorjavax.servlet.Servletis 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 correspondingAccessControlContextmust 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 addcontext- 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 removecontext- the servlet context of this web application.- Since:
- 3.6
-
addRequestListener
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
Remove a global or a web application(s) specific request listener.- Parameters:
listener- the listener to remove- Since:
- 3.6
-