This is an automated email from the ASF dual-hosted git repository. schultz pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new 72fb2ce Fetch WebResource objects directly, rather than fetching Strings and then looking-up the entries individually by name. 72fb2ce is described below commit 72fb2ce224ac28c52978a609da42cee6526a393a Author: Christopher Schultz <ch...@christopherschultz.net> 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 867365a..981eb6f 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -1701,11 +1701,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"); @@ -1797,13 +1797,12 @@ public class DefaultServlet extends HttpServlet { } 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; } @@ -1817,11 +1816,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: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org