`
weifly
  • 浏览: 235932 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

jetty-如何配置会话ID

 
阅读更多

jetty中文文档:www.jettycn.com

 

 

如何配置会话ID(Session IDs)

Jetty >> howto >> 如何配置会话ID(Session IDs)

介绍

应用下面的配置可以修改web应用程序的会话(session)特性:

步骤

Init参数

Context Parameter名称 默认值 描述
org.eclipse.jetty.servlet.SessionCookie JSESSIONID 会话cookie名称默认为JSESSIONID,特定的web应用可以通过这个context param设置为其他值。
org.eclipse.jetty.servlet.SessionIdPathParameterName jsessionid 会话URL参数名称。默认值为jsessionid,特定的web应用可以通过这个context param设置为其他值。设置为"none",则禁用URL重写。
org.eclipse.jetty.servlet.SessionDomain - 会话域。如果这个属性做为一个ServletContext参数设置了,那么它的值将用作会话cookie的域。如果不设置,则没有为会话cookie指定域。
org.eclipse.jetty.servlet.SessionPath - 会话路径。如果这个属性做为一个ServletContext参数设置了,那么它的值将用作会话cookie的路径。如果不设置,则context path将用作会话cookie的路径。
org.eclipse.jetty.servlet.MaxAge -1 会话的Max Age。如果这个属性做为一个ServletContext参数设置了,那么它的值将用作会话cookie的max age。如果不设置,则max age的值为-1。

示例

以上的配置即可以做为<context-param>设置在web应用程序的WEB-INF/web.xml文件中,就像这样:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app
  xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  version="2.5">
  ...
  <context-param>
    <param-name>org.eclipse.jetty.servlet.SessionCookie</param-name>
    <param-value>XSESSIONID</param-value>
  </context-param>
  <context-param>
    <param-name>org.eclipse.jetty.servlet.SessionIdPathParameterName</param-name>
    <param-value>xsessionid</param-value>
  </context-param>
  ...
</web-app>

也可以设置到配置web应用程序的Jetty上下文xml文件中(WebAppContext好像没有setInitParams方法了):

<Configure class="org.mortbay.jetty.webapp.WebAppContext">
  <Set name="contextPath">/test</Set>
  <Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/test</Set>
  ...
  <Set name="initParams">
    <Map>
      <Entry>
        <Item>org.eclipse.jetty.servlet.SessionCookie</Item>
        <Item>XSESSIONID</Item>
      </Entry>
      <Entry>
        <Item>org.eclipse.jetty.servlet.SessionIdPathParameterName</Item>
        <Item>xsessionid</Item>
      </Entry>
    </Map>
  </Set>
</Configure>

要了解关于param的更多信息,请查看org.eclipse.jetty.server.SessionManager类的源码:http://download.eclipse.org/jetty/stable-7/xref/org/eclipse/jetty/server/SessionManager.html

其他资源

有关详细信息,请参阅基于数据库的Session集群配置教程 教程。

分享到:
评论

相关推荐

    eclipse jetty插件run-jetty-run-1.3.3

    eclipse jetty插件,从...下载run-jetty-run.zip文件,解压后再编写个links文件丢到eclipse的dropins目录下即可,省去了使用eclipse update方式安装的麻烦。 link文件样例如: path=d:\\eclipse_plugins\\run-jetty-run

    jetty-util-6.1.26-API文档-中英对照版.zip

    赠送jar包:jetty-util-6.1.26.jar; 赠送原API文档:jetty-util-6.1.26-javadoc.jar; 赠送源代码:jetty-util-6.1.26-sources.jar; 赠送Maven依赖信息文件:jetty-util-6.1.26.pom; 包含翻译后的API文档:jetty-...

    jetty-http-9.4.11.v20180605-API文档-中英对照版.zip

    赠送jar包:jetty-http-9.4.11.v20180605.jar; 赠送原API文档:jetty-http-9.4.11.v20180605-javadoc.jar; 赠送源代码:jetty-http-9.4.11.v20180605-sources.jar; 赠送Maven依赖信息文件:jetty-...

    run-jetty-run 1.3.5eclipse插件包

    run-jetty-run 1.3.5(Nightly) 在eclipse 4.5.2中安装jetty插件,然后提取plugins和features目录中的相关文件,打包做成可用link方式安装,省去更换eclipse版本时需要重新下载的问题。 安装方法为新加一个run-jetty...

    jetty相关的全部jar包

    jetty-security-9.4.8.v20171121.jar,jetty-io-9.4.8.v20171121.jar,jetty-continuation-9.4.8.v20171121.jar,jetty-client-9.4.8.v20171121.jar,jetty-jmx-9.4.8.v20171121.jar,jetty-plus-9.4.8.v20171121....

    jetty-all-9.4.47.v20220610-uber.jar

    jetty-all-9.4.47.v20220610-uber.jar

    jetty-server-8.1.8-API文档-中英对照版.zip

    赠送jar包:jetty-server-8.1.8.jar; 赠送原API文档:jetty-server-8.1.8-javadoc.jar; 赠送源代码:jetty-server-8.1.8-sources.jar; 赠送Maven依赖信息文件:jetty-server-8.1.8.pom; 包含翻译后的API文档:...

    jetty-security-9.3.19.v20170502-API文档-中英对照版.zip

    赠送jar包:jetty-security-9.3.19.v20170502.jar; 赠送原API文档:jetty-security-9.3.19.v20170502-javadoc.jar; 赠送源代码:jetty-security-9.3.19.v20170502-sources.jar; 赠送Maven依赖信息文件:jetty-...

    jetty-server-8.1.8.v20121106-API文档-中文版.zip

    赠送jar包:jetty-server-8.1.8.v20121106.jar; 赠送原API文档:jetty-server-8.1.8.v20121106-javadoc.jar; 赠送源代码:jetty-server-8.1.8.v20121106-sources.jar; 赠送Maven依赖信息文件:jetty-server-8.1.8...

    jetty-io-9.4.8.v20171121-API文档-中文版.zip

    赠送jar包:jetty-io-9.4.8.v20171121.jar; 赠送原API文档:jetty-io-9.4.8.v20171121-javadoc.jar; 赠送源代码:jetty-io-9.4.8.v20171121-sources.jar; 赠送Maven依赖信息文件:jetty-io-9.4.8.v20171121.pom;...

    jetty-webapp-9.3.19.v20170502-API文档-中文版.zip

    赠送jar包:jetty-webapp-9.3.19.v20170502.jar; 赠送原API文档:jetty-webapp-9.3.19.v20170502-javadoc.jar; 赠送源代码:jetty-webapp-9.3.19.v20170502-sources.jar; 赠送Maven依赖信息文件:jetty-webapp-...

    jetty-util-6.1.26-API文档-中文版.zip

    赠送jar包:jetty-util-6.1.26.jar; 赠送原API文档:jetty-util-6.1.26-javadoc.jar; 赠送源代码:jetty-util-6.1.26-sources.jar; 赠送Maven依赖信息文件:jetty-util-6.1.26.pom; 包含翻译后的API文档:jetty-...

    jetty-sslengine-6.1.26-API文档-中文版.zip

    赠送jar包:jetty-sslengine-6.1.26.jar; 赠送原API文档:jetty-sslengine-6.1.26-javadoc.jar; 赠送源代码:jetty-sslengine-6.1.26-sources.jar; 赠送Maven依赖信息文件:jetty-sslengine-6.1.26.pom; 包含...

    jetty-io-9.4.43.v20210629-API文档-中文版.zip

    赠送jar包:jetty-io-9.4.43.v20210629.jar; 赠送原API文档:jetty-io-9.4.43.v20210629-javadoc.jar; 赠送源代码:jetty-io-9.4.43.v20210629-sources.jar; 赠送Maven依赖信息文件:jetty-io-9.4.43.v20210629....

    jetty-sslengine-6.1.26-API文档-中英对照版.zip

    赠送jar包:jetty-sslengine-6.1.26.jar; 赠送原API文档:jetty-sslengine-6.1.26-javadoc.jar; 赠送源代码:jetty-sslengine-6.1.26-sources.jar; 赠送Maven依赖信息文件:jetty-sslengine-6.1.26.pom; 包含...

    jetty-util-9.4.43.v20210629-API文档-中文版.zip

    赠送jar包:jetty-util-9.4.43.v20210629.jar; 赠送原API文档:jetty-util-9.4.43.v20210629-javadoc.jar; 赠送源代码:jetty-util-9.4.43.v20210629-sources.jar; 赠送Maven依赖信息文件:jetty-util-9.4.43.v...

    jetty-server-8.1.8-API文档-中文版.zip

    赠送jar包:jetty-server-8.1.8.jar; 赠送原API文档:jetty-server-8.1.8-javadoc.jar; 赠送源代码:jetty-server-8.1.8-sources.jar; 赠送Maven依赖信息文件:jetty-server-8.1.8.pom; 包含翻译后的API文档:...

    jetty-client-9.4.43.v20210629-API文档-中文版.zip

    赠送jar包:jetty-client-9.4.43.v20210629.jar; 赠送原API文档:jetty-client-9.4.43.v20210629-javadoc.jar; 赠送源代码:jetty-client-9.4.43.v20210629-sources.jar; 赠送Maven依赖信息文件:jetty-client-...

    jetty-6.1.26-API文档-中文版.zip

    赠送jar包:jetty-6.1.26.jar; 赠送原API文档:jetty-6.1.26-javadoc.jar; 赠送源代码:jetty-6.1.26-sources.jar; 赠送Maven依赖信息文件:jetty-6.1.26.pom; 包含翻译后的API文档:jetty-6.1.26-javadoc-API...

    jetty-http-7.4.2.v20110526.jar

    jetty-http-7.4.2.v20110526.jar jetty-http 服务jar包

Global site tag (gtag.js) - Google Analytics