更改spring Web应用程序的默认会话超时 [英] Changing the default session timeout of a spring web application

查看:279
本文介绍了更改spring Web应用程序的默认会话超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须测试由spring和jsp编写的Web应用程序。应用程序的默认会话超时为30分钟。

I have to test a web application that is written by spring and jsp. The default session-timeout for the application is 30 min.

我想减少会话超时。为此,我更改了 tomcatInstallationLocation / conf / 中的 web.xml 文件。但它不起作用。 tomcatInstallationLocation / conf / web.xml 中的默认配置为 -

I want to reduce the session-timeout. For doing this, I have changed in the web.xml file in tomcatInstallationLocation/conf/. But it doesn't work. The default configuration in tomcatInstallationLocation/conf/web.xml was -

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

我刚改变时间并制作它 -

Where I've just changed the time and make it -

<session-config>
    <session-timeout>5</session-timeout>
</session-config>

但仍然不起作用。据我所知,在这种情况下,我必须在我的spring应用程序的 web.xml 中进行更改。但我不确定。任何人都可以帮助我吗?

But is still doesn't work. As I know far, in this situation I have to make a change in my spring application's web.xml. But I'm not sure. Can any one help me?

提前致谢。

推荐答案

会话超时层次结构:


  • $ tomcat_home / conf / web.xml

  • $ your_webapp / WEB-INF / web.xml

  • 手动调用 HttpSession.setMaxInactiveInterval(int)

  • $tomcat_home/conf/web.xml
  • $your_webapp/WEB-INF/web.xml
  • manual invocation of HttpSession.setMaxInactiveInterval(int)

每个后续条目都会覆盖上面的其他条目。

Each subsequent entry overrides others above.

这篇关于更改spring Web应用程序的默认会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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