https://issues.apache.org/bugzilla/show_bug.cgi?id=57287
Bug ID: 57287 Summary: Sort files listed by DefaultServlet Product: Tomcat 8 Version: 8.0.15 Hardware: PC Status: NEW Severity: normal Priority: P2 Component: Catalina Assignee: dev@tomcat.apache.org Reporter: knst.koli...@gmail.com When DefaultServlet has file listings enabled, in Tomcat 8.0.15 and 7.0.57 it does not sort the files. It lists them in the order provided by the underlying resources implementation. It is a bit harder to see on Windows, where the file system lists the files in a sorted order, but here is a reproduction recipe 1) Unpack apache-tomcat-8.0.15.zip 2) Add the following lines to webapps/ROOT/WEB-INF/web.xml <servlet> <servlet-name>default</servlet-name> <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class> <init-param> <param-name>listings</param-name> <param-value>true</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> 3) Delete file webapps/ROOT/index.jsp 4) Create directory webapps/ROOT/WEB-INF/lib/ and copy there the following file from source code (apache-tomcat-8.0.15-src.zip): /test/webapp-fragments/WEB-INF/lib/resources2.jar 5) Start Tomcat and access http://localhost:8080/ Actual behaviour: Note that files "resourceB.jsp" and "resourceF.jsp" are listed at the end of the file list, instead of any alphabetical order. A mention of this issue by a user: https://stackoverflow.com/questions/27166274/directory-listings-sort-order-in-tomcat-8 Expected behaviour: List the files alphabetically. Though my preference for the sort order is a) sort case-insensitively b) list the directories first It could be improved by offering a configurable sort order: a) by a parameter in the request b) by a user cookie Tomcat 7 ========= The same recipe reproduces the issue for Tomcat 7.0.57. Workaround =========== DefaultServlet can be configured to generate listing in XML and apply an XSLT transformation to it. XSLT can perform sorting. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org