Bugs item #684099, was opened at 2003-02-10 11:00
Message generated for change (Settings changed) made by starksm
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=684099&group_id=22866
Category: JBossServer
Group: CVS HEAD
>Status: Closed
>Resolution: Out of Date
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: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development