JBoss 会话超时 [英] JBoss Session Timeout

查看:23
本文介绍了JBoss 会话超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写我的应用程序的一部分,以便它优雅地处理会话超时,但我似乎无法控制测试超时之前的持续时间.

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(int 秒)

这样您就可以在特定会话中强制超时.

That way you can force the timeout in a particular session.

这篇关于JBoss 会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆