Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSF - Cookies lost using sendredirect to different domain

Santhosh KumarJan 22 2015 — edited Jan 29 2015

I am adding cookies using response.addCookie and then redirect using response.sendRedirect to an URL in different domain. Cookie path is already set to "/".

HttpServletResponse response = (HttpServletResponse) Facescontext.getCurrentInstance().getExternalcontext().getResponse(); response.addCookie(cookie); response.sendRedirect("http://different.domain.com/xyz.xhtml");

In debug mode and after inspecting the response objects, found that cookies are lost before calling the "xhtml" page itself.

I'm using Tomcat 7.0.26. JDK 1.7 and JSF 2.0.

Note - This issue is not replicated on WAS server, I'm able to see the redirection happening successfully along with cookies.

Please help, do I need to add or change any of the lib's to make it work on Tomcat Servers?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 26 2015
Added on Jan 22 2015
1 comment
2,027 views