• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

URGENT: Disabling directory listing in Tomcat 4.0

 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have developed an application in jsp using Apache Tomcat 4.0. Application default page is a jsp page and not a index.html. but when user access the site, it displays list of files present in that folder.
In simple words, how to disable directory and files listing for the end user using Apache- Tomcat 4.0
Thanks
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Afroz Khan:
Hi,
I have developed an application in jsp using Apache Tomcat 4.0. Application default page is a jsp page and not a index.html. but when user access the site, it displays list of files present in that folder.
In simple words, how to disable directory and files listing for the end user using Apache- Tomcat 4.0
Thanks


write an entry in web.xml for welcome page pointing to ur first JSP
 
Afroz Khan
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Gautam
Can u give an example for this. As to what is the tag to be used in web.xml
Thanks
Afroz
 
gautam shah
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Afroz Khan:
Thanks Gautam
Can u give an example for this. As to what is the tag to be used in web.xml
Thanks
Afroz


<welcome-file-list>

<welcome-file>/entry_page.jsp</welcome-file>
</welcome-file-list>
this path is relative to ur application context
 
Afroz Khan
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi gautam,
i guess i put the question in a different way. i mean we have a access folder. my application is http://127.0.0.1/gdc/Login.jsp
and when the user enters the url till like http://127.0.0.1/gdc it displays the liting of the files and folders.
Thanks
Afroz
 
gautam shah
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Afroz Khan:
Hi gautam,
i guess i put the question in a different way. i mean we have a access folder. my application is http://127.0.0.1/gdc/Login.jsp
and when the user enters the url till like http://127.0.0.1/gdc it displays the liting of the files and folders.
Thanks
Afroz


just put ur login.jsp in gdc folder.
write followinf entry in web.xml
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
then type URL http://127.0.0.1/gdc
and see what happened.
I've had tested this thing already on tomcat.
and if after that it doesn't work then u just contact me on gautam_shah_29@yahoo.com . i am online there . i will show u on my static machiene.
 
Afroz Khan
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Gautam
I got my problem solved and its working fine now. Thanks again
Afroz
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
If suppose i have several folders in my web app, then how can i acheive this.
Because obviously there can be only one welcome file for a web aplication.
Thank you,
Sony gam
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Web.xml, set the listing attribute to false to disable the directory browsing.
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
Hope this helps...
Regards
jagan
 
sampy jagan
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, Ignore my prev reply.
For Tomcat change the listings attribute of the StaticInterceptor to false in Server.xml
Ex:
<StaticInterceptor listings="false" />
Regards
jagan
 
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sony
For every context(Folder) in tomcat there is web.xml file in WEB-INF folder,so for every contecxt u need to make change in that file
hope this helps
..Praful
 
reply
    Bookmark Topic Watch Topic
  • New Topic