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

Johannes Hammoud Directory Listing 23.08.2009

I Coding : Community about Java programing

Language German+-

Java JSF JavaScript HTML CSS NetBeans GlassFish MySQL

Imprint

Visits
5744492
Today
61