• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help in j_security_check based authentication

 
Naseem Khan
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using form based authentication for accessing certain protected resource. This is what I have specified in web.xml for j_security_check



There is a link in my home page from where a user can download pdfs. If user is not logged in, login.jsp page opens where user enters his credentials and if login is successfull (data access by jdbc realm), requested pdf gets open.

URL which actually forward to login.jsp is:

http://localhost/contextName/pdfs/xyz.pdf

In login.jsp page, I want this pdfs url pattern i.e., /pdfs/xyz.pdf. Can I get that? I tried by request.getRequestURI(), but this gives me /login/login.jsp

Since there is a forward, that's why I am getting /login/login.jsp. Can I get back uri of the link which forward to login.jsp i.e., /pdfs/xyz.pdf

I hope problem is now clear to everybody

Thanks and Regards
 
Mukesh Mittal
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will always get Login page uri.

If you use filter with this scenario then you can get original uri.
 
Mika Leino
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

In case you haven't found a solution for your problem then here is one. I needed this very information not long ago and found that the original servlet path can be retrieved from the ServletRequest's parameter "javax.servlet.forward.servlet_path".

Edit: Note, this parameter name works in Tomcat, if you are using a different container then the path can be saved in a different way.
[ February 27, 2007: Message edited by: Mika Leino ]
 
Naseem Khan
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mika,


Thanks for your reply. I did something like this to retrieve the pdf_uri.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!