JBoss会话超时 [英] JBoss Session Timeout
问题描述
我正在尝试编写我的应用程序的一部分,以便它可以优雅地处理会话超时,但是我似乎无法控制在发生超时以进行测试之前的持续时间.
I'm trying to write the part of my app so that it handles session timeouts gracefully, but I can't seem to control how the duration of time before a timeout occurs for testing.
我正在使用JBoss 5.1,并且正在修改我的Web描述符(web.xml)的session-config,以便会话在一分钟后超时(仅用于测试)
I am using JBoss 5.1, and I am modifying the session-config my web descriptor (web.xml) such that the session times out after a minute (just for testing)
<session-config>
<session-timeout>1</session-timeout>
</session-config>
但是在通过登录创建会话之后,它永远不会超时.我给它的任何设置都不会导致超时.
But after creating a session by logging in, it never times out. No setting that I give it causes a timeout.
在tomcat环境中,我没有遇到这个问题.有没有人对JBoss有类似的问题?
In a tomcat environment, I haven't had this problem. Has anyone had a similar problem with JBoss?
推荐答案
JBoss 5允许您在以下位置为所有应用程序定义会话超时:
JBoss 5 allows you to define a session timeout for all applications at:
deployers/jbossweb.deployer/web.xml
可能是覆盖您在 web.xml 中的设置.它不应该,但是,你知道...
It may be that is overriding your settings in web.xml. It shouldn't, but, you know...
检查更改是否有效.如果没有,您可以通过编程方式为测试设置超时时间:
Check if changing that is working. If not, you can set up the timeout programatically for your test:
HttpSession.setMaxInactiveInterval(秒)
这样,您可以在特定会话中强制超时.
That way you can force the timeout in a particular session.
这篇关于JBoss会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!