使用spring3检测会话过期或会话超时

问题描述:

如何使用spring3检测会话过期或会话超时。使用spring3检测会话过期或会话超时

+0

你是什么意思“检测”?你想在哪里发现它? – cdeszaq

+0

@cdeszaq:我会假设他的意思是触发一些功能 – Ralph

+0

请添加一些细节。您的用户是否通过弹簧安全认证?你想用JavaScript动态处理过期的会话,还是静态地通过重定向到其他页面?你的用例是什么? – nont

的关键是这样的:

<beans:bean id="concurrencyFilter" 
     class="org.springframework.security.web.session.ConcurrentSessionFilter"> 
    <beans:property name="sessionRegistry" ref="sessionRegistry" /> 
    <beans:property name="expiredUrl" value="/session-expired.htm" /> 
</beans:bean> 

expiredUrl指向的页面时,会话已过期显示。阅读规范中的完整解决方案:

http://static.springsource.org/spring-security/site/docs/3.0.x/reference/session-mgmt.html#concurrent-sessions