File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Servicing *all* requests Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Servicing *all* requests" Watch "Servicing *all* requests" New topic
Author

Servicing *all* requests

K Riaz
Ranch Hand

Joined: Jan 08, 2005
Posts: 375
Hello,

Can I prevent clients from directly reaching a web resource (such as a JSP file) via its path name on the server? In such an event, I want it to go through my "controller" servlet so that I can do some checking before the server submits its response.

Thanks.
[ October 26, 2005: Message edited by: K Riaz ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35241
    
    7
The controller parameter can set a request parameter (say, controller=true). In the JSP, you check for the presence of that parameter. If it's absent, you redirect to an appropriate page. This check should live in its own JSP page page, which you include in any page that's not supposed to be directly accessible.


Android appsImageJ pluginsJava web charts
K Riaz
Ranch Hand

Joined: Jan 08, 2005
Posts: 375
Thanks.

Problem solved by adding a mapping to all *.jsp extensions to my controller servlet, which does the checking. Works perfectly.
Sarath Mohan
Ranch Hand

Joined: Mar 17, 2001
Posts: 213
Filter is a better alternative


Sarath Mohan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servicing *all* requests
 
Similar Threads
Tomcat class file problem
Voice Mail
trouble with geronimo plugin for eclipse
Tracking a session between Weblogic and ATG
How do we use global variables in servlets?