Augusto writes:
> But when I use cookies and set the time to -1, they seems to go
> away when the browser exits.
Sure, the cookies stored in the browser's memory (time -1) go
away when the browser exits.
> Sessions seem to live even though the user exits the browser :(
> Could be a bug the servlet engine ? I'm just wondering what the
> supposed behaviour is.
The session lives in the servlet engine's memory. The servlet
gives the browser a cookie or does URL-rewriting (embedding an ID
number as an argument in any URL on the page that invokes the servlet
engine again), and uses this to associate that browser request with
the session data in the servlet engine's memory.
> I'm using timeouts right now, and that's ok. But it would be even
> better if I could have timeouts and a little browser "hint" to say
> "Please if you can, when you exit, remove that cookie" :)
> Cezar Totth wrote:
> > Workarounds are available all adding more or less drawbacks:
> > - Implement an logout servlet and put links within all (or some) [pages]
> > - Use a very small timeout (let it be 30 seconds) for all sessions
> > Other ideas?
Put an applet or javascript in the page that invokes a servlet's
on unloading. This is how we're doing it on a project I'm working on.
I racked my brains a while back trying to figure out an alternative
that would support a wider range of browsers, but that's about all you
can do.
We're using Javascript, and even with the javascript, we're using
frames and keeping a very small frame for the entire session - the
logout is only called when the the small frame is unloaded. I wonder
if we could include an onUnload script with *every* page, that checks
what page is about to be loaded and invokes the logout servlet if the
new page is not in the specified domain.
If your user can support an applet, I suspect invoking the
logout from the applet would be cleaner. I'm not sure how that works
- I know applets get unloaded when the page they're on is not being
displayed, but if the same applet is included in several pages, does
it reload it for each page, or keep it running?
Steven J. Owens
[EMAIL PROTECTED]
[EMAIL PROTECTED]
___________________________________________________________________________
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