You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Steve jones <st...@netdecisions.co.uk> on 2000/02/11 17:28:56 UTC

Cookies

Here is the code snippet:
    /**
     * This method stores the cookies for this user.
     */
    public static final void storeCookies(HttpServletResponse response,
ShoppingCart cart){
        System.out.println("Saving cookies " + cart.getId() + " with value "
+ cart.toString());
        response.addCookie(newCookie(cart.getId(), cart.toString()));
        response.addCookie(newCookie("ShoppingCart", cart.getId()));
        response.addCookie(newCookie("CartCount",
Integer.toString(cart.getNumberOfItems())));
        System.out.println("Saved cookie");
    }

It works fine under servletrunner with jskd2.1 all of the cookies are stored
and updated.  However under Tomcat only the last item (CartCount) is
actually being stored, the others are ignored.

Any ideas ?

Cheers

Steve


RE: Cookies

Posted by John Pettit <jp...@logictier.com>.
Are you using Tomcat 3.0? We had that problem with 3.0 (there seems to be a
bug in the MimeHeaders class), so we upgraded to 3.1M1 which fixed the
problem . (And, unfortunately, also introduced some new major ones like
jsp:include is broken if you need to pass parameters). But that might not be
an issue for you.

-- John

-----Original Message-----
From: Steve jones [mailto:steve.jones@netdecisions.co.uk]
Sent: Friday, February 11, 2000 8:29 AM
To: Tomcat-Dev (E-mail)
Subject: Cookies


Here is the code snippet:
    /**
     * This method stores the cookies for this user.
     */
    public static final void storeCookies(HttpServletResponse response,
ShoppingCart cart){
        System.out.println("Saving cookies " + cart.getId() + " with value "
+ cart.toString());
        response.addCookie(newCookie(cart.getId(), cart.toString()));
        response.addCookie(newCookie("ShoppingCart", cart.getId()));
        response.addCookie(newCookie("CartCount",
Integer.toString(cart.getNumberOfItems())));
        System.out.println("Saved cookie");
    }

It works fine under servletrunner with jskd2.1 all of the cookies are stored
and updated.  However under Tomcat only the last item (CartCount) is
actually being stored, the others are ignored.

Any ideas ?

Cheers

Steve


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org