List Files in a Java Web App

Put this into your web.xml and override so the default servlet configuration declared by every Servlet Container (Tomcat, Jetty, GlassFish):

    <servlet>
        <servlet-name>default</servlet-name>
        <init-param>
            <!--boolean paramter to allow directory traversal-->
            <!--this parameter name depends on the specific servlet container implementation-->

            <!--valid for Jetty, Tomcat uses a different parameter-->
            <param-name>dirAllowed</param-name>
            <param-value>false</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <!--folder name in the "webapp" folder-->
        <url-pattern>/static/*</url-pattern>
    </servlet-mapping>

Comments

Popular posts from this blog

Tuning ext4 for performance with emphasis on SSD usage

Java 8: Default Interface Implementations, The Diamond Problem, Multiple Inheritance, and Precedence

Tuning ext3 for performance without losing its data integrity potential