I'm got a simple CustomRequestProcessor which checks for the presence of a user login bean, and if not found, it should bounce the request to my logon page.
Problem: how can I say "Go to the Struts Forward /logon" from within the CustomRequestProcessor?
Bonus points: how can I stop the browser's 'Back' key letting the user cheat...
protected boolean processPreprocess(HttpServletRequest request,
HttpServletResponse response)
{
final HttpSession session = request.getSession(false);
final Logger log = Logger.getLogger(this.getClass());
final String path = request.getServletPath();
if (path.equals("/logon") || path.equals("/logon.do"))
{
return true;
}
if (session != null
&&
session.getAttribute(ApplicationAttributes.USER_KEY) != null)
{
if (log.isDebugEnabled())
{
log.debug("User bean located in session. Permitting request...");
}
return true;
}
else
{
if (log.isDebugEnabled())
{
log.debug("No user bean located in session. Refusing request and forwarding to logon...");
}
try
{
// ***************************************
// ***************************************
// ** HOW CAN I MAKE THIS CALL A STRUTS **
// ** FORWARD CALLED '/logon' INSTEAD? **
// ***************************************
// ***************************************
request.getRequestDispatcher(
"/logon/logon.jsp").forward(request, response);
}
catch(Exception e)
{
log.error("Unable to forward to /logon",e);
}
}
return false;
}
-- David Kennedy Swan Labs http://www.swanlabs.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]