There was a typo in the code below which has now been corrected
---------- Forwarded message ---------- From: Michael Farah <andromedamob...@gmail.com> Date: Mon, Mar 9, 2009 at 7:58 AM Subject: Cookie not being set To: users@tomcat.apache.org Hi all I’m running two web apps off a single instance of Tomcat 6.0.1.8 on a CentOS 64 bit OS. Tomcat is fronted with Apache 2.2 and I’m using mod_proxy_http. Both applications are wap sites. I’ve been trying to implement an analytics solution provided by Admob. The solution uses a pixel image in conjunction with a cookie to provide detailed user info. Similar to Google analytics but without the Javascript. Admob provides the code in multiple formats including Java. The problem is that the cookie is not being set. I have been back and forth with Admob and they are adamant that the problem lies in our enviroment. Below is my Virtual Host config; <VirtualHost 211.111.111.111:80> ServerName sitea.com ServerAlias www.sitea.com DocumentRoot /home/sitea ProxyPass / http://tomcatserver.com:8080/sitea/ ProxyPassReverse / http://tomcatserver.com:8080/sitea/ ProxyPassReverseCookieDomain tomcatserver.com sitea.com </VirtualHost> The Admob code is a JSP file named AdMob.jsp that is imported into each page of our webapp via this code snippet <jsp:include page="/AdMob.jsp"/> The AdMob.jsp file is pretty big so I won’t pase it all here except for two snippets which I feel are most relevant. The first is this one; admobRequiredParams.put("COOKIE_DOMAIN", "sitea.com"); // If your mobile site uses multiple subdomains, replace "null" with your root domain (e.g. "example.com") to make the AdMob cookie visible across subdomains. The second is the code that sets the cookie; private String admobGetCookieValue(HttpServletRequest request, HttpServletResponse response, PageContext pageContext, String cookieDomain) { try { Cookie cookies[] = request.getCookies(); if (cookies != null) { for (int i = 0; i < cookies.length; i++) { if (cookies[i].getName().equals("admobuu")) return cookies[i].getValue(); } } // Set a cookie if one has not already been set if (pageContext.getAttribute("admobCookie") == null) { String value = UUID.randomUUID().toString().replace("-",""); Cookie c = new Cookie("admobuu", value); c.setMaxAge(60*60*24*365*20); c.setPath("/"); if (cookieDomain != null) { if (cookieDomain.charAt(0) != '.') cookieDomain = "." + cookieDomain; c.setDomain(cookieDomain); } response.addCookie(c); pageContext.setAttribute("admobCookie", value); } return (String)pageContext.getAttribute("admobCookie"); } catch (Exception e) { return ""; } } When accessing sitea.com via Firefox with Live HTTP headers, it’s clear that the cookie is not being set as it doesn’t come shop up. However there is another cookie being set which I don’t recognise; Cookie: an=Af4ab27e8d16fb4ac50f73d03fe54c132 Can anyone please assist in explaining why this AdMob cookie is not being set? Thanks in advance Michael --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org