java - Servlet 2.3规范中关于Websphere session 管理策略和 session 相关内容的一些疑问

标签 java session jakarta-ee tomcat websphere

在文档 Websphere Application Server Information Center - Clustered session support 中,它说

The session management facility requires an affinity mechanism so that all requests for a particular session are directed to the same application server instance in the cluster. This requirement conforms to the Servlet 2.3 specification in that multiple requests for a session cannot coexist in multiple application servers.

是不是说Websphere只能支持粘性 session (session affinity)机制?如果没有,如何在 Websphere 上配置以支持非粘性 session 策略?

Servlet 2.3 specification, SRV.7.7.2 Distributed Environments

Within an application marked as distributable, all requests that are part of a session must handled by one virtual machine at a time.

根据这个规范,它假设我们应该遵循这个规则,但是我们可以在Apache + Tomcat集群上使用非粘性 session 策略,这不是违反规则吗?

欢迎任何回复。

最佳答案

关于您的第二个问题:如果您在 Apache 服务器后面使用 Tomcat,则您使用的组件(Apache 服务器)不符合 JEE,因此它不必遵循任何 JEE 规则。

关于您的第一个问题,对于 Websphere,您可以在使用代理服务器、HTTP 插件和实现您自己的代理解决方案之间进行选择:

http://pic.dhe.ibm.com/infocenter/clmhelp/v4r0m3/index.jsp?re=1&topic=/com.ibm.jazz.install.doc/topics/t_config_reverse_proxy_ihs.html&scope=null

http://www.ibm.com/developerworks/websphere/techjournal/1010_pape/1010_pape.html

您可以通过 plugin-cfg.xml 文件中的 CloneiD 属性忽略 session 关联

http://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/rwsv_plugincfg.html

CloneID (zero or one attribute for each Server) If this unique ID is present in the HTTP cookie header of a request (or the URL if using URL rewriting), the plug-in routes the request to this particular server, provided all other routing rules are met. If a CloneID is not specified in the Server, then session affinity is not enabled for this server.

关于java - Servlet 2.3规范中关于Websphere session 管理策略和 session 相关内容的一些疑问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20947495/

相关文章:

java - 用正则表达式替换特定标识符

jquery - 使用 jQuery 的 ASP.NET MVC session

javascript - 为什么对对象的引用被其值替换

java - 什么是 "programmatic server-side includes"?

java - 数字作为 Android 通知的图标

java - Java 中的模数

java - 如何访问我的 EAR 的部署信息

Spring Web应用程序在启动时从数据库初始化

java - Android下载drawable到Arraylist<Integer>

python - Flask SecureCookie用json替换pickle导致编码错误