org.springframework.web.filter
Class OncePerRequestFilter

org.springframework.web.filter.GenericFilterBean
  |
  +--org.springframework.web.filter.OncePerRequestFilter
Direct Known Subclasses:
OpenSessionInViewFilter, MultipartFilter

public abstract class OncePerRequestFilter
extends GenericFilterBean

Filter base class that guarantees to be just executed once per request, on any servlet container. It provides a doFilterInternal method with HttpServletRequest and HttpServletResponse arguments.

How to identify that a request is already filtered is determined by the getAlreadyFilteredAttributeName method. The default implementation is based on the class name of the concrete filter, but this can be made more specific by overriding that method in subclasses.

Author:
Juergen Hoeller
Since: 06.12.2003
See Also: doFilterInternal(HttpServletRequest,HttpServletResponse,FilterChain), getAlreadyFilteredAttributeName()

Field Summary
 final static StringALREADY_FILTERED_SUFFIX
          Suffix that gets appended to the actual class name for the "already filtered" request attribute.

Method Summary
 final voiddoFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
          This doFilter implementation stores a request attribute for "already filtered", proceeding without filtering again if the attribute is already there.

Methods inherited from class org.springframework.web.filter.GenericFilterBean
destroy, init

Field Detail

ALREADY_FILTERED_SUFFIX

public final static String ALREADY_FILTERED_SUFFIX
Suffix that gets appended to the actual class name for the "already filtered" request attribute.
See Also:
getAlreadyFilteredAttributeName()
Method Detail

doFilter

public final void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
throws ServletException,
java.io.IOException
This doFilter implementation stores a request attribute for "already filtered", proceeding without filtering again if the attribute is already there.
See Also:
getAlreadyFilteredAttributeName(), shouldNotFilter(HttpServletRequest), doFilterInternal(HttpServletRequest,HttpServletResponse,FilterChain)

Association Links

to Class java.lang.String

Suffix that gets appended to the actual class name for the "already filtered" request attribute.

see #getAlreadyFilteredAttributeName