public final class PatternsRequestCondition extends AbstractRequestCondition<PatternsRequestCondition>
Constructor and Description |
---|
PatternsRequestCondition(List<PathPattern> patterns)
Creates a new instance with the given
Stream of URL patterns. |
PatternsRequestCondition(PathPattern... patterns)
Creates a new instance with the given URL patterns.
|
Modifier and Type | Method and Description |
---|---|
PatternsRequestCondition |
combine(PatternsRequestCondition other)
Returns a new instance with URL patterns from the current instance ("this") and
the "other" instance as follows:
If there are patterns in both instances, combine the patterns in "this" with
the patterns in "other" using
PathPattern.combine(PathPattern) . |
int |
compareTo(PatternsRequestCondition other,
ServerWebExchange exchange)
Compare the two conditions based on the URL patterns they contain.
|
protected Collection<PathPattern> |
getContent()
Return the discrete items a request condition is composed of.
|
PatternsRequestCondition |
getMatchingCondition(ServerWebExchange exchange)
Checks if any of the patterns match the given request and returns an instance
that is guaranteed to contain matching patterns, sorted.
|
Set<PathPattern> |
getPatterns() |
protected String |
getToStringInfix()
The notation to use when printing discrete items of content.
|
equals, hashCode, isEmpty, toString
public PatternsRequestCondition(PathPattern... patterns)
patterns
- 0 or more URL patterns; if 0 the condition will match to every request.public PatternsRequestCondition(List<PathPattern> patterns)
Stream
of URL patterns.public Set<PathPattern> getPatterns()
protected Collection<PathPattern> getContent()
AbstractRequestCondition
For example URL patterns, HTTP request methods, param expressions, etc.
getContent
in class AbstractRequestCondition<PatternsRequestCondition>
null
)protected String getToStringInfix()
AbstractRequestCondition
For example " || "
for URL patterns or " && "
for param expressions.
getToStringInfix
in class AbstractRequestCondition<PatternsRequestCondition>
public PatternsRequestCondition combine(PatternsRequestCondition other)
PathPattern.combine(PathPattern)
.
other
- the condition to combine with.@Nullable public PatternsRequestCondition getMatchingCondition(ServerWebExchange exchange)
exchange
- the current exchangenull
if no patterns match.public int compareTo(PatternsRequestCondition other, ServerWebExchange exchange)
It is assumed that both instances have been obtained via
getMatchingCondition(ServerWebExchange)
to ensure they
contain only patterns that match the request and are sorted with
the best matches on top.