Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

setDomain() on Cookies not working

843833Sep 21 2001 — edited Nov 30 2001
Hi,
I 've seen this error reported a lot of times in this forum and none of them have a satisfactory answer. So I am repeating it and hope to hear from somebody abt this.
Here goes....
I created a cookie and tried to access it from another server in the same domain. Did not work. So I added the setDomain() statement and guess what.. even the cookie does not get created now...
I have looked into the RFC 2109 and everything seems to be ok in my programs.
I know people dont like it when someone pastes their entire code in these forums. So I am just going to paste a teeny weeny part where I am actually setting the cookie..

String domainName = ".cha.tva.gov";
Cookie userCookie = new Cookie("someid", "somevalue");
userCookie.setPath("/");
userCookie.setMaxAge(1200);
userCookie.setDomain(domainName);
res.addCookie(userCookie);

Any input will be appreciated. Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 28 2001
Added on Sep 21 2001
1 comment
294 views