Class RequestContextListener
- java.lang.Object
- org.springframework.web.context.request.RequestContextListener
- All Implemented Interfaces:
EventListener
,ServletRequestListener
public class RequestContextListener extends Object implements ServletRequestListener
Servlet listener that exposes the request to the current thread, through bothLocaleContextHolder
andRequestContextHolder
. To be registered as listener inweb.xml
.Alternatively, Spring's
RequestContextFilter
and Spring'sDispatcherServlet
also expose the same request context to the current thread. In contrast to this listener, advanced options are available there (e.g. "threadContextInheritable").This listener is mainly for use with third-party servlets, e.g. the JSF FacesServlet. Within Spring's own web support, DispatcherServlet's processing is perfectly sufficient.
- Since:
- 2.0
- Author:
- Juergen Hoeller
- See Also:
ServletRequestListener
,LocaleContextHolder
,RequestContextHolder
,RequestContextFilter
,DispatcherServlet
Constructor Summary
Constructors Constructor Description RequestContextListener()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
requestDestroyed(ServletRequestEvent requestEvent)
Receives notification that a ServletRequest is about to go out of scope of the web application.void
requestInitialized(ServletRequestEvent requestEvent)
Receives notification that a ServletRequest is about to come into scope of the web application.
Constructor Detail
RequestContextListener
public RequestContextListener()
Method Detail
requestInitialized
public void requestInitialized(ServletRequestEvent requestEvent)
Description copied from interface:javax.servlet.ServletRequestListener
Receives notification that a ServletRequest is about to come into scope of the web application.- Specified by:
requestInitialized
in interfaceServletRequestListener
- Parameters:
requestEvent
- the ServletRequestEvent containing the ServletRequest and the ServletContext representing the web application
requestDestroyed
public void requestDestroyed(ServletRequestEvent requestEvent)
Description copied from interface:javax.servlet.ServletRequestListener
Receives notification that a ServletRequest is about to go out of scope of the web application.- Specified by:
requestDestroyed
in interfaceServletRequestListener
- Parameters:
requestEvent
- the ServletRequestEvent containing the ServletRequest and the ServletContext representing the web application