Hi,

I do following:
1.
set filter in web.xml as follow:
<filter>
  <filter-name>sessionExpiredFilter</filter-name>
  <filter-class>
  my.utils.SessionExpiredFilter
  </filter-class>
</filter>
...
<filter-mapping>
  <filter-name>sessionExpiredFilter</filter-name>
  <url-pattern>*.jsf</url-pattern>
</filter-mapping>

2.
And here is my filter class:
public class SessionExpiredFilter {
private String page = "/jsp/login/login.xhtml";

public void destroy() {
}

public void doFilter(ServletRequest request, ServletResponse response,
        FilterChain chain) throws IOException, ServletException {
if (((HttpServletRequest) request).getRequestedSessionId() != null
        && ((HttpServletRequest) request).isRequestedSessionIdValid() == false) 
{
 RequestDispatcher rd = request.getRequestDispatcher(page);
 rd.forward(request, response);
} else {
 chain.doFilter(request, response);
    }
}

public void init(FilterConfig filterConfig) throws ServletException {
if (filterConfig.getInitParameter("page") != null) {
    page = filterConfig.getInitParameter("page");
  }
 }

}

But it doesn't work. If the timeout comes, it dosen't redirect.

Could you please show me your filter class?

Regards

Thomas



Veit Guna <[EMAIL PROTECTED]> schrieb: Hi.

Yes, I use a filter to handle session-timedout requests. The next time an 
invalidated session is requested, a redirect will be done.

Regards,
Veit

-------- Original-Nachricht --------
Datum: Tue, 13 Mar 2007 15:11:45 +0100 (CET)
Von: Thomas Chang 
An: [email protected]
CC: 
Betreff: Question about redirection on timeout

> Hi all,
> 
> I set the timeout in the web.xml and it works find. What I want now is: if
> the timeout comes, it redirects to the login.xhtml. How can I do that?
> Seems I have to rewrite the filter?
> 
> Regards
> 
> Thomas
> 
>    
> ---------------------------------
> Was Sie schon immer wissen wollten aber nie zu Fragen trauten? Yahoo!
> Clever hilft Ihnen.

-- 
"Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
Jetzt GMX ProMail testen: www.gmx.net/de/go/mailfooter/promail-out


                
---------------------------------
Der neue Internet Explorer 7 in deutscher Ausführung ist da!

Reply via email to