Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is there a problem with calling Response.sendRedirect() after Response.addCookie() ?

0
Posted

Is there a problem with calling Response.sendRedirect() after Response.addCookie() ?

0

Location: http://www.jguru.com/faq/view.jsp?EID=53251 Created: May 21, 2000 Modified: 2000-05-21 13:49:57.176 Author: Alex Chaffee (http://www.jguru.com/guru/viewbio.jsp?EID=3) Question originally posed by Shalabh Nigam (http://www.jguru.com/guru/viewbio.jsp?EID=47481 Yes, there is a bug in Tomcat 3.1 (and possibly other servlet engines). To send a cookie through a redirect, you must set the headers manually. seanm@narus.com suggests: Cookie long_term = new Cookie(LONG_TERM_COOKIE_NAME, user_name); long_term.setMaxAge(60*60*24*4); long_term.setPath(“/Blah”); response.addCookie(long_term); response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY); response.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123