Class PathMatchConfigurer
WebMvcConfigurationSupport.requestMappingHandlerMapping(ContentNegotiationManager, ApiVersionStrategy, FormattingConversionService, ResourceUrlProvider)WebMvcConfigurationSupport.viewControllerHandlerMapping(FormattingConversionService, ResourceUrlProvider)WebMvcConfigurationSupport.beanNameHandlerMapping(FormattingConversionService, ResourceUrlProvider)WebMvcConfigurationSupport.routerFunctionMapping(FormattingConversionService, ResourceUrlProvider, ApiVersionStrategy)WebMvcConfigurationSupport.resourceHandlerMapping(ContentNegotiationManager, FormattingConversionService, ResourceUrlProvider)
- Since:
- 4.0.3
- Author:
- Brian Clozel, Rossen Stoyanchev
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddPathPrefix(String prefix, Predicate<Class<?>> predicate) Configure a path prefix to apply to matching controller methods.Deprecated, for removal: This API element is subject to removal in a future version.protected PathMatcherDeprecated, for removal: This API element is subject to removal in a future version.Return thePathPatternParserto use, if configured.Return the configured PathPatternParser or a default, shared instance otherwise.Deprecated, for removal: This API element is subject to removal in a future version.protected UrlPathHelperDeprecated, for removal: This API element is subject to removal in a future version.use ofPathMatcherandUrlPathHelperis deprecated for use at runtime in web modules in favor of parsed patterns withPathPatternParser.protected booleanDeprecated, for removal: This API element is subject to removal in a future version.use ofPathMatcheris deprecated for use at runtime in web modules in favor of parsed patterns withPathPatternParser.setPathMatcher(PathMatcher pathMatcher) Deprecated, for removal: This API element is subject to removal in a future version.use ofPathMatcheris deprecated for use at runtime in web modules in favor of parsed patterns withPathPatternParser.setPatternParser(@Nullable PathPatternParser patternParser) Set thePathPatternParserto parsepatternswith for URL path matching.setUrlPathHelper(UrlPathHelper urlPathHelper) Deprecated, for removal: This API element is subject to removal in a future version.use ofPathMatcherandUrlPathHelperis deprecated for use at runtime in web modules in favor of parsed patterns withPathPatternParser.
-
Constructor Details
-
PathMatchConfigurer
public PathMatchConfigurer()
-
-
Method Details
-
setPatternParser
Set thePathPatternParserto parsepatternswith for URL path matching. Parsed patterns provide a more modern and efficient alternative to String path matching viaAntPathMatcher.By default, as of 6.0, a
PathPatternParserwith default settings is used, which enables parsedpatterns. Set this property tonullto fall back on String path matching viaAntPathMatcherinstead, or alternatively, setting one of the above listedAntPathMatcherrelated properties has the same effect.- Parameters:
patternParser- the parser to pre-parse patterns with- Since:
- 5.3
-
addPathPrefix
Configure a path prefix to apply to matching controller methods.Prefixes are used to enrich the mappings of every
@RequestMappingmethod whose controller type is matched by the correspondingPredicate. The prefix for the first matching predicate is used.Consider using
HandlerTypePredicateto group controllers.- Parameters:
prefix- the prefix to applypredicate- a predicate for matching controller types- Since:
- 5.1
-
setUrlPathHelper
@Deprecated(since="7.0", forRemoval=true) public PathMatchConfigurer setUrlPathHelper(UrlPathHelper urlPathHelper) Deprecated, for removal: This API element is subject to removal in a future version.use ofPathMatcherandUrlPathHelperis deprecated for use at runtime in web modules in favor of parsed patterns withPathPatternParser.Set the UrlPathHelper to use to resolve the mapping path for the application.Note: This property is mutually exclusive with
setPatternParser(PathPatternParser). If set, it enables use of String path matching, unless aPathPatternParseris also explicitly set in which case this property is ignored.By default, this is an instance of
UrlPathHelperwith default settings. -
setPathMatcher
@Deprecated(since="7.0", forRemoval=true) public PathMatchConfigurer setPathMatcher(PathMatcher pathMatcher) Deprecated, for removal: This API element is subject to removal in a future version.use ofPathMatcheris deprecated for use at runtime in web modules in favor of parsed patterns withPathPatternParser.Set the PathMatcher to use for String pattern matching.Note: This property is mutually exclusive with
setPatternParser(PathPatternParser). If set, it enables use of String path matching, unless aPathPatternParseris also explicitly set in which case this property is ignored.By default, this is an instance of
AntPathMatcherwith default settings. -
preferPathMatcher
Deprecated, for removal: This API element is subject to removal in a future version.use ofPathMatcheris deprecated for use at runtime in web modules in favor of parsed patterns withPathPatternParser.Whether to preferPathMatcher. This is the case when either is true:PathPatternParseris explicitly set tonull.PathPatternParseris not explicitly set, and aPathMatcherrelated option is explicitly set.
- Since:
- 6.0
-
getPatternParser
Return thePathPatternParserto use, if configured.- Since:
- 5.3
-
getPathPrefixes
-
getUrlPathHelper
Deprecated, for removal: This API element is subject to removal in a future version. -
getPathMatcher
Deprecated, for removal: This API element is subject to removal in a future version. -
getUrlPathHelperOrDefault
Deprecated, for removal: This API element is subject to removal in a future version.use ofPathMatcherandUrlPathHelperis deprecated for use at runtime in web modules in favor of parsed patterns withPathPatternParser.Return the configured UrlPathHelper or a default, shared instance otherwise.- Since:
- 5.3
-
getPathMatcherOrDefault
Deprecated, for removal: This API element is subject to removal in a future version.use ofPathMatcheris deprecated for use at runtime in web modules in favor of parsed patterns withPathPatternParser.Return the configured PathMatcher or a default, shared instance otherwise.- Since:
- 5.3
-
getPatternParserOrDefault
Return the configured PathPatternParser or a default, shared instance otherwise.- Since:
- 5.3.4
-
PathMatcheris deprecated for use at runtime in web modules in favor of parsed patterns withPathPatternParser.