This is an automated email from the ASF dual-hosted git repository.
schultz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new e3ab24d Fetch WebResource objects directly, rather than fetching
Strings and then looking-up the entries individually by name.
new 24adb82 Merge branch 'master' of https://github.com/apache/tomcat
e3ab24d is described below
commit e3ab24db494d8bf53417687dd95b4873f170e505
Author: Christopher Schultz <[email protected]>
AuthorDate: Sat May 4 15:47:04 2019 +0200
Fetch WebResource objects directly, rather than fetching Strings and then
looking-up the entries individually by name.
---
java/org/apache/catalina/servlets/DefaultServlet.java | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java
b/java/org/apache/catalina/servlets/DefaultServlet.java
index cba40c5..4144f6d 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -1711,11 +1711,11 @@ public class DefaultServlet extends HttpServlet {
StringBuilder sb = new StringBuilder();
- String[] entries = resources.list(resource.getWebappPath());
+ String directoryWebappPath = resource.getWebappPath();
+ WebResource[] entries = resources.listResources(directoryWebappPath);
// rewriteUrl(contextPath) is expensive. cache result for later reuse
String rewrittenContextPath = rewriteUrl(contextPath);
- String directoryWebappPath = resource.getWebappPath();
// Render the page header
sb.append("<html>\r\n");
@@ -1774,13 +1774,12 @@ public class DefaultServlet extends HttpServlet {
sb.append("</tr>");
boolean shade = false;
- for (String entry : entries) {
- if (entry.equalsIgnoreCase("WEB-INF") ||
- entry.equalsIgnoreCase("META-INF"))
+ for (WebResource childResource : entries) {
+ String filename = childResource.getName();
+ if (filename.equalsIgnoreCase("WEB-INF") ||
+ filename.equalsIgnoreCase("META-INF"))
continue;
- WebResource childResource =
- resources.getResource(directoryWebappPath + entry);
if (!childResource.exists()) {
continue;
}
@@ -1794,11 +1793,11 @@ public class DefaultServlet extends HttpServlet {
sb.append("<td align=\"left\"> \r\n");
sb.append("<a href=\"");
sb.append(rewrittenContextPath);
- sb.append(rewriteUrl(directoryWebappPath + entry));
+ sb.append(rewriteUrl(childResource.getWebappPath()));
if (childResource.isDirectory())
sb.append("/");
sb.append("\"><tt>");
- sb.append(Escape.htmlElementContent(entry));
+ sb.append(Escape.htmlElementContent(filename));
if (childResource.isDirectory())
sb.append("/");
sb.append("</tt></a></td>\r\n");
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]