This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Tomcat and the fly likes restricted files access using apache/jakarta tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "restricted files access using apache/jakarta tomcat" Watch "restricted files access using apache/jakarta tomcat" New topic
Author

restricted files access using apache/jakarta tomcat

sridhar vedhanabatla
Greenhorn

Joined: Feb 21, 2007
Posts: 12
I need to restrict access to urls having .pdf and .doc file at end. I need to block access to folders. Actually the folder nesting is like A/B/C. Folder C is having .doc and .pdf files. Right now tomcat is allowing access to url http://localhost:8080/A/B and it is showing all files in B folder. url http://localhost:8080/A/B/C is showing all files in folder C. I need to allow url of type http://localhost:8080/A/B/C/*.pdf or http://localhost:8080/A/B/C/*.doc

Thanks in advance.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12809
    
    5
Directory displays are handled by the DefaultServlet as configured in the default web.xml file. There are a number of configuration parameters, including "listings" - set that to false and Tomcat will not do any directory listings. You could then handle security and file serving in a custom servlet for that application.

You can also create a modified version of DefaultServlet or use XSLT to customize the display generated by DefaultServlet.

Bill
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: restricted files access using apache/jakarta tomcat