Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Avoiding "Directory Listing For xyz" for a Web Application

 
Naresh Shaan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have been working on jboss for quite some time. the HOT Deployment feature is simple amazing.

But Am worried about one thing. i have a simple web application. with few html , jsp's and servlets.

let us take the following directory structure for my Simple.war application.

Simple.war
|
|--Jsps/One.jsp
|--WEB-INF/


when i point my browser to localhost:8080/Simple/Jsps

i get the Directory listing of files available in my public folder(Files out side WEB-INF) of my application

is there any way to prevent exposing my public files like, html pages, jsp's and few images i have used in my application.

if i give "localhost:8080/Simple/Jsps" then my browser should display some message other than displaying the directory Listings

Thanks!!!
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can. There's a web.xml under %JBOSS_HOME%\server\default\deploy\jbossweb-tomcatxxx.sar\conf folder. Change the value of the 'listings' param for the default servlet to false:



By default, the value is true.
 
Naresh Shaan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks A Lot JaiKiran!!!
 
naveen gupta
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i had the same problem. But after changing it to false it didn't solved my problem. help me
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you change that value? Which file in which folder? Post the contents of the changed file. And did you restart the server after the changes?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic