Some method must exist to give the cookie an expiry date like other server side
scripting languages like PHP (setcookie("userad", $row[4],
time()+3600*24*365*10, "/"); --> gives the cookie 1 year life) I think Java can
do better than that using a simple method.

So setMaxAge(int expiry); could be used for this.


"Christopher K. St. John" wrote:

> Bhushan Bhangale wrote:
> >
> > maximum limit of integer makes the cookie persistent
> > for only 25 days, because the parameter to this method
> > is in millisecond.
> >
>
>  The servlet spec is available at:
>
>  <URL:http://java.sun.com/products/servlet/download.html>
>
>  From the 2.1 spec:
>
>   public void setMaxAge(int expiry);
>
>   ... The cookie will expire after the given
>   number of seconds have passed. Negative values
>   will ensure that the cookie will not persist on
>   the client. A zero value causes the cookie to be
>   deleted from the client.
>
>  Do you have an older container? Or have some other
> reason to believe that your servlet container uses ms
> instead of seconds? In the worst case, you could
> bypass the cookie routines and just add the cookie
> header manually.
>
> -cks
>
> ___________________________________________________________________________
> 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

___________________________________________________________________________
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