-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael,

On 3/11/2009 7:37 AM, Andromeda Mobile wrote:
> <jsp:include page="/AdMob.jsp"/>

[snip]


>       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);


I'm not sure how anal retentive Tomcat is about adhering to the servlet
spec (these days it's getting a little closer to implementing exactly
what the spec lays out), but this could be a problem:

- From SRV.8.3:

"
[The target servlet of the include method] cannot set headers or call
any method that affects the headers of the response, with the exception
of the HttpServletRequest.getSession() and
HttpServletRequest.getSession(boolean) methods. Any attempt to set the
headers must be ignored, and any call to HttpServletRequest.getSession()
or HttpServletRequest.getSession(boolean) that would require adding a
Cookie response header must throw an IllegalStateException if the
response has been committed.
"

So, that basically says that "includes can't set cookies".

Peter and Andre' have good suggestions about "response already
committed" problems that you should check for in your log files. If
that's what happening, then the headers are being sent before your AdMob
include is being processed, and the headers actually /cannot/ be
modified, whatever Tomcat's adherence to the spec turns out to be.

Try using:

<%...@include file="/AdMob.jsp" %>

<%...@include> does a text-inclusion into your JSP /before/ it is compiled.
The included text is therefore considered part of the "main" JSP and
there's no involvement of the RequestDispatcher. When you use
<jsp:include>, you are making a sub-request to another resource in the
webapp and are subject to the rules stated above.

Try switching include mechanisms and see if that helps.

Good luck,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkm4PtkACgkQ9CaO5/Lv0PDZ0QCgjT0bgvA9QW1AmNqr0JrNKaj4
4cQAoLuWs7HfJ0oLoVvp1GVz99VbND3g
=Y9fu
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to