tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andromeda Mobile <>
Subject Fwd: Cookie not being set
Date Mon, 09 Mar 2009 18:04:52 GMT
Does anyone have any idea on the query below?

---------- Forwarded message ----------
From: Michael Farah <>
Date: Mon, Mar 9, 2009 at 7:58 AM
Subject: Cookie not being set

Hi all

I’m running two web apps off a single instance of Tomcat 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;

    DocumentRoot /home/sitea
    ProxyPass /
    ProxyPassReverse /

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", ""); // If your mobile
site uses multiple subdomains, replace "null" with your root domain (e.g.
"") 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

    // 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);
      if (cookieDomain != null) {
        if (cookieDomain.charAt(0) != '.') cookieDomain = "." +
      pageContext.setAttribute("admobCookie", value);
    return (String)pageContext.getAttribute("admobCookie");
  catch (Exception e) {
    return "";

When accessing 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

Thanks in advance

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message