• 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

Servicing *all* requests

 
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
K Riaz
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.

Problem solved by adding a mapping to all *.jsp extensions to my controller servlet, which does the checking. Works perfectly.
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Filter is a better alternative
 
reply
    Bookmark Topic Watch Topic
  • New Topic