ommitted. You are advised to define this * valve as early as possible in server.xml to ensure that the response has not already been * committed when this valve is invoked.</p> * * <p>We recommend that you define this valve in server.xml immediately after the Catalina Engine * as follows: * <pre> * <Engine name="Catalina"...> * <Valve className="org.three3s.valves.CrossSubdomainSessionValve"/> * </pre> * </p> */ public class CrossSubdomainSessionValve extends ValveBase { public CrossSubdomainSessionValve() { super(); info = "org.three3s.valves.CrossSubdomainSessionValve/1.0"; } @Override public void invoke(Request request, Response response) throws IOException, ServletException { //this will cause Request.doGetSession to create the session cookie if necessary request.getSession(true); //replace any Tomcat-generated session cookies with our own Cookie[] cookies = response.getCookies(); if (cookies != null) { for (int i = 0; i < cookies.length; i++) { Cookie cookie = cookies[i]; containerLog.debug("CrossSubdomainSessionValve: Cookie name is " + cookie.getName()); if (Globals.SESSION_COOKIE_NAME.equals(cookie.getName())) replaceCookie(request, response, cookie); } } //process the next valve getNext().invoke(request, response); } /** Replaces the value of the response header used to set the specified cookie to a value * with the cookie's domain set to the value returned by <code>getCookieDomain(request)</code> * * @param request * @param response * @param cookie cookie to be replaced. */ @SuppressWarnings("unchecked&qu