Index: java/org/apache/catalina/Globals.java =================================================================== --- java/org/apache/catalina/Globals.java (revision 882945) +++ java/org/apache/catalina/Globals.java (working copy) @@ -273,6 +273,13 @@ System.getProperty("org.apache.catalina.SESSION_COOKIE_NAME", "JSESSIONID"); + /** + * The name of the domain used in the cookie session parameter, + * if something is different than the default. Configured in the + * web.xml + */ + public static final String SESSION_COOKIE_DOMAIN_ATTR = + "org.apache.catalina.SESSION_COOKIE_DOMAIN"; /** * The name of the path parameter used to pass the session identifier Index: java/org/apache/catalina/connector/Request.java =================================================================== --- java/org/apache/catalina/connector/Request.java (revision 882945) +++ java/org/apache/catalina/connector/Request.java (working copy) @@ -180,7 +180,7 @@ /** - * The preferred Locales assocaited with this Request. + * The preferred Locales associated with this Request. */ protected ArrayList locales = new ArrayList(); @@ -2353,7 +2353,7 @@ && getContext().getCookies()) { Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME, session.getIdInternal()); - configureSessionCookie(cookie); + configureSessionCookie(cookie); response.addCookieInternal(cookie, context.getUseHttpOnly()); } @@ -2367,7 +2367,8 @@ } /** - * Configures the given JSESSIONID cookie. + * Configures the given JSESSIONID cookie. The cookie domain + * can be specified by the user in the web.xml * * @param cookie The JSESSIONID cookie to be configured */ @@ -2382,6 +2383,16 @@ } else { cookie.setPath("/"); } + + if ((context != null) && (context.getServletContext() != null)) { + // attempt to look up domain in web.xml + + String defaultDomain = context.getServletContext().getInitParameter(Globals.SESSION_COOKIE_DOMAIN_ATTR); + if ((defaultDomain != null) && (defaultDomain.trim().length() > 0)) { + cookie.setDomain(defaultDomain); + } + } + if (isSecure()) { cookie.setSecure(true); }