@WebServlet合并url,例如: /shop/*,/shop/info 合并成一个 /shop/*

This commit is contained in:
Redkale
2022-07-03 23:43:22 +08:00
parent be713c9ccf
commit f05961cf07

View File

@@ -1449,12 +1449,23 @@ public final class Rest {
}
}
if (defmodulename.isEmpty() || (!pound && entrys.size() <= 2)) {
Set<String> startWiths = new HashSet<>();
for (MappingEntry entry : entrys) {
String suburl = (catalog.isEmpty() ? "/" : ("/" + catalog + "/")) + (defmodulename.isEmpty() ? "" : (defmodulename + "/")) + entry.name;
if ("//".equals(suburl)) {
suburl = "/";
} else if (suburl.length() > 2 && suburl.endsWith("/")) {
startWiths.add(suburl);
suburl += "*";
} else {
boolean match = false;
for (String s : startWiths) {
if (suburl.startsWith(s)) {
match = true;
break;
}
}
if (match) continue;
}
urlpath += "," + suburl;
av1.visit(null, suburl);