SRy*_*SRy 6 java jsf listener session-timeout
我试图在Tomcat 7应用服务器上设置我的应用程序超时.首先我在web.xml中测试我的超时为一分钟
<session-config>
<session-timeout>1</session-timeout>
</session-config>
Run Code Online (Sandbox Code Playgroud)
and I am using HttpSessionListener to make sure my Timeout is working fine.I declared my sessionListener Class in web.xml .
public class HttpSessionChecker implements HttpSessionListener {
public void sessionCreated(HttpSessionEvent event) {
System.out.printf("Session ID %s created at %s%n", event.getSession().getId(), new Date());
}
public void sessionDestroyed(HttpSessionEvent event) {
System.out.printf("Session ID %s destroyed at %s%n", event.getSession().getId(), new Date());
}
}
Run Code Online (Sandbox Code Playgroud)
and In web.xml
<listener>
<listener-class>com.test.util.HttpSessionChecker</listener-class>
</listener>
Run Code Online (Sandbox Code Playgroud)
But when start my server and launch my application I see session is initiated on the Login page only .
Session ID 934073ED5E9933158995EE5EB680D3F7 created at Wed Nov 07 09:39:13 PST 2012
Run Code Online (Sandbox Code Playgroud)
and when I stay Idle for more than a minute or some times more than five minutes cause Tomcat don't fire Timeout immediately in my application and click on something in my application Session is not Expired.Still I am able to navigate another page.But When I am stay Idle on the login page or logged-out I see the session is destroyed. But when once Login is done and when I am inside the application session timeout is not happening. I see
Session ID 934073ED5E9933158995EE5EB680D3F7 destroyed at Wed Nov 07 09:42:13 PST 2012
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?而且即使我提到<session-timeout>的web.xml,我需要的代码session.invalidate某处代码?如何login.xhtml在JSF中销毁的会话中重定向到?
你做错了什么.当会话到期时,后台线程将每隔x分钟检查一次.这是特定于容器的.也就是说,在您指定的时间之后不能保证过期.我知道在tomcat中你可以在server.xml文件中轻松修改这个检查间隔.
| 归档时间: |
|
| 查看次数: |
10706 次 |
| 最近记录: |