-
1. Re: How to disable directory listings with Tomcat and Struts
terry Mar 20, 2003 3:05 PM (in response to mash1)Mash,
Try editing the web.xml file located in the
$JBOSS_HOME/tomcat-4.1.x/conf
directory. Within the definition, change:
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
to
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
This worked for me but I am not using Struts so I'm not sure if it will work for you.
Terry -
2. Re: How to disable directory listings with Tomcat and Struts
mash1 Mar 24, 2003 5:37 AM (in response to mash1)Hi Terry,
No, I tried that already and it doesn't work.
Cheers,
Mash -
3. Re: How to disable directory listings with Tomcat and Struts
luwasoft Mar 31, 2003 4:14 AM (in response to mash1)Hi Mash,
thanks for making me aware of this issue :-)
I found a hack to solve your (and my newly discovered) issue:
In your Web-App you should add to your web.xml a modified default servlet (if you use the ant build procedure supposed by JBoss the filename in your source tree the file is src\etc\WEB-INF\web-client.xml).
Even if you think it would be the last option, adding a index.jsp to any directory and redirecting to a preferred destination looks to me a much cleaner solution. By doing what you want (and what i found, tested and post here) you get a result that is (from the webdesing point of view) really dirty: you show a buildt in tomcat error (! buh !). Of course you could make your own errorpage...
What i suppose is to redefine the default servlet. JBoss-tomcat seems to define a servlet under the name "default", so i used just another name to prevent deployment exceptions.
If one of the JBoss insiders could explain how one changes the JBOss defines "default" servlet definition i would be glad to here, in between my suggestion should solve your problem...
Just add the fillowing lines to web.xml:
<!-- to the servlet definitions: -->
<servlet-name>myDefault</servlet-name>
<servlet-class>
org.apache.catalina.servlets.DefaultServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<!-- later to the servlet mappings: -->
<servlet-mapping>
<servlet-name>myDefault</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Thats it!
Hope this help.