|
|
|
@ -157,13 +157,16 @@ public final class PatternsRequestCondition extends AbstractRequestCondition<Pat |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
public PatternsRequestCondition getMatchingCondition(ServerWebExchange exchange) { |
|
|
|
public PatternsRequestCondition getMatchingCondition(ServerWebExchange exchange) { |
|
|
|
SortedSet<PathPattern> matches = getMatchingPatterns(exchange); |
|
|
|
PathContainer lookupPath = exchange.getRequest().getPath().pathWithinApplication(); |
|
|
|
|
|
|
|
if (this.patterns.size() == 1) { |
|
|
|
|
|
|
|
return (this.patterns.first().matches(lookupPath) ? this : null); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SortedSet<PathPattern> matches = getMatchingPatterns(lookupPath); |
|
|
|
return (matches != null ? new PatternsRequestCondition(matches) : null); |
|
|
|
return (matches != null ? new PatternsRequestCondition(matches) : null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
private SortedSet<PathPattern> getMatchingPatterns(ServerWebExchange exchange) { |
|
|
|
private SortedSet<PathPattern> getMatchingPatterns(PathContainer lookupPath) { |
|
|
|
PathContainer lookupPath = exchange.getRequest().getPath().pathWithinApplication(); |
|
|
|
|
|
|
|
TreeSet<PathPattern> result = null; |
|
|
|
TreeSet<PathPattern> result = null; |
|
|
|
for (PathPattern pattern : this.patterns) { |
|
|
|
for (PathPattern pattern : this.patterns) { |
|
|
|
if (pattern.matches(lookupPath)) { |
|
|
|
if (pattern.matches(lookupPath)) { |
|
|
|
|