tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lasseter Gary W (Contractor)" <gary.lasse...@logsa.army.mil>
Subject RE: addCookie() and sendRedirect() why does cookie not get set?
Date Tue, 13 Jun 2000 14:45:21 GMT
Where I'm redirecting could be anywhere on my web server - (staying on-host)
with a server scoped cookie "/".
I was originally using RequestDispatcher but those requests appear to stay
within the 
context of the servlet engine.  For example, if I have to redirect to say a
ColdFusion page, the 
ColdFusion handler needs to pick up this request and not the Servlet
handler.  With RequestDispatcher
the request never gets processed outside of Tomcat and therefore the
ColdFusion components fail.

Another message - "...does the HTTP protocol allow cookies to be set when
the reponse is
a redirect?"  I don't know the answer to this.

gary


-----Original Message-----
From: Kevin Jones [mailto:kevinj@develop.com]
Sent: Tuesday, June 13, 2000 9:17 AM
To: tomcat-user@jakarta.apache.org
Subject: RE: addCookie() and sendRedirect() why does cookie not get set?


Where are you re-directing too?

If you are redirecting to the same context then you should be using a
RequestDispatcher, if you are redirecting off-host then adding cookies won't
work. Cookies are associated with the host/domain they were sent from, a
browser shouldn't forward a cookie from you to a different domain,

Kevin Jones
DevelopMentor
www.develop.com

> -----Original Message-----
> From: Lasseter Gary W (Contractor) [mailto:gary.lasseter@logsa.army.mil]
> Sent: 13 June 2000 14:56
> To: 'tomcat-user@jakarta.apache.org'
> Subject: addCookie() and sendRedirect() why does cookie not get set?
>
>
> Folks,
> I'm setting a cookie with resp.addCookie() and later on using
> sendRedirect() to go to another .html...  My cookies will not set.
> Is my HttpServletResponse getting trashed?
>
> I can get a PrintWriter
> and out put stuff and the cookie gets set - just can't use sendRedirect().
>
> For now I'm outputting (with PrintWriter) "...<META HTTP-EQUIV="Refresh"
> Content=0; URL="page.html">..." which is a HTML technique for redirection.
> I hate doing it this way.
>
> Is there a way to make addCookie() work in combination with
> sendRedirect()?
>
> later,
> gary
>
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org


--------------------------------------------------------------------------
To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
For additional commmands, email: tomcat-user-help@jakarta.apache.org

Mime
View raw message