Thank you to Chris, Arjan, Pat and Robert
and just to complete the thread...

In the file c:\Program Files\Netscape\Users\user'sname\cookies.txt
i found a interesting URL that gives cookie specifications for Netscape:
http://www.netscape.com/newsref/std/cookie_spec.html
It gives the description of the Set-Cookie header:
{name}={value}; expires={date}; path={path}; domain={domain name}; secure
So, it is a date i had to specify and not a timeout value in seconds or
millisecondes.
The date must conform to this format:
Wdy, DD-MM-YYYY HH:MM:SS GMT

If we use the javax.servlet.http.Cookie class, we can then let the
javax.servlet.http.HttpServletResponse.addCookie method encode the MaxAge
value (which must be given in seconds) as a valid date.

I tried with the following code and it works fine with both Netscape 4.6 and
IE 4.01.
  Cookie c = new Cookie("Relais", String.valueOf(session.getId()));
  c.setPath("/");
  c.setMaxAge(86400);    // one day in seconds
  c.setDomain(domain);
  response.addCookie(c);

I find the cookie in the file c:\Program
Files\Netscape\Users\user'sname\cookies.txt
for Netscape and in two direcories for IE:
c:\WINNT\Profiles\user'name\Cookies\user'[EMAIL PROTECTED]
and
c:\WINNT\Profiles\user'name\TemporaryInternetFiles\Cookie:user'sname:domain.
com

By the way, the file is written at the moment the cookie is set and not
after you exit the browser.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to