No cookie with setDomain()! - Weblogic
This is a discussion on No cookie with setDomain()! - Weblogic ; Q: Can anyone explain why following code didn't set any cookie. Please note
that if I skip setDomain(), cookie gets set properly. but if I call
setDomain(), no cookie!!!
Cookie myCookie =3D new Cookie("myValue", "12345" );
myCookie.setMaxAge(31104000);
myCookie.setDomain(".mydomain.com"); // <-- ...
-
No cookie with setDomain()!
Q: Can anyone explain why following code didn't set any cookie. Please note
that if I skip setDomain(), cookie gets set properly. but if I call
setDomain(), no cookie!!!
Cookie myCookie =3D new Cookie("myValue", "12345" );
myCookie.setMaxAge(31104000);
myCookie.setDomain(".mydomain.com"); // <-- trouble maker here
System.out.println(" name=3D" + myCookie.getName() + " domain=3D" +
myCookie.getDomain());
resp.addCookie(ppiCookie);
Configuration :
WL 451 with SP9 on Windows 2000, Java SDK 1.2,
full server DNS name =3D server1.mydomain.com
in weblogic.properties:
weblogic.httpd.session.cookie.domain=3D.mydomain.com
weblogic.httpd.session.cookie.enable=3Dtrue
weblogic.httpd.session.cookie.name=3Dppi
I'd like to set domain attribute, so all servers from the same domain can
read the cookie.
Thanks.
james
-
Re: No cookie with setDomain()!
Did you make sure that there was not already a cookie by the same name? I
had a similar problem with setPath() ... turned out an older cookie with a
different path existed so I could not change it.
Also, the cookie will only come back to the server with name and value set
.... all other data is "lost".
Cameron Purdy, LiveWater
"James Chen" <jamesc@predictpoint.com> wrote in message
news:395a78a2$1@newsgroups.bea.com...
> Q: Can anyone explain why following code didn't set any cookie. Please
note
> that if I skip setDomain(), cookie gets set properly. but if I call
> setDomain(), no cookie!!!
>
> Cookie myCookie =3D new Cookie("myValue", "12345" );
> myCookie.setMaxAge(31104000);
> myCookie.setDomain(".mydomain.com"); // <-- trouble maker her=
e
> System.out.println(" name=3D" + myCookie.getName() + " domain=3D"=
+
> myCookie.getDomain());
> resp.addCookie(ppiCookie);
>
> Configuration :
> WL 451 with SP9 on Windows 2000, Java SDK 1.2,
> full server DNS name =3D server1.mydomain.com
> in weblogic.properties:
> weblogic.httpd.session.cookie.domain=3D.mydomain.com
> weblogic.httpd.session.cookie.enable=3Dtrue
> weblogic.httpd.session.cookie.name=3Dppi
>
> I'd like to set domain attribute, so all servers from the same domain can
> read the cookie.
>
> Thanks.
>
> james
>
>
-
Re: No cookie with setDomain()! -- Resolved
Thanks. the problem was that I used http://myserver1/abc... instead of
http://myserver1.mydomain.com/abc . and expected browser to do a lookup or
reverse lookup to get domain name. All is fine if I use full URL with domai=
n
name.
"Cameron Purdy" <cpurdy@mediaone.net> wrote in message
news:395abefd$1@newsgroups.bea.com...
> Did you make sure that there was not already a cookie by the same name? =
I
> had a similar problem with setPath() ... turned out an older cookie with =
a
> different path existed so I could not change it.
>
> Also, the cookie will only come back to the server with name and value se=
t
> ... all other data is "lost".
>
> Cameron Purdy, LiveWater
>
> "James Chen" <jamesc@predictpoint.com> wrote in message
> news:395a78a2$1@newsgroups.bea.com...
> > Q: Can anyone explain why following code didn't set any cookie. Please
> note
> > that if I skip setDomain(), cookie gets set properly. but if I call
> > setDomain(), no cookie!!!
> >
> > Cookie myCookie =3D new Cookie("myValue", "12345" );
> > myCookie.setMaxAge(31104000);
> > myCookie.setDomain(".mydomain.com"); // <-- trouble maker
here
> > System.out.println(" name=3D" + myCookie.getName() + " domain=
=3D" +
> > myCookie.getDomain());
> > resp.addCookie(ppiCookie);
> >
> > Configuration :
> > WL 451 with SP9 on Windows 2000, Java SDK 1.2,
> > full server DNS name =3D server1.mydomain.com
> > in weblogic.properties:
> > weblogic.httpd.session.cookie.domain=3D.mydomain.com
> > weblogic.httpd.session.cookie.enable=3Dtrue
> > weblogic.httpd.session.cookie.name=3Dppi
> >
> > I'd like to set domain attribute, so all servers from the same domain
can
> > read the cookie.
> >
> > Thanks.
> >
> > james
> >
> >
>
>