Hi,
I have overridden the processActionPerform method to cause the user to be
redirected to a login page if they are entering a "closed" area and have not
previously loggged in. The code below shows my initial attempt. What is
the accepted way of doing this? I assume there must be a cleaner way.
boolean isClosedArea = portalMapping.getIsClosedArea();
String userName = (String)session.getAttribute("USERNAME");
if ( isClosedArea && (userName == null || userName == "") )
{
// store requestPath so that we can use it when log in is successful
session.setAttribute("REQUEST_PATH", mapping.getPath());
return new ActionForward("/loginpage.do");
}
else
{
// If REQUEST_PATH is set, then this action was dynamically inserted
before
// original request. Make sure we redirect to original request when
// action completes.
String requestPath=(String)session.getAttribute("REQUEST_PATH");
if ( requestPath != null && requestPath != "" )
{
session.setAttribute("REQUEST_PATH", "");
super.processActionPerform(action,mapping, formInstance, request,
response);
return new RedirectingActionForward(requestPath + ".do");
}
return super.processActionPerform(action,mapping, formInstance,
request, response);
}
Thanks,
John O'Reilly
Traventec
Phone: +353 91 518786
Fax: +353 91 525056
Email: [EMAIL PROTECTED]
www.traventec.com