public class PathMatchConfigurer
extends java.lang.Object
Configured path matcher and path helper instances are shared for:
RequestMappingHandlerMapping
,
SimpleUrlHandlerMapping
Constructor and Description |
---|
PathMatchConfigurer() |
Modifier and Type | Method and Description |
---|---|
PathMatchConfigurer |
addPathPrefix(java.lang.String prefix,
java.util.function.Predicate<java.lang.Class<?>> predicate)
Configure a path prefix to apply to matching controller methods.
|
PathMatcher |
getPathMatcher() |
protected java.util.Map<java.lang.String,java.util.function.Predicate<java.lang.Class<?>>> |
getPathPrefixes() |
UrlPathHelper |
getUrlPathHelper() |
java.lang.Boolean |
isUseRegisteredSuffixPatternMatch() |
java.lang.Boolean |
isUseSuffixPatternMatch() |
java.lang.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(java.lang.Boolean registeredSuffixPatternMatch)
Whether suffix pattern matching should work only against path extensions
explicitly registered when you
configure content
negotiation . |
PathMatchConfigurer |
setUseSuffixPatternMatch(java.lang.Boolean suffixPatternMatch)
Whether to use suffix pattern match (".*") when matching patterns to
requests.
|
PathMatchConfigurer |
setUseTrailingSlashMatch(java.lang.Boolean trailingSlashMatch)
Whether to match to URLs irrespective of the presence of a trailing slash.
|
public PathMatchConfigurer setUseSuffixPatternMatch(java.lang.Boolean suffixPatternMatch)
By default this is set to true
.
registeredSuffixPatternMatch
public PathMatchConfigurer setUseTrailingSlashMatch(java.lang.Boolean trailingSlashMatch)
The default value is true
.
public PathMatchConfigurer setUseRegisteredSuffixPatternMatch(java.lang.Boolean registeredSuffixPatternMatch)
configure 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".
public PathMatchConfigurer setUrlPathHelper(UrlPathHelper urlPathHelper)
Use this to override the default UrlPathHelper with a custom subclass, or to share common UrlPathHelper settings across multiple HandlerMappings and MethodNameResolvers.
public PathMatchConfigurer setPathMatcher(PathMatcher pathMatcher)
AntPathMatcher
public PathMatchConfigurer addPathPrefix(java.lang.String prefix, java.util.function.Predicate<java.lang.Class<?>> predicate)
Prefixes are used to enrich the mappings of every @RequestMapping
method whose controller type is matched by the corresponding
Predicate
. The prefix for the first matching predicate is used.
Consider using HandlerTypePredicate
to group controllers.
prefix
- the prefix to applypredicate
- a predicate for matching controller types@Nullable public java.lang.Boolean isUseSuffixPatternMatch()
@Nullable public java.lang.Boolean isUseTrailingSlashMatch()
@Nullable public java.lang.Boolean isUseRegisteredSuffixPatternMatch()
@Nullable public UrlPathHelper getUrlPathHelper()
@Nullable public PathMatcher getPathMatcher()
@Nullable protected java.util.Map<java.lang.String,java.util.function.Predicate<java.lang.Class<?>>> getPathPrefixes()