Tomcat 7:在会话超时的情况下重定向 URL [英] Tomcat 7 : Redirect URL in case of session timeout

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

问题描述

我在 tomcat 7 的 web.xml 中有以下配置.我想知道我是否可以在这里添加任何可配置的参数,以便如果用户尝试在 30 分钟后执行任何操作,我将重定向用户访问我们的主页.

I have following configuration in web.xml in tomcat 7. I am wondering if I can add any configurable parameter here, so that if user tries to do any operation post 30 minutes, I redirect the user to our home page.

<session-config>
      <session-timeout>30</session-timeout>
      <cookie-config>
              <domain>mydomain.mycompany.com</domain>
              <http-only>true</http-only>
              <secure>false</secure>
      </cookie-config>
      <tracking-mode>COOKIE</tracking-mode>
</session-config>

推荐答案

这可能仅通过配置是不可能的.您还必须添加过滤器.此处描述了一种方法:https://stackoverflow.com/a/1027592/3417638

This is probably not possible by configuration only. You will have to add a filter aswell. One way of doing that is described here: https://stackoverflow.com/a/1027592/3417638

如果您想在 web.xml 中配置重定向,可以使用上下文参数来完成,请参阅:https://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Context_Parameters

If you would like to configure the redirect in web.xml, this can be done by using a context-parameter, see: https://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Context_Parameters

这篇关于Tomcat 7:在会话超时的情况下重定向 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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