Hi, I need help too...
 
How should I write the "if" that desires if the session is expired???/
thanks
Lucas

Adam Lipscombe <[EMAIL PROTECTED]> escribió:
Folks


Many thanks for all your input on this. I decided to go with the filter
approach.
My doFilter() method is below. I certainly traps the timeout.

The problem now is that the redirect fails no matter if I use
"/pages/SessionTimedOut.jsp" or a fully qualified URL (e.g
"http://localhost:8080/ExpenSysWT/pages/SessionTimedOut.jsp";)


The error message that is logged is: "failed to set redirect, msg = null"


Any help much appreciated


TIA -Adam






----------------------

public void doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
{
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
HttpServletResponse httpServletResponse = (HttpServletResponse)
response;
HttpSession httpSession = httpServletRequest.getSession();

boolean sessionTimedOut = false;

try
{
if (false == httpServletRequest.isRequestedSessionIdValid())
{
sessionTimedOut = true;
}
else
{
String requestedAction = httpServletRequest.getRequestURI();
if (false == requestedAction.endsWith(StrutsConstants.LOGIN_ACTION))
{
if (null != httpSession)
{
if (null == httpSession.getAttribute(Constants.SESSION_CONTEXT))
{
sessionTimedOut = true;
}
}
}
}

if (true == sessionTimedOut)
{
logger.warning("session timed out");
httpServletResponse.sendRedirect("/pages/SessionTimedOut.jsp");
}

chain.doFilter(request, response);

}
catch (Exception ex)
{
String msg = "failed to set redirect, msg = " + ex.getMessage();
logger.severe(msg);
}
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


                
---------------------------------
 A tu celular ¿no le falta algo?
 Usá Yahoo! Messenger y Correo Yahoo! en tu teléfono celular.
 Más información aquí.

Reply via email to