Bug 38025 - cookies are not set when max age is specified
Summary: cookies are not set when max age is specified
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Connector:HTTP (show other bugs)
Version: 5.5.12
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords: JDK1.5
Depends on:
Blocks:
 
Reported: 2005-12-23 10:11 UTC by Evgeny Shepelyuk
Modified: 2006-04-14 05:02 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeny Shepelyuk 2005-12-23 10:11:38 UTC
I'm using Tomcat 5.5.9 (and tried higher versions  too) and jdk1.5 update 06.

When i use following code in my JSP - cookies are not set to client.

// DO NOT WORK
Cookie cookie = new Cookie("name", "value");
cookie.setMaxAge(3600);
response.addCookie(cookie);

If i remove 2nd line - all works OK.

// WORKS OK
Cookie cookie = new Cookie("name", "value");
response.addCookie(cookie);

This happnes only on linux computers (we use Gentoo). On windows everything is 
working OK.

Before i've been using j2sdk1.4.2_08 and Tomcat 5.0.30 and never seen this 
problem.
Comment 1 Andreas Waechter 2005-12-23 13:23:44 UTC
> Cookie cookie = new Cookie("name", "value");
> cookie.setMaxAge(3600);

Did you try other values as well? 3600 = 1 hour, which could be a timezone
difference (maybe one of the machines has wrong timezone settings)

Did you check the HTTP headers of the response? 
Or did you just look in the Cookie-store of your browser?
Comment 2 Evgeny Shepelyuk 2005-12-23 13:34:40 UTC
(In reply to comment #1)
> > Cookie cookie = new Cookie("name", "value");
> > cookie.setMaxAge(3600);
> 
> Did you try other values as well? 3600 = 1 hour, which could be a timezone
> difference (maybe one of the machines has wrong timezone settings)
> 
Yes, I've tried many of another values.

> Did you check the HTTP headers of the response? 
> Or did you just look in the Cookie-store of your browser?
Hmm. Sorry my mistake. I've been looking only into cookie-store of browsers.
I'm still researching a bug. Try to give you as many info as i'll be able to 
obtain.

Comment 3 Yoav Shapira 2006-04-13 18:33:09 UTC
Waiting for more data from original poster and/or a confirmation that it works
for him now in 5.5.16 or later.