You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Peter Maas <pe...@noterik.nl> on 2003/11/13 07:30:43 UTC

SessionListener

Hi,

I wondered if there is a way detect somehting like a 
'sessionWillBeDestroyed' event.
since the sessionDestroyed method in a sessionListener seems to be 
called after the session was destroyed.

Peter


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: SessionListener

Posted by Tatu Vanhanen <ta...@graftor.fi>.
>
> You might be able to use HttpSessionAttributeListener

...or HttpSessionBindingListener. The container calls the
valueUnbound(HttpSessionBindingEvent event) when the object is removed from
the session (e.g. when session is destroyed). I am using this one =)

- Tatu V.

> Peter Maas wrote:
>
> > What I actually want to do is call some destruct methods in objects
> > bound to the session...
> >
> > P
> >
> > Christopher Schultz wrote:
> >
> >> Peter,
> >>
> >>> I wondered if there is a way detect somehting like a
> >>> 'sessionWillBeDestroyed' event.
> >>> since the sessionDestroyed method in a sessionListener seems to be
> >>> called after the session was destroyed.
> >>
> >>
> >>
> >> I don't think you can 'veto' the destruction of a session, if that's
> >> what you mean. All the container will do is notify you that the
> >> session is in the process of being destroyed.
> >>
> >> -chris
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >>
> >>
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: SessionListener

Posted by Tim Funk <fu...@joedog.org>.
You might be able to use HttpSessionAttributeListener

-Tim

Peter Maas wrote:

> What I actually want to do is call some destruct methods in objects 
> bound to the session...
> 
> P
> 
> Christopher Schultz wrote:
> 
>> Peter,
>>
>>> I wondered if there is a way detect somehting like a 
>>> 'sessionWillBeDestroyed' event.
>>> since the sessionDestroyed method in a sessionListener seems to be 
>>> called after the session was destroyed.
>>
>>
>>
>> I don't think you can 'veto' the destruction of a session, if that's 
>> what you mean. All the container will do is notify you that the 
>> session is in the process of being destroyed.
>>
>> -chris
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: SessionListener

Posted by Christopher Schultz <ch...@comcast.net>.
Peter,
> What I actually want to do is call some destruct methods in objects 
> bound to the session...

Oh! Okay.... the session is completely in tact when this notifications 
is received. So, you can certainly destruct those objects from the 
sessionDestroyed method.

-chris


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: SessionListener

Posted by Peter Maas <pe...@noterik.nl>.
What I actually want to do is call some destruct methods in objects 
bound to the session...

P

Christopher Schultz wrote:

> Peter,
>
>> I wondered if there is a way detect somehting like a 
>> 'sessionWillBeDestroyed' event.
>> since the sessionDestroyed method in a sessionListener seems to be 
>> called after the session was destroyed.
>
>
> I don't think you can 'veto' the destruction of a session, if that's 
> what you mean. All the container will do is notify you that the 
> session is in the process of being destroyed.
>
> -chris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: SessionListener

Posted by Christopher Schultz <ch...@comcast.net>.
Peter,
> I wondered if there is a way detect somehting like a 
> 'sessionWillBeDestroyed' event.
> since the sessionDestroyed method in a sessionListener seems to be 
> called after the session was destroyed.

I don't think you can 'veto' the destruction of a session, if that's 
what you mean. All the container will do is notify you that the session 
is in the process of being destroyed.

-chris


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: SessionListener

Posted by Jon Wingfield <jo...@mkodo.com>.
;) That's why i put the ellipsis at the end of the sentence.
The change to the spec + javadoc occurred in the last draft of the spec 
(a couple of months ago, i think) so maybe tomcat 5 hasn't caught up 
yet. The change isn't discussed in the spec and is only exposed via the 
published javadoc and the javadoc in section SRV.15.1.14.1 of the spec.

We're still on 4.1.x and have to jump through a few hoops to properly 
persist data on sessionDestroyed(). :(

You could put in a Bugzilla report against 5.0.12.

Jon

Peter Maas wrote:

> Since we're developing on tomcat 5.0.12 the container should be 2.4....
> but still it is called after the session was invalidated.
> 
> Peter
> 
> Jon Wingfield wrote:
> 
>> Not in servlet 2.3 containers. Servlet spec 2.4 has changed the 
>> semantics of the sessionDestoyed method so Tomcat 5 should notify 
>> before the session is invalidated...
>>
>> http://java.sun.com/j2ee/1.4/docs/api/index.html
>>
>> HTH,
>>
>> Jon
>>
>> Peter Maas wrote:
>>
>>> Hi,
>>>
>>> I wondered if there is a way detect somehting like a 
>>> 'sessionWillBeDestroyed' event.
>>> since the sessionDestroyed method in a sessionListener seems to be 
>>> called after the session was destroyed.
>>>
>>> Peter
>>>
>>>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: SessionListener

Posted by Peter Maas <pe...@noterik.nl>.
Since we're developing on tomcat 5.0.12 the container should be 2.4....
but still it is called after the session was invalidated.

Peter

Jon Wingfield wrote:

> Not in servlet 2.3 containers. Servlet spec 2.4 has changed the 
> semantics of the sessionDestoyed method so Tomcat 5 should notify 
> before the session is invalidated...
>
> http://java.sun.com/j2ee/1.4/docs/api/index.html
>
> HTH,
>
> Jon
>
> Peter Maas wrote:
>
>> Hi,
>>
>> I wondered if there is a way detect somehting like a 
>> 'sessionWillBeDestroyed' event.
>> since the sessionDestroyed method in a sessionListener seems to be 
>> called after the session was destroyed.
>>
>> Peter
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: SessionListener

Posted by Jon Wingfield <jo...@mkodo.com>.
Not in servlet 2.3 containers. Servlet spec 2.4 has changed the 
semantics of the sessionDestoyed method so Tomcat 5 should notify before 
the session is invalidated...

http://java.sun.com/j2ee/1.4/docs/api/index.html

HTH,

Jon

Peter Maas wrote:
> Hi,
> 
> I wondered if there is a way detect somehting like a 
> 'sessionWillBeDestroyed' event.
> since the sessionDestroyed method in a sessionListener seems to be 
> called after the session was destroyed.
> 
> Peter
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: SessionListener

Posted by Jean-Francois Arcand <jf...@apache.org>.

Peter Maas wrote:

> Hi,
>
> I wondered if there is a way detect somehting like a 
> 'sessionWillBeDestroyed' event.
> since the sessionDestroyed method in a sessionListener seems to be 
> called after the session was destroyed. 

Use Tomcat 5 ;-) The Servlet spec has been modified to do exactly what 
you want.

-- Jeanfrancois

>
>
> Peter
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org