PathPatternRouteMatcher should use custom separator
Prior to this commit, the `PathPatternRouteMatcher` would always use the default path pattern separator when parsing incoming route strings to `RouteMatcher.Route` instances. When the `PathPatternRouteMatcher` is configured with a `PathPatternParser` that has a custom separator (e.g., `.`), then the matching algorithm can't match routes against parsed patterns. This commit ensures that the route matcher uses the configured separator at all times. Fixes gh-23167
This commit is contained in:
@@ -36,18 +36,21 @@ public class PathPatternRouteMatcher implements RouteMatcher {
|
||||
|
||||
private final PathPatternParser parser;
|
||||
|
||||
private final String separator;
|
||||
|
||||
private final Map<String, PathPattern> pathPatternCache = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
public PathPatternRouteMatcher(PathPatternParser parser) {
|
||||
Assert.notNull(parser, "PathPatternParser must not be null");
|
||||
this.parser = parser;
|
||||
this.separator = String.valueOf(parser.getSeparator());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Route parseRoute(String routeValue) {
|
||||
return new PathContainerRoute(PathContainer.parsePath(routeValue));
|
||||
return new PathContainerRoute(PathContainer.parsePath(routeValue, this.separator));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user