aspose file tools*
The moose likes Servlets and the fly likes Redirecting request to servlet if a certain url is accessed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Redirecting request to servlet if a certain url is accessed" Watch "Redirecting request to servlet if a certain url is accessed" New topic
Author

Redirecting request to servlet if a certain url is accessed

Aleksey Matiychenko
Ranch Hand

Joined: Apr 03, 2001
Posts: 178
I am running an IPlanet web server. I need to have a request redirected to a servlet that would verify user permissions to acess certain folders under my web server. I cannot set permissions individually on all directories because there may be new directories created dynamically. The directories names follow certain rules so I have a way of verifying user permissions based on a given directory name.
Basically what I need is:
If I get a request that looks like /report/GRoup1_Report1/mydate.txt
redirected to a SecurityServlet. The security servlet should know the original request so it can figure out user permissions.

Any ideas ?
Thanks.
Julia Reynolds
Ranch Hand

Joined: May 31, 2001
Posts: 123
You can map a certain extension to a servlet in your web.xml file
like this:
<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>SecurityServlet</servlet-name>
<url-pattern>*.txt</url-pattern>
</servlet-mapping>
Julia

[This message has been edited by Julia Reynolds (edited June 13, 2001).]
Aleksey Matiychenko
Ranch Hand

Joined: Apr 03, 2001
Posts: 178
I am not very familiar with how I would web.xml file. Could you please explain ?
Thanks
Julia Reynolds
Ranch Hand

Joined: May 31, 2001
Posts: 123
This is an explanation from the iplanet online documentation:
Web Application Structure
--------------------------------------------------------------------------------
Web Applications have a directory structure, all accessible from a mapping to the application's document root (for example, /catalog). The document root contains JSP files, HTML files, and static files such as image files.
A special directory under the document root, WEB-INF, contains everything related to the application that is not in the public document tree of the application. No file contained in WEB-INF can be served directly to the client. The contents of WEB-INF include:

/WEB-INF/web.xml, an XML-based deployment descriptor that specifies the web application configuration, including mappings, initialization parameters, and security constraints.
/WEB-INF/classes/*, the directory for the servlet and utility classes.
/WEB-INF/lib/*.jar, the directory for the JAR files containing servlets, beans, and other utility classes.
Julia
Aleksey Matiychenko
Ranch Hand

Joined: Apr 03, 2001
Posts: 178
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Redirecting request to servlet if a certain url is accessed