This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Reading user URL  RSS feed

 
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want that when the user came to login then login servlet should remember the target URL and after verification it should redirect to the target URL from which the user came

kind regards
 
Rancher
Posts: 42975
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, that's how servlet security works. If a user accesses a protected URL, the server redirects him/her to the login page, and after successfully logging in, redirects back to the originally requested page.

So, your starting URL should not be a login page, but the protected start page, in other words, the main menu (or whatever makes sense for your web app).
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use Request.getURL() method to get url and after verification and validation redirect the same url to user - Cheers Manoj
[ September 11, 2008: Message edited by: in Mkumar ]
 
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do agree with Ulf, as you need not do anything for this redirection to happen. Access to authorized pages will redirect to login page and after successful login, fall back to authenticated page user was willing to access.

Defining the authenticated resources under security constraint in web.xml and having configuring login page (if custom login page required) will do the desired favor.
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Chandra Bhatt:
I do agree with Ulf, as you need not do anything for this redirection to happen. Access to authorized pages will redirect to login page and after successful login, fall back to authenticated page user was willing to access.

Defining the authenticated resources under security constraint in web.xml and having configuring login page (if custom login page required) will do the desired favor.



Can you please quote any example web.xml that deals this scenario?

Kind regards
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by in Mkumar:
You can use Request.getURL() method to get url and after verification and validation redirect the same url to user - Cheers Manoj

[ September 11, 2008: Message edited by: in Mkumar ]



Dear Kumar,
Its not work with me, may be it need some package to import.

best regards
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am still not clear regarding your requirements.
I would suggest, You need to clear about functionality and responsibilty of Servlet.

You can retrieve Request information using,
request.getRequestURL();
or.
request.getRequestURI();

Now for it depends on how you want to send response.
response.Redirect("http://www.google.com");
or
request.getRequestDispatcher("test.jsp").forward(request, response);


I hope you got your answer.

Sanjay
 
Ulf Dittmer
Rancher
Posts: 42975
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Folks, please take the time to read what is being asked, and if you're not familiar with servlet security -which is what the question is about- try not to confuse the issue by suggesting that the wheel be reinvented.

Servlet security does the redirecting automatically. There's no need whatsoever to do that in your servlet code. There's an extensive introduction available here.
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
Folks, please take the time to read what is being asked, and if you're not familiar with servlet security -which is what the question is about- try not to confuse the issue by suggesting that the wheel be reinvented.

Servlet security does the redirecting automatically. There's no need whatsoever to do that in your servlet code. There's an extensive introduction available here.



Great!

I think that's what I was looking for

thanks a lot
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!