Bugs item #684099, was opened at 2003-02-10 14:00
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=684099&group_id=22866

Category: JBossServer
Group: CVS HEAD
Status: Open
Resolution: None
Priority: 5
Submitted By: Lester Ward (wordman)
Assigned to: Nobody/Anonymous (nobody)
Summary: Multiple settings of a cookie fail on redirect

Initial Comment:
If you set the same cookie during a single post, then 
redirect the page, only the first cookie set 
actually "sticks".

That is, this code:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Cookie1 extends HttpServlet
{
   public void doGet(HttpServletRequest request,
                          HttpServletResponse response)
      throws IOException, ServletException
   {
      response.setContentType("text/html");

      Cookie cookie = new Cookie
("myCookie", "incorrect");
      response.addCookie(cookie);
      cookie.setValue("OK");
      response.sendRedirect("Cookie2");
   }
}

public class Cookie2 extends HttpServlet
{
   public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
      throws IOException, ServletException
   {
      response.setContentType("text/html");
      PrintWriter out = response.getWriter();

      Cookie cookies[] = request.getCookies();
      for (int i=0;i<cookies.length ;i++ )
      {
         if (cookies[i].getName().equalsIgnoreCase
("myCookie"))
         {
            out.println("Cookie Value: " + cookies
[i].getValue());
         }
      }
   }
}

Chould go to a page that says:

Cookie Value: 0

It doesn't. It displays:

Cookie Value: incorrect




----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=684099&group_id=22866


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to