开发者

JBoss Session Timeout

开发者 https://www.devze.com 2023-01-05 21:10 出处:网络
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.

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.

I am using JBoss 5.1, 开发者_如何学Pythonand 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.

In a tomcat environment, I haven't had this problem. Has anyone had a similar problem with JBoss?


JBoss 5 allows you to define a session timeout for all applications at:

deployers/jbossweb.deployer/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 seconds)

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


Sadly in JBoss EAP 6.1.0.Alpha1 (AS 7.2.0.Alpha1-redhat-4) we're back to having to set it per web app in web.xml: See the JBoss docs.

Which say use this:

<session-config>
    <session-timeout>30</session-timeout>
</session-config>


In case of some settings JBoss overrides the ones you provide in web.xml . You need to specify the same in a config file named "jboss-web.xml" to apply this setting. You can place this file next to the web.xml, in the same folder.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<jboss-web>  
  <session-config>
    <session-timeout>1</session-timeout>
  </session-config>
</jboss-web>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号