Merge pull request #13775 from izeye
* gh-13775: Polish EndpointRequest.RequestMatcherFactory.antPath()
This commit is contained in:
commit
777fc5e464
|
|
@ -297,20 +297,12 @@ public final class EndpointRequest {
|
|||
}
|
||||
|
||||
List<RequestMatcher> antPath(String... parts) {
|
||||
List<RequestMatcher> matchers = new ArrayList<>();
|
||||
this.servletPaths.stream().map((p) -> {
|
||||
if (StringUtils.hasText(p) && !p.equals("/")) {
|
||||
return p;
|
||||
}
|
||||
return "";
|
||||
}).distinct().forEach((path) -> {
|
||||
StringBuilder pattern = new StringBuilder(path);
|
||||
for (String part : parts) {
|
||||
pattern.append(part);
|
||||
}
|
||||
matchers.add(new AntPathRequestMatcher(pattern.toString()));
|
||||
});
|
||||
return matchers;
|
||||
return this.servletPaths.stream()
|
||||
.map((p) -> (StringUtils.hasText(p) && !p.equals("/") ? p : ""))
|
||||
.distinct()
|
||||
.map((path) -> Arrays.stream(parts)
|
||||
.collect(Collectors.joining("", path, "")))
|
||||
.map(AntPathRequestMatcher::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue