Package org.springframework.web.context.request

# Class RequestContextListener

java.lang.Object
org.springframework.web.context.request.RequestContextListener

All Implemented Interfaces:
  `ServletRequestListener`, `EventListener`

public class RequestContextListener extends Object implements ServletRequestListener
Servlet listener that exposes the request to the current thread, through both `LocaleContextHolder` and `RequestContextHolder`. To be registered as listener in `web.xml`.

Alternatively, Spring's `RequestContextFilter` and Spring's `org.springframework.web.servlet.DispatcherServlet` also expose the same request context to the current thread. In contrast to this listener, advanced options are available there (for example, "threadContextInheritable").

This listener is mainly for use with third-party servlets, for example, 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`
  - `org.springframework.web.servlet.DispatcherServlet`

## Constructor Summary

Constructors
Constructor
Description
`RequestContextListener()`

## Method Summary

Modifier and Type
Method
Description
`void`
`requestDestroyed(ServletRequestEvent requestEvent)`
`void`
`requestInitialized(ServletRequestEvent requestEvent)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### RequestContextListener

public RequestContextListener()

## Method Details

### requestInitialized

public void requestInitialized(ServletRequestEvent requestEvent)

Specified by:
  `requestInitialized` in interface `ServletRequestListener`

### requestDestroyed

public void requestDestroyed(ServletRequestEvent requestEvent)

Specified by:
  `requestDestroyed` in interface `ServletRequestListener`