• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Disable Directory Listings (Jetty webcontainer)

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
We cannot change unless we survive, but we will not survive unless we change. Evolving tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic