The Spring Framework

org.springframework.web.filter
Class RequestContextFilter

java.lang.Object
  extended by org.springframework.web.filter.GenericFilterBean
      extended by org.springframework.web.filter.OncePerRequestFilter
          extended by org.springframework.web.filter.RequestContextFilter
All Implemented Interfaces:
Filter, BeanNameAware, DisposableBean, InitializingBean, ServletContextAware

public class RequestContextFilter
extends OncePerRequestFilter

Servlet filter that exposes the request to the current thread, through both LocaleContextHolder and RequestContextHolder.

Useful for application objects that need access to the current request. Does not require any configuration parameters.

Alternatively, Spring's RequestContextListener and Spring's DispatcherServlet also expose the same request context to the current thread.

Since:
2.0
Author:
Rod Johnson, Juergen Hoeller
See Also:
LocaleContextHolder, RequestContextHolder, RequestContextListener, DispatcherServlet

Field Summary
 
Fields inherited from class org.springframework.web.filter.OncePerRequestFilter
ALREADY_FILTERED_SUFFIX
 
Fields inherited from class org.springframework.web.filter.GenericFilterBean
logger
 
Constructor Summary
RequestContextFilter()
           
 
Method Summary
protected  void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
          Same contract as for doFilter, but guaranteed to be just invoked once per request.
 
Methods inherited from class org.springframework.web.filter.OncePerRequestFilter
doFilter, getAlreadyFilteredAttributeName, shouldNotFilter
 
Methods inherited from class org.springframework.web.filter.GenericFilterBean
addRequiredProperty, afterPropertiesSet, destroy, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setFilterConfig, setServletContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestContextFilter

public RequestContextFilter()
Method Detail

doFilterInternal

protected void doFilterInternal(HttpServletRequest request,
                                HttpServletResponse response,
                                FilterChain filterChain)
                         throws ServletException,
                                IOException
Description copied from class: OncePerRequestFilter
Same contract as for doFilter, but guaranteed to be just invoked once per request. Provides HttpServletRequest and HttpServletResponse arguments instead of the default ServletRequest and ServletResponse ones.

Specified by:
doFilterInternal in class OncePerRequestFilter
Throws:
ServletException
IOException

The Spring Framework

Copyright © 2002-2006 The Spring Framework.