Hi Greg,
HttpServletResponse.sendRedirect(String) basically just "commands" the
web browser proceed to another URL.
It's like opening another browser window, typing the other URL in the
Address bar, then hitting the Enter button.
The session object created in the second web application is a new and
different session object and does not know
anything about the session object from the first web application.
Regards,
Karl
Greg Burrow wrote:
Hello,
I have two web applications in different context, one servlet will forward
the request to a servlet in the other application using encodeRedirectURL
and sendRedirect. The receiving servlet creates a new session and session
attributes are lost.
Running Tomcat 5.5.17.
Here is the flow:
GET /App1/RedirectServlet HTTP/1.1
Cookie: JSESSIONID=7AFACD0318419C34938B6410BB9A1937
RedirectServlet
response.sendRedirect(response.encodeRedirectURL("/App2/LaunchServlet"));
HTTP/1.x 302 Moved Temporarily
GET /App2/LaunchServlet HTTP/1.1
(no cookie)
HTTP/1.x 200 OK
Set-Cookie: JSESSIONID=BE408BFD3480E29DF2A4278BCA3C1FC6; Path=/App2
The same behavior occurs in Firefox and IE. Cookies are enabled in both
browsers and crossContext="true" in context.xml. Is this a bug in Tomcat or
a problem with my method of redirect?
Thanks,
Greg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org