• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to stop directory viewing

 
Shaun Appleton
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can deploy my application using Tomcat/Jboss and all works fine. But when I go to the top level directory of my web app I can see all my JSPs/Gifs etc listed as a directory listing. Does anybody know how to turn this off?
Thanks in advance
Shaun
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Define a <welcome-file-list> in your web.xml file.
For instance, this one will redirect any request for the directory into a request for "index.jsp":
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look in -home-/conf/web.xml at the default servlet parameters. Set the "listings" parameter to "false" to disable directory listings in directories that don't have a "welcome" file.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic