更改cookie JSESSIONID名称 [英] Changing cookie JSESSIONID name

查看:823
本文介绍了更改cookie JSESSIONID名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个必须在单个物理设备中运行多个tomcat服务器的要求.从浏览器访问这些文件时,当用户在应用程序之间切换时,将导致注销用户先前访问的应用程序.这是因为JSESSIONID Cookie冲突.

I have a requirement of having to run multiple tomcat server in single physical box. While accessing these from a browser, when user switches between the applications, it results in logging out the user previously access application. This is because of JSESSIONID cookie conflict.

一个可能的解决方案是在不同的上下文中运行每个应用程序.不幸的是,我的应用程序无法在上下文路径设置中运行,因为前面没有使用request.getContextPath()访问任何资源.

One possible solution is to run each applications in different context. Unfortunately, my applications will not work in context path setting as none of the resources are accessed with request.getContextPath() prepended in front.

这使我可以更改cookie JSESSIONID的名称来解决冲突.有没有办法做到这一点?如果是,怎么办?

This leaves me to change the name of cookie JSESSIONID to resolve the conflict. Is there a way to do this? If yes, how?

希望我清楚地说出我的问题.

Hope I'm clear in stating my question.

注意:我所有的应用程序都在同一台计算机的不同端口上运行.

Note: All my application are running in different port in the same machine.

推荐答案

使用Servlet API 3.0,一切都变得更加简单.

Everything is much simpler with Servlet API 3.0.

现在您可以在web.xml中对其进行配置:

Now you can configure it in your web.xml:

<session-config>
    <cookie-config>
        <name>MY_JSESSIONID_YAHOOOOOO</name>
    </cookie-config>
</session-config>

就是这样!

这篇关于更改cookie JSESSIONID名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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