Title: RE: headers, cookies, redirect

Flip it around, try

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

it seems like sendRedirect resets the HTTP headers.

-----Original Message-----
From: Michael McCormick [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 17, 2000 12:08 PM
To: [EMAIL PROTECTED]
Subject: 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

Reply via email to