升级到jetty 9.4取代HashSessionManager
升级到jetty 9.4后,我注意到org.eclipse.jetty.server.session.HashSessionManager的ClassNotFoundException。 我想我需要使用升级到jetty 9.4取代HashSessionManager,jetty,jetty-9,Jetty,Jetty 9,升级到jetty 9.4后,我注意到org.eclipse.jetty.server.session.HashSessionManager的ClassNotFoundException。 我想我需要使用FileSessionDataStore,但我不知道如何在SessionHandler上设置它 我目前的配置是: <Configure class="org.eclipse.jetty.webapp.WebAppContext"> ... <Set name="s
FileSessionDataStore
,但我不知道如何在SessionHandler
上设置它
我目前的配置是:
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
...
<Set name="sessionHandler">
<New class="org.eclipse.jetty.server.session.SessionHandler">
<Arg>
<New class="org.eclipse.jetty.server.session.HashSessionManager">
<Set name="storeDirectory">my/store/path</Set>
</New>
</Arg>
</New>
</Set>
</Configure>
...
我的/商店/路径
我不知道我需要做什么,
SessionHandler
不接受SessionDataStore
,但是可以在它上面设置SessionCache
,但是它看起来像是SessionCache
的实现想要在构造函数中有一个SessionHandler
,我不知道如何在XML中实现它。啊,我想我已经解决了,不太好,结果是:
<Set name="sessionHandler">
<New class="org.eclipse.jetty.server.session.SessionHandler">
</New>
</Set>
<Call name="getSessionHandler" id="sessionHandler" />
<Ref refid="sessionHandler">
<Set name="SessionCache">
<New class="org.eclipse.jetty.server.session.DefaultSessionCache">
<Arg>
<Ref refid="sessionHandler"/>
</Arg>
<Set name="SessionDataStore">
<New class="org.eclipse.jetty.server.session.FileSessionDataStore">
<Set name="StoreDir">my/store/path</Set>
</New>
</Set>
</New>
</Set>
</Ref>
如果Jetty专家认为这不正确,我很乐意编辑答案,以免误导其他人。在Jetty-9.4会话体系结构中,您有SessionHandler
采用SessionCache
,可以选择采用SessionDataStore
有关编程示例,请参见
该示例使用了NullSessionDataStore
,但原理与FileSessionDataStore
相同,后者取代了旧的HashSessionManager
将会话存储到磁盘的功能
Jetty文档包含信息
如果您遵循文档中的链接,还可以找到有关新会话体系结构的详细信息
正如文档所解释的,当在发行版中运行时,在jetty-9.4中配置会话的最简单方法是启用适当的模块。但是,如果您正在运行embedded,或者您只想为xml格式的特定Web应用程序设置会话管理,下面是一些设置FileSessionDataStore
的示例代码:
/tmp/会议