Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Restricting JSP page to get access directly  RSS feed

 
vk jain
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In my application i have jsp pages outside the WEB-INF directory. I can access the a particular jsp page typing its URL directly in address bar. How can i restrict it.

I can't move all JSP into WEB-INF folder as they are in large number and also have dependency of path.

Any help is appreciated!!!
 
cj jayamaha
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont think the standard is to have JSP pages inside the WEB-INF/ folder. Then again why put JSP pages in WEB-INF folder, cos it is there for you lib, classes and tlds.

How ever if you are trying to secure the files then you can add a value to your session object and check it on every page that should not be accessed by the browser and forward to an appropriate page if the value not found. That is what I do ..

how ever there are lots of other methods .. read this thread.. http://forums.sun.com/thread.jspa?messageID=2959387
 
vk jain
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please elaborate this solution a little. when should i add a attribute in session. Is it at time of login or ?
 
kurt hanni
Ranch Hand
Posts: 140
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you could write a security-constraint in the DD for the pages you want to have restricted access.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66188
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by cj jayamaha:
I dont think the standard is to have JSP pages inside the WEB-INF/ folder.
Incorrect. It is very common to place the JSP page under WEB-INF so that they can only be accessed via their page controllers and not by direct URL access.

...cos it is there for you lib, classes and tlds.
Please use real words when posting to the forums. Abbreviations such as "cos" in place of "because" only serve to make your posts more difficult to read and less likely to generate useful responses. Please read this for more information.
 
Victor Dolirio
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the best solution for your situation is to insert in the DD a security constraint, with the <auth-constraint/> tag just in that way.
 
vk jain
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Victor,
Its work.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!