类 PathMatchConfigurer
- java.lang.Object
- org.springframework.web.servlet.config.annotation.PathMatchConfigurer
public class PathMatchConfigurer extends Object
Helps with configuring HandlerMappings path matching options such as trailing slash match, suffix registration, path matcher and path helper.Configured path matcher and path helper instances are shared for:
- RequestMappings
- ViewControllerMappings
- ResourcesMappings
- 从以下版本开始:
- 4.0.3
- 作者:
- Brian Clozel
- 另请参阅:
RequestMappingHandlerMapping
,SimpleUrlHandlerMapping
构造器概要
构造器 构造器 说明 PathMatchConfigurer()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 PathMatcher
getPathMatcher()
UrlPathHelper
getUrlPathHelper()
Boolean
isUseRegisteredSuffixPatternMatch()
Boolean
isUseSuffixPatternMatch()
Boolean
isUseTrailingSlashMatch()
PathMatchConfigurer
setPathMatcher(PathMatcher pathMatcher)
Set the PathMatcher implementation to use for matching URL paths against registered URL patterns.PathMatchConfigurer
setUrlPathHelper(UrlPathHelper urlPathHelper)
Set the UrlPathHelper to use for resolution of lookup paths.PathMatchConfigurer
setUseRegisteredSuffixPatternMatch(Boolean registeredSuffixPatternMatch)
Whether suffix pattern matching should work only against path extensions explicitly registered when youconfigure content negotiation
.PathMatchConfigurer
setUseSuffixPatternMatch(Boolean suffixPatternMatch)
Whether to use suffix pattern match (".*") when matching patterns to requests.PathMatchConfigurer
setUseTrailingSlashMatch(Boolean trailingSlashMatch)
Whether to match to URLs irrespective of the presence of a trailing slash.
构造器详细资料
PathMatchConfigurer
public PathMatchConfigurer()
方法详细资料
setUseSuffixPatternMatch
public PathMatchConfigurer setUseSuffixPatternMatch(Boolean suffixPatternMatch)
Whether to use suffix pattern match (".*") when matching patterns to requests. If enabled a method mapped to "/users" also matches to "/users.*".By default this is set to
true
.
setUseTrailingSlashMatch
public PathMatchConfigurer setUseTrailingSlashMatch(Boolean trailingSlashMatch)
Whether to match to URLs irrespective of the presence of a trailing slash. If enabled a method mapped to "/users" also matches to "/users/".The default value is
true
.
setUseRegisteredSuffixPatternMatch
public PathMatchConfigurer setUseRegisteredSuffixPatternMatch(Boolean registeredSuffixPatternMatch)
Whether suffix pattern matching should work only against path extensions explicitly registered when youconfigure content negotiation
. This is generally recommended to reduce ambiguity and to avoid issues such as when a "." appears in the path for other reasons.By default this is set to "false".
setUrlPathHelper
public PathMatchConfigurer setUrlPathHelper(UrlPathHelper urlPathHelper)
Set the UrlPathHelper to use for resolution of lookup paths.Use this to override the default UrlPathHelper with a custom subclass, or to share common UrlPathHelper settings across multiple HandlerMappings and MethodNameResolvers.
setPathMatcher
public PathMatchConfigurer setPathMatcher(PathMatcher pathMatcher)
Set the PathMatcher implementation to use for matching URL paths against registered URL patterns. Default is AntPathMatcher.- 另请参阅:
AntPathMatcher
isUseSuffixPatternMatch
public Boolean isUseSuffixPatternMatch()
isUseTrailingSlashMatch
public Boolean isUseTrailingSlashMatch()
isUseRegisteredSuffixPatternMatch
public Boolean isUseRegisteredSuffixPatternMatch()
getUrlPathHelper
public UrlPathHelper getUrlPathHelper()
getPathMatcher
public PathMatcher getPathMatcher()