Not sure that the environment is applicable, but I'm using IBM VA Java 3.0,
and the Websphere Test Environment, on NT.
I'm creating a cookie, setting the Name and value in the c'tor and adding to
an HttpServletResponse
Cookie newCookie = new Cookie("aName", "aValue");
response.addCookie(newCookie);
when this response gets to the client, and the browser has prompting
switched on, I am prompted to accept the cookie, and it has a lifetime of
session (default), and it has a domain, and path -also defaulted.
If I view the cookies on the reauest (from the same JSP page) I can see the
cookie I have added, with a MaxAge of -1, which is OK, but the domain and
path information have disappeared.
Now, if I try to remove the cookie by setting its max age to 0 (zero), I get
prompted to accept, the domain and path are set as previously, and the
expiry time is set to the current time.
If I now view the cookies, I get the same result as previously, i.e.
MaxAge -1, no path, no domain.
If I close the browser and go back tot he same page (but before I add any
more cookies) I see the previous cookie still exists, so it doesn't even
have session lifetime, it seems to persist longer than that
This would seem to be consistent behaviour in IE 4, and Netscape 4.6 (I
think its 4.6).
Questions are
- is this normal behavior, I would have thought that a session cookie
would not persist after closedown ?
- I'm sure the spec said that 0 (zero) expiry time will cause the cookie
to be removed is this correct ?
- most importantly, what am I doing wrong ?
- I've seen reference in a FAQ suggesting that the path be set to "/" -
would this do the job for me ?
- is my environment important, i.e. is this the behaviour one expects, or
should I investigate outwith WTE ?
Many thanks for any help.
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets