aspose file tools*
The moose likes Other Java Products and Servers and the fly likes Disable Directory Listings (Jetty webcontainer) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "Disable Directory Listings (Jetty webcontainer)" Watch "Disable Directory Listings (Jetty webcontainer)" New topic
Author

Disable Directory Listings (Jetty webcontainer)

Ashish Uniyal
Greenhorn

Joined: Feb 01, 2003
Posts: 18
Hi,
I want to disable directory listing, I am using jetty 4.2.14 as my web container, just looking for a property to be configured in my web.xml which would restrict directory browsing.

I am tried this congiguration:-
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.mortbay.jetty.servlet.Default</servlet-class>
<init-param>
<param-name>dirAllowed</param-name>
<param-value>false</param-value>
</init-param>
</servlet>

but failed.....

It gives this exception while starting the server:
(Partial trace)
org.mortbay.util.MultiException[javax.servlet.UnavailableException: Configuration problem]

Any input is highly appreciated
Ashish Uniyal
Greenhorn

Joined: Feb 01, 2003
Posts: 18
I figured out the way to restrict directory listing for jetty. Hope this helps ppl in same situation.

edit webdefault.xml and set dirAllowed to false
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.mortbay.jetty.servlet.Default</servlet-class>
<init-param>
<param-name>dirAllowed</param-name>
<param-value>false</param-value>
</init-param>
</servlet>

Note, if no default descriptor is specified then webdefault.xml usually included in jetty.jar is used, which allows directory listing.

this link proved very useful
http://mortbay.org/jetty/faq?s=250-Configuration&t=140xmlwebdefault
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Disable Directory Listings (Jetty webcontainer)