org.springframework.web.servlet.config.annotation
Class InterceptorConfigurer

java.lang.Object
  extended by org.springframework.web.servlet.config.annotation.InterceptorConfigurer

public class InterceptorConfigurer
extends Object

Helps with configuring an ordered set of Spring MVC interceptors of type HandlerInterceptor or WebRequestInterceptor. Registered interceptors will generally be detected by all HandlerMapping instances in a Spring MVC web application context. Interceptors can be added with a set of path patterns to which they should apply.

Since:
3.1
Author:
Rossen Stoyanchev

Constructor Summary
InterceptorConfigurer()
           
 
Method Summary
 void addInterceptor(HandlerInterceptor interceptor)
          Add a HandlerInterceptor that should apply to any request.
 void addInterceptor(WebRequestInterceptor interceptor)
          Add a WebRequestInterceptor that should apply to any request.
 void addInterceptors(HandlerInterceptor... interceptors)
          Add HandlerInterceptors that should apply to any request.
 void addInterceptors(WebRequestInterceptor... interceptors)
          Add WebRequestInterceptors that should apply to any request.
protected  List<MappedInterceptor> getInterceptors()
          Returns all registered interceptors.
 void mapInterceptor(String[] pathPatterns, HandlerInterceptor interceptor)
          Add a HandlerInterceptor with a set of URL path patterns it should apply to.
 void mapInterceptor(String[] pathPatterns, WebRequestInterceptor interceptors)
          Add a WebRequestInterceptor with a set of URL path patterns it should apply to.
 void mapInterceptors(String[] pathPatterns, HandlerInterceptor... interceptors)
          Add HandlerInterceptors with a set of URL path patterns they should apply to.
 void mapInterceptors(String[] pathPatterns, WebRequestInterceptor... interceptors)
          Add WebRequestInterceptors with a set of URL path patterns they should apply to.
protected  void register(String[] pathPatterns, HandlerInterceptor... interceptors)
          Stores the given set of HandlerInterceptors and path patterns internally.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterceptorConfigurer

public InterceptorConfigurer()
Method Detail

addInterceptor

public void addInterceptor(HandlerInterceptor interceptor)
Add a HandlerInterceptor that should apply to any request.


addInterceptor

public void addInterceptor(WebRequestInterceptor interceptor)
Add a WebRequestInterceptor that should apply to any request.


addInterceptors

public void addInterceptors(HandlerInterceptor... interceptors)
Add HandlerInterceptors that should apply to any request.


addInterceptors

public void addInterceptors(WebRequestInterceptor... interceptors)
Add WebRequestInterceptors that should apply to any request.


mapInterceptor

public void mapInterceptor(String[] pathPatterns,
                           HandlerInterceptor interceptor)
Add a HandlerInterceptor with a set of URL path patterns it should apply to.


mapInterceptor

public void mapInterceptor(String[] pathPatterns,
                           WebRequestInterceptor interceptors)
Add a WebRequestInterceptor with a set of URL path patterns it should apply to.


mapInterceptors

public void mapInterceptors(String[] pathPatterns,
                            HandlerInterceptor... interceptors)
Add HandlerInterceptors with a set of URL path patterns they should apply to.


mapInterceptors

public void mapInterceptors(String[] pathPatterns,
                            WebRequestInterceptor... interceptors)
Add WebRequestInterceptors with a set of URL path patterns they should apply to.


register

protected void register(String[] pathPatterns,
                        HandlerInterceptor... interceptors)
Stores the given set of HandlerInterceptors and path patterns internally.

Parameters:
pathPatterns - path patterns or null
interceptors - one or more interceptors to be stored

getInterceptors

protected List<MappedInterceptor> getInterceptors()
Returns all registered interceptors.