Commit 86ccb26c authored by Johnny Lim's avatar Johnny Lim Committed by Madhura Bhave

Polish EndpointRequest.RequestMatcherFactory.antPath()

Closes gh-13775
parent c3680490
...@@ -297,20 +297,12 @@ public final class EndpointRequest { ...@@ -297,20 +297,12 @@ public final class EndpointRequest {
} }
List<RequestMatcher> antPath(String... parts) { List<RequestMatcher> antPath(String... parts) {
List<RequestMatcher> matchers = new ArrayList<>(); return this.servletPaths.stream()
this.servletPaths.stream().map((p) -> { .map((p) -> (StringUtils.hasText(p) && !p.equals("/") ? p : ""))
if (StringUtils.hasText(p) && !p.equals("/")) { .distinct()
return p; .map((path) -> Arrays.stream(parts)
} .collect(Collectors.joining("", path, "")))
return ""; .map(AntPathRequestMatcher::new).collect(Collectors.toList());
}).distinct().forEach((path) -> {
StringBuilder pattern = new StringBuilder(path);
for (String part : parts) {
pattern.append(part);
}
matchers.add(new AntPathRequestMatcher(pattern.toString()));
});
return matchers;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment