Hi All,
I need some help with this problem.
1. I want to click on a hyperlink, and redirect that page to a Security Servlet, which
verifies if the user is logged in or not. This piece is done.
2. Within the security servlet, I want to save the original url of the hyperlink, and
if the user is verified, redirect to that url.
So far this is the code I have from the servlet:
*******************************************************************
// DOES THE SESSION INDICATE THIS USER IS ALREADY LOGGED IN?
Object loggedIn = session.getValue("logon.isDone"); // MARKER OBJECT
if (loggedIn == null)
{
// NO logon.isDone, THIS USER IS NOT LOGGED IN
// SAVE THE REQUEST URL AS THE TRUE TARGET AND REDIRECT TO THE LOGIN PAGE
session.putValue("OriginalTarget", HttpUtils.getRequestURL(req).toString());
res.sendRedirect(req.getScheme() + "://" + req.getServerName() + ":" +
req.getServerPort() + "/Login.html");
return;
}
else
{
// Try redirecting the client to the page he first tried to access
try
{
String target = (String)session.getValue("OriginalTarget");
if (target != null)
res.sendRedirect(target);
else
out.println("No target specified");
return;
}
catch (Exception ignored) { }
}
*******************************************************************
Thanks for any help,
Brian.
P.S. GUINESS IS GOOD FOR YOU :)
Get your FREE Email at http://mailcity.lycos.com
Get your PERSONALIZED START PAGE at http://my.lycos.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html