有什么办法在tomcat中的不同应用程序之间共享会话状态? [英] Any way to share session state between different applications in tomcat?

查看:100
本文介绍了有什么办法在tomcat中的不同应用程序之间共享会话状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们希望将工作应用程序拆分为两个不同的 .war 文件,以便能够在不影响另一个应用程序的情况下更新一个应用程序。每个webapp将具有不同的UI,不同的用户和不同的部署计划。

We want to split a working application in two different .war files in order to be able to update one app without affecting the other. Each webapp will have different a UI, different users and different deploy schedule.

最简单的路径似乎是共享相同的会话,所以如果app A设置 session.setAttribute(foo,bar) app B将能够看到它。

The easiest path seems to be sharing the same session, so if app A set session.setAttribute("foo", "bar") app B will be able to see it.

有没有办法分享 HttpSession 同一个Tomcat实例中的两个应用程序的状态?

Is there a way to share the HttpSession state for both apps in the same Tomcat instance?

我们的应用程序运行在专用的Tomcat 5.5上,没有其他应用程序在同一个tomcat实例上运行,所以任何关于会话共享的安全问题不是问题。我们正在运行多个Tomcat实例,但平衡器正在使用粘性会话。

Our app is running on a dedicated Tomcat 5.5, there are no other apps running on the same tomcat instance, so any security concerns regarding the session sharing are not a problem. We're running multiple Tomcat instances, but the balancer is using sticky sessions.

如果不可能或此会话共享非常糟糕想法请发表评论。

If it's not possible or this session sharing is a really bad idea please leave a comment.

推荐答案

你不应该分享HttpSession;但你可以分享其他对象。例如,您可以通过JNDI注册对象和访问所有应用程序中的相同对象(数据库使用此对象进行池连接)。

You should not share HttpSession; but you can share other objects. For example, you can register an object via JNDI and access the same object in all your apps (databases use this to pool connections).

这篇关于有什么办法在tomcat中的不同应用程序之间共享会话状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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