aspose file tools*
The moose likes Tomcat and the fly likes Restricting directory access in Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Restricting directory access in Tomcat" Watch "Restricting directory access in Tomcat" New topic
Author

Restricting directory access in Tomcat

Sathya Srinivasan
Ranch Hand

Joined: Jan 29, 2002
Posts: 379
Hi,
I am developing a personal site that hosts my MP3 collection. I have a created a nice db and a couple of servlets/jsp pages that access the files and create a playlist according to some parameters from user (artist=Beatles, etc.).
Due to the copyright issues and stuff, I would like to do the following.
1. Assume that my song is in a location called http://www.mysite.com/music/Beatles/eightdays.mp3
2. Assume that my jsp is in a location called http://www.mysite.com/music/index.jsp
My dilemma is this.
I would like to give access in Tomcat (4.0) in such a way that when I acess the URL in (1) from URL in (2), it should be able to do so without a problem, but
When someone directly accesses URL in (1), it should be denied.
In other words, a particular directory in my site should be accessible from the links in my own site, but should be inaccessible to direct queries from other sites (external IPs).
Ex.
Access from IP 1.2.3.4 (my site) to 'Beatles' directory should be allowed.
Access from IP 3.4.5.6 (any other site) to 'Beatles' directory should be denied.
Is there anyway to achieve this in Tomcat?? Any help would be greatly appreciated.


Cheers, Sathya Srinivasan - SCJP 1.2, SCWCD 1.2, SCMAD 1.0
Co-Author of Whizlabs SCMAD Certification Exam Simulator and SCMAD Exam Guide Book
 
 
subject: Restricting directory access in Tomcat