Class PatternsRequestCondition
java.lang.Object
org.springframework.web.servlet.mvc.condition.AbstractRequestCondition<PatternsRequestCondition>
org.springframework.web.servlet.mvc.condition.PatternsRequestCondition
- All Implemented Interfaces:
- RequestCondition<PatternsRequestCondition>
@Deprecated(since="7.0",
            forRemoval=true)
public class PatternsRequestCondition
extends AbstractRequestCondition<PatternsRequestCondition>
Deprecated, for removal: This API element is subject to removal in a future version.
A logical disjunction (' || ') request condition that matches a request
against a set of URL path patterns.
In contrast to PathPatternsRequestCondition which uses parsed
PathPatterns, this condition does String pattern matching via
AntPathMatcher.
- Since:
- 3.1
- Author:
- Rossen Stoyanchev
- 
Constructor SummaryConstructorsConstructorDescriptionPatternsRequestCondition(String... patterns) Deprecated, for removal: This API element is subject to removal in a future version.Constructor with URL patterns which are prepended with "/" if necessary.PatternsRequestCondition(String[] patterns, @Nullable UrlPathHelper urlPathHelper, @Nullable PathMatcher pathMatcher) Deprecated, for removal: This API element is subject to removal in a future version.Constructor with URL patterns which are prepended with "/" if necessary.
- 
Method SummaryModifier and TypeMethodDescriptioncombine(PatternsRequestCondition other) Deprecated, for removal: This API element is subject to removal in a future version.Combine the patterns of the current and of the other instances as follows: If only one instance has patterns, use those.intcompareTo(PatternsRequestCondition other, jakarta.servlet.http.HttpServletRequest request) Deprecated, for removal: This API element is subject to removal in a future version.Compare the two conditions based on the URL patterns they contain.protected Collection<String> Deprecated, for removal: This API element is subject to removal in a future version.Return the discrete items a request condition is composed of.Deprecated, for removal: This API element is subject to removal in a future version.Return the mapping paths that are not patterns.getMatchingCondition(jakarta.servlet.http.HttpServletRequest request) Deprecated, for removal: This API element is subject to removal in a future version.Checks if any of the patterns match the given request and returns an instance that is guaranteed to contain matching patterns, sorted viaPathMatcher.getPatternComparator(String).getMatchingPatterns(String lookupPath) Deprecated, for removal: This API element is subject to removal in a future version.Find the patterns matching the given lookup path.Deprecated, for removal: This API element is subject to removal in a future version.protected StringDeprecated, for removal: This API element is subject to removal in a future version.The notation to use when printing discrete items of content.booleanDeprecated, for removal: This API element is subject to removal in a future version.Whether the condition is the "" (empty path) mapping.Methods inherited from class AbstractRequestConditionequals, hashCode, isEmpty, toString
- 
Constructor Details- 
PatternsRequestConditionDeprecated, for removal: This API element is subject to removal in a future version.Constructor with URL patterns which are prepended with "/" if necessary.- Parameters:
- patterns- 0 or more URL patterns; no patterns results in an empty path- ""mapping which matches all requests.
 
- 
PatternsRequestConditionpublic PatternsRequestCondition(String[] patterns, @Nullable UrlPathHelper urlPathHelper, @Nullable PathMatcher pathMatcher) Deprecated, for removal: This API element is subject to removal in a future version.Constructor with URL patterns which are prepended with "/" if necessary.- Parameters:
- patterns- 0 or more URL patterns; no patterns results in an empty path- ""mapping which matches all requests.
- Since:
- 7.0
 
 
- 
- 
Method Details- 
getPatterns
- 
getContentDeprecated, for removal: This API element is subject to removal in a future version.Description copied from class:AbstractRequestConditionReturn the discrete items a request condition is composed of.For example URL patterns, HTTP request methods, param expressions, etc. - Specified by:
- getContentin class- AbstractRequestCondition<PatternsRequestCondition>
- Returns:
- a collection of objects (never null)
 
- 
getToStringInfixDeprecated, for removal: This API element is subject to removal in a future version.Description copied from class:AbstractRequestConditionThe notation to use when printing discrete items of content.For example " || "for URL patterns or" && "for param expressions.- Specified by:
- getToStringInfixin class- AbstractRequestCondition<PatternsRequestCondition>
 
- 
isEmptyPathMappingpublic boolean isEmptyPathMapping()Deprecated, for removal: This API element is subject to removal in a future version.Whether the condition is the "" (empty path) mapping.
- 
getDirectPaths
- 
combineDeprecated, for removal: This API element is subject to removal in a future version.Combine the patterns of the current and of the other instances as follows:- If only one instance has patterns, use those.
- If both have patterns, combine patterns from "this" instance with
patterns from the other instance via PathMatcher.combine(String, String).
- If neither has patterns, use ""and"/"as root path patterns.
 - Parameters:
- other- the condition to combine with.
- Returns:
- a request condition instance that is the result of combining the two condition instances.
 
- 
getMatchingConditionpublic @Nullable PatternsRequestCondition getMatchingCondition(jakarta.servlet.http.HttpServletRequest request) Deprecated, for removal: This API element is subject to removal in a future version.Checks if any of the patterns match the given request and returns an instance that is guaranteed to contain matching patterns, sorted viaPathMatcher.getPatternComparator(String).A matching pattern is obtained by making checks in the following order: - Direct match
- Pattern match with ".*" appended if the pattern doesn't already contain a "."
- Pattern match
- Pattern match with "/" appended if the pattern doesn't already end in "/"
 - Parameters:
- request- the current request
- Returns:
- the same instance if the condition contains no patterns;
or a new condition with sorted matching patterns;
or nullif no patterns match.
 
- 
getMatchingPatternsDeprecated, for removal: This API element is subject to removal in a future version.Find the patterns matching the given lookup path. Invoking this method should yield results equivalent to those of callinggetMatchingCondition(HttpServletRequest). This method is provided as an alternative to be used if no request is available (for example, introspection, tooling, etc).- Parameters:
- lookupPath- the lookup path to match to existing patterns
- Returns:
- a collection of matching patterns sorted with the closest match at the top
 
- 
compareTopublic int compareTo(PatternsRequestCondition other, jakarta.servlet.http.HttpServletRequest request) Deprecated, for removal: This API element is subject to removal in a future version.Compare the two conditions based on the URL patterns they contain. Patterns are compared one at a time, from top to bottom viaPathMatcher.getPatternComparator(String). If all compared patterns match equally, but one instance has more patterns, it is considered a closer match.It is assumed that both instances have been obtained via getMatchingCondition(HttpServletRequest)to ensure they contain only patterns that match the request and are sorted with the best matches on top.
 
- 
PathMatcherandUrlPathHelperis deprecated for use at runtime in web modules in favor of parsed patterns withPathPatternParser.