You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nick Holloway <Ni...@alfie.demon.co.uk> on 2000/09/24 16:10:01 UTC
Re: how to detect a session has no user
mlintner@flash.net (Mark Lintner) writes:
> I list logged in users in a db table. When they log off they are removed.=
> How can I detect the case where they have closed the browser without=
> logging off so that I can remove them from the db??
Store an an object that implements HttpSessionBindingListener into the
session. Tomcat will call the valueUnbound() method on the interface
when the object is removed from the session, which happens automatically
when the session expires or is invalidated.
--
`O O' | Nick.Holloway@pyrites.org.uk
// ^ \\ | http://www.pyrites.org.uk/
Re: how to detect a session has no user
Posted by Nick Holloway <Ni...@alfie.demon.co.uk>.
mlintner@flash.net (Mark Lintner) writes:
> Excellent, that seems like the right way to do it. It seems like it takes=
> tomcat about 1/2 hour to timeout the session but it happens. Now my object=
> implements the valueunboud method removing the entry from the database. It=
> would be nice to have control over how long Tomcat takes to timeout a=
> session though.
You control the default setting of the timeout from the configuration
files (I haven't looked at exactly what is required, but it has been
mentioned on the list recently).
You can also modify it from your JSP using the setMaxInactiveInterval()
method on HttpSession.
--
`O O' | Nick.Holloway@pyrites.org.uk
// ^ \\ | http://www.pyrites.org.uk/
Re: how to detect a session has no user
Posted by Mark Lintner <ml...@flash.net>.
Excellent, that seems like the right way to do it. It seems like it takes tomcat about 1/2 hour to timeout the session but it happens. Now my object implements the valueunboud method removing the entry from the database. It would be nice to have control over how long Tomcat takes to timeout a session though.
Thanks
*********** REPLY SEPARATOR ***********
On 9/24/2000 at 3:10 PM Nick.Holloway@alfie.demon.co.uk wrote:
>mlintner@flash.net (Mark Lintner) writes:
>> I list logged in users in a db table. When they log off they are removed.=
>> How can I detect the case where they have closed the browser without=
>> logging off so that I can remove them from the db??
>
>Store an an object that implements HttpSessionBindingListener into the
>session. Tomcat will call the valueUnbound() method on the interface
>when the object is removed from the session, which happens automatically
>when the session expires or is invalidated.
>
>--
> `O O' | Nick.Holloway@pyrites.org.uk
>// ^ \\ | http://www.pyrites.org.uk/