Share session data between 2 subdomains

前端 未结 3 967
忘了有多久
忘了有多久 2020-12-15 14:00

I am using tomcat 7.0.6 with jdk 1.6.0_22

Is it possible to share session data between 2 different domains with a common subdomain such as a.mydomain.com and b.mydom

3条回答
  •  孤街浪徒
    2020-12-15 14:40

    Servlet Spec 3.0 (which is what Tomcat 7 supports) allows this by calling setDomain on SessionCookieConfig.

    Details here: http://download.oracle.com/javaee/6/api/javax/servlet/SessionCookieConfig.html

    You get SessionCookieConfig progammatically at webapp init time with a ServletContextListner - or you should be able to set it the value in web.xml.

提交回复
热议问题