>>> Mike Lai <[EMAIL PROTECTED]> 24-May-00 5:32:30 AM >>>
>Can I use HttpServletResponse to set cookie and then redirect
>the request to another url at the same time?
No. Yes... depends.
>I've tried, the page is redirected but the cookie seem to be losed.
>I use response.addCookie and response.sendRedirect to do that.
>Thanks.
Here's what happening:
1. server sets cookie on response
2. server sends response code REDIRECT (302) to
myserv.somedomain.com
3. browser recieves response (with cookie)
4. browser reads in cookie and puts cookie in it's cookie jar
5. browser obeys the REDIRECT...
6. opens a new connection to http://myserv.somedomain.com
7. sends request
So you can see why the cookie is not arriving at the redirected
server.
If the 2 servers have a common domain name you can set the domain
part of the cookie so that it gets delivered to both servers (see
yeseterday's list mails).
Nic
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html