如何关闭 geronimo 的 session 持久性?这是我应该做的事情吗? - 我的应用程序中没有使用持久 session 。 (这是因为我在控制台中收到一个不可序列化的错误,但我不想序列化)

最佳答案

这取决于您在 Geronimo 中使用的 Web 容器; Tomcat 和 Jetty 都支持。

Tomcat

将 context.xml 文件添加到您的应用程序或添加以下节点:

<Context><Manager className="org.apache.catalina.session.StandardManager"
  pathname=""></Manager></Context>

从 tomcat docs for pathname:可以通过将此属性设置为空字符串来禁用重新启动持久性。

这些属性在以下链接中进行了解释:

https://cwiki.apache.org/GMOxDOC22/configuring-session-manager-of-tomcat.html

http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html#Standard_Implementation

码头

默认情况下,此容器不保留 session ,因此除了确保未启用 SessionHandler 之外,无需执行任何操作。如果上下文配置中存在 sessionHandler 节点,请删除它。
<Set name="sessionHandler">
<New class="org.eclipse.jetty.servlet.SessionHandler">
  <Arg>
    <New class="org.eclipse.jetty.servlet.HashSessionManager">
      <Set name="storeDirectory">your/chosen/directory/goes/here</Set>
    </New>
  </Arg>
</New></Set>

资料链接:

http://wiki.eclipse.org/Jetty/Howto/Persisting_Sessions

关于session - 如何在 geronimo/tomcat 中关闭 session 持久性,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8181664/

10-10 14:06
查看更多