Directory Listing

Problem

In GlassFish directory listing is enabled by default. If you call a directory URL the browser lists all sub directories and files. This is unwanted in an production system.

Solution

The file default-web.xml [2] defines initialization parameters for the default servlet, which is responsible for static resources. The directory listing can be disabled for all applications by setting the value of the attribute listings to false and restart the server.

<servlet> <init-param> <param-name>listings</param-name> <param-value>false</param-value> </init-param> </servlet>

If you call now a directory URL you get the HTTP Status 404.

Resources

Author: Johannes HammoudComments Date: 23.08.2009

Language German

Java JSF XHTML WML JavaScript GlassFish MySQL NetBeans

Imprint

Visits
582379
Today
35