2013년 6월 19일 수요일

jsessionid - tomcat, jetty 세션 공유

0. 하나의 서버에 tomcat, jetty 두개의 WAS를 서비스 하는 경우 세션을 공유하는 문제가 발생한다. 이건 JSESSIONID 때문에 발생하는 문제다.
 - 세션을 공유? 동일한 브라우저에서 tomcat 세션 생성 --> jetty 세션 생성 --> tomcat에 다시 접근하면 이전에 생성된 세션이 날라간다.

1. JSESSIONID?
 - JSESSIONID is a cookie generated by Servlet container like Tomcat or Jetty and used for session management in J2EE web application for http protocol.
 - 즉 tomcat 이건 jetty 건 J2EE web application 이라 디폴트로 JSESSIONID 라는 이름으로 쿠키를 관리한다. 
 - 따라서, 한 쪽에서 이름을 바꿔서 사용하면 세션을 공유하는 문제를 해결할 수 있다.

2. jetty 설정 방법
 - web.xml
  <context-param>
    <param-name>org.mortbay.jetty.servlet.SessionCookie</param-name>
    <param-value>JSESSIONID2</param-value>
  </context-param>

3. 참고
 - Examples of the names that some programming languages use when naming their cookie include JSESSIONID (JSP), PHPSESSID (PHP), and ASPSESSIONID (Microsoft ASP).

댓글 없음:

댓글 쓰기