Top Description Fields Constructors Methods
org.springframework.web.servlet.config.annotation

public Class InterceptorRegistration

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Arrays, .List, org.springframework.lang.Nullable, org.springframework.util.AntPathMatcher, .Assert, .PathMatcher, .StringUtils, org.springframework.web.servlet.HandlerInterceptor, org.springframework.web.servlet.handler.MappedInterceptor, org.springframework.web.util.ServletRequestPathUtils, org.springframework.web.util.pattern.PathPattern

Assists with the creation of a MappedInterceptor.
Authors
Rossen Stoyanchev, Keith Donald
Since
3.1

Field Summary

Modifier and TypeField and Description
private List<String>
private List<String>
private final HandlerInterceptor
private int
private PathMatcher

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public InterceptorRegistration
addPathPatterns(String... patterns)

Add patterns for URLs the interceptor should be included in.

For pattern syntax see PathPattern when parsed patterns are enabled or AntPathMatcher otherwise.

public InterceptorRegistration
addPathPatterns(List<String> patterns)

List-based variant of addPathPatterns(String...).

public InterceptorRegistration
excludePathPatterns(String... patterns)

Add patterns for URLs the interceptor should be excluded from.

public InterceptorRegistration
protected Object
getInterceptor()

Build the underlying interceptor.

protected int
getOrder()

Return the order position to be used.

public InterceptorRegistration
order(int order)

Specify an order position to be used.

public InterceptorRegistration
pathMatcher(PathMatcher pathMatcher)

Configure the PathMatcher to use to match URL paths with against include and exclude patterns.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

excludePatternsback to summary
private List<String> excludePatterns
Annotations
@Nullable
includePatternsback to summary
private List<String> includePatterns
Annotations
@Nullable
interceptorback to summary
private final HandlerInterceptor interceptor
orderback to summary
private int order
pathMatcherback to summary
private PathMatcher pathMatcher
Annotations
@Nullable

Constructor Detail

InterceptorRegistrationback to summary
public InterceptorRegistration(HandlerInterceptor interceptor)

Create an InterceptorRegistration instance.

Method Detail

addPathPatternsback to summary
public InterceptorRegistration addPathPatterns(String... patterns)

Add patterns for URLs the interceptor should be included in.

For pattern syntax see PathPattern when parsed patterns are enabled or AntPathMatcher otherwise. The syntax is largely the same with PathPattern more tailored for web usage and more efficient.

addPathPatternsback to summary
public InterceptorRegistration addPathPatterns(List<String> patterns)

List-based variant of addPathPatterns(String...).

Since
5.0.3
excludePathPatternsback to summary
public InterceptorRegistration excludePathPatterns(String... patterns)

Add patterns for URLs the interceptor should be excluded from.

For pattern syntax see PathPattern when parsed patterns are enabled or AntPathMatcher otherwise. The syntax is largely the same with PathPattern more tailored for web usage and more efficient.

excludePathPatternsback to summary
public InterceptorRegistration excludePathPatterns(List<String> patterns)

List-based variant of excludePathPatterns(String...).

Since
5.0.3
getInterceptorback to summary
protected Object getInterceptor()

Build the underlying interceptor. If URL patterns are provided, the returned type is MappedInterceptor; otherwise HandlerInterceptor.

getOrderback to summary
protected int getOrder()

Return the order position to be used.

orderback to summary
public InterceptorRegistration order(int order)

Specify an order position to be used. Default is 0.

Since
4.3.23
pathMatcherback to summary
public InterceptorRegistration pathMatcher(PathMatcher pathMatcher)

Configure the PathMatcher to use to match URL paths with against include and exclude patterns.

This is an advanced property that should be used only when a customized AntPathMatcher or a custom PathMatcher is required.

By default this is AntPathMatcher.

Note

Setting PathMatcher enforces use of String pattern matching even when a parsed RequestPath is available.