Chris Pratt wrote:

> Not until the 2.1 specification.
>     (*Chris*)

Hi,

I just downloaded the JSDK 2.1, and I couldn't find it.  I did see that the
interface HttpSession has two new methods: setMaxInactiveInterval and
getMaxInactiveInterval.  But this is a server-side timeout, correct?  Is there
another place where Sessions would expose the timeout in the cookies?

I tried using the set.. method above to get the server to set an expiration date
in the cookie, but is has no effect.  Here's a trace of the HTTP when creating a
new session:

10 Client:   GET /servlet/Shux HTTP/1.0
10 Not Sent: Connection: Keep-Alive
10 Client:   User-Agent: Mozilla/4.5 [en] (WinNT; I)
10 Client:   Host: pc-klopstock:9999
10 Client:   Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
image/png, */*
10 Client:   Accept-Encoding: gzip
10 Client:   Accept-Language: en
10 Client:   Accept-Charset: iso-8859-1,*,utf-8
10 Client:
10 Server:   HTTP/1.0 200
10 Server:   Server: Tomcat/2.1 Alpha
10 Server:   Content-Type: text/html
10 Server:   Set-Cookie2:
TOMCATID=TO14369833900268303MC1012AT;Version=1;Discard;Path="/"
10 Server:   Set-Cookie: TOMCATID=TO14369833900268303MC1012AT;Path=/
10 Server:
10 Server:   (Transmitting 234 bytes)

--- I used the following code:

 HttpSession session = req.getSession(true);
 String id = (String) session.getValue("shuxsession.id");

 doc.appendToBody("The session was...");
 if (id == null) {
     doc.appendToBody( "<b>not found.</b>" );
     id = "THE ID IS: " + new Date();
     session.putValue("shuxsession.id", id);
     // 100 days
     session.setMaxInactiveInterval( 100 * 24 * 60 * 60 );
}

Thanks for any input,
Robb

> ----- Original Message -----
> From: Robb Shecter <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, February 26, 1999 8:49 AM
> Subject: Persistent sessions / expirations?
>
> >Hi,
> >
> >I haven't been able to find this in the API's:  Is it possible to
> >specify the expiration date of a session?  That is, the cookie that the
> >session uses can have a date attached; is this accessible through the
> >session interfaces?
> >
> >It seems like the cookies that sessions create are not saved on disk -
> >just kept in the browser's memory.  In my application, though, I wanted
> >to be able to have the session persist on the disk, in the same way that
> >cookies can.
> >
> >Thanks to any pointers,
> >Robb
> >
> >___________________________________________________________________________
> >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

___________________________________________________________________________
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