1

I'm running a tomcat webserver and want to expose as local directory via the tomcat itself in a webbrowser.

I found the following, which would list the full content of docBase.

server.xml (access via localhost:8080/logs):

<Context docBase="/opt/tomcat/logs" path="/logs" />

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> <!-- this is important -->
    </init-param>
</servlet>

By default, tomcat just shows any files in that dir, and sorts them just randomly.

Question: how can I restrict the files inside that directory that should be exposed? And how could I tell tomcat to order the files being shown eg by filename, or by modification date?

membersound
  • 81,582
  • 193
  • 585
  • 1,120
  • There is a very good answer to a similar questions including links for further reading: https://stackoverflow.com/a/1812356/6825678 – DrHopfen Jun 26 '19 at 08:42

0 Answers0