Tomcat 7 可以修改 Session 默认的 Cookie 名 JSESSIONID 了

红薯 发布于 2010/06/30 23:01
阅读 9K+
收藏 10

看看下面这个配置:

<Context path="" docBase="D:\WORKDIR\oschina\webapp" reloadable="false" sessionCookiePath="/" sessionCookieName="OSCHINA_SESSION"/>

原来 J2EE 应用所使用的 Session 对应的是一个名为 JSESSIONID 的 Cookie ,现在在 Tomcat 7 中你可以修改这个 Cookie 的名称了

server.xml

<Server port="9005" shutdown="SHUTDOWN">
  <Service name="Catalina">
    <Executor name="tomcatThreadPool" 
        maxThreads="500" minSpareThreads="10" maxIdleTime="600000"/>
    <Connector port="80" protocol="org.apache.coyote.http11.Http11NioProtocol"
        connectionTimeout="20000" executor="tomcatThreadPool" acceptorThreadCount="4"
        redirectPort="8443" />
    <Engine name="Catalina" defaultHost="localhost">
      <Host name="localhost"  appBase="webapps" unpackWARs="false" autoDeploy="false">
        <Context path="" docBase="D:\WORKDIR\oschina\webapp" reloadable="false" sessionCookiePath="/" sessionCookieName="OSCHINA_SESSION"/>
     </Host>
    </Engine>
  </Service>
</Server>
太酷了!!!

加载中
0
人人
人人

搞了几天,总算OK了,明天把项目换成tomcat7做测试了,看会不会出问题,没问题就一切OK了

0
红薯
红薯

那么这就不算是 Tomcat 7 的 bug 了,但是

Tomcat 7 应该考虑一下默认的设置,因为 IE 不支持 Path = “” 的 Cookie

0
钛元素
钛元素

快出正式版吧呀

0
异常爱
异常爱

最近也在关注TOMCAT7 呵呵 不过好像还没正式版吧?

0
onse
onse
2012-2-15 11:13:39 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal perfo
e in production environments was not found on the java.library.path: C:\Jav
1.6\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Java\jdk1
n;c:\oracle\product\10.2.0\db_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDO
stem32\Wbem;.
2012-2-15 11:13:40 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-8080"]
2012-2-15 11:13:40 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-bio-8009"]
2012-2-15 11:13:40 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 476 ms
2012-2-15 11:13:40 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
2012-2-15 11:13:40 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.20
2012-2-15 11:13:40 org.apache.catalina.core.StandardContext resourcesStart
严重: Error starting static Resources
java.lang.IllegalArgumentException: Document base D:\webapp does not exist
 not a readable directory
        at org.apache.naming.resources.FileDirContext.setDocBase(FileDirCon
java:140)
        at org.apache.catalina.core.StandardContext.resourcesStart(Standard
xt.java:4836)
        at org.apache.catalina.core.StandardContext.startInternal(StandardC
t.java:5016)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBa
va:1033)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost
:774)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBa
va:1033)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEn
java:291)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:
        at org.apache.catalina.core.StandardService.startInternal(StandardS
e.java:443)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:
        at org.apache.catalina.core.StandardServer.startInternal(StandardSe
java:727)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:
        at org.apache.catalina.startup.Catalina.start(Catalina.java:621)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessor
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethod
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
2012-2-15 11:13:40 org.apache.catalina.core.StandardContext startInternal
严重: Error in resourceStart()
2012-2-15 11:13:40 org.apache.catalina.core.StandardContext startInternal
严重: Error getConfigured
2012-2-15 11:13:40 org.apache.catalina.core.StandardContext startInternal
严重: Context [] startup failed due to previous errors
2012-2-15 11:13:40 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory docs
2012-2-15 11:13:40 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory examples
2012-2-15 11:13:40 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory host-manager
2012-2-15 11:13:40 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory manager
2012-2-15 11:13:40 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
2012-2-15 11:13:40 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
2012-2-15 11:13:40 org.apache.catalina.startup.Catalina start
信息: Server startup in 500 ms

0
雪梦科技
雪梦科技
太强大了,学习
返回顶部
顶部