You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael McCormick <mi...@esm-software.com> on 2000/11/17 19:07:55 UTC

headers, cookies, redirect

Summary: my headers and/or cookies aren't sent with the response
when I send a redirect.

Suppose I have a .jsp page foo.jsp:

<%
response.addCookie(new Cookie("baz","quux"));
response.sendRedirect("bar.jsp");
%>

The response from foo.jsp (which is a 302) does _not_ contain a
"Set-Cookie" header with the contents "baz=quux". If I comment
out the redirect line, the response (a 200) _does_ contain the
appropriate header.

Is there some special trick to adding headers to a redirect? Am
I missing something obvious?

Configuration:
Apache 1.39
Tomcat 3.1
Blackdown Java 1.2.2
LinuxPPC 2.2.15

In a related question, how does one turn off the session id
cookie that always gets sent. I notice Tomcat has no problems
sending _that_ with a redirect.

Thanks for any help,

Mike