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.
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.
Author: Johannes HammoudComments Date: 23.08.2009