Re: Ejectute a method on an object instance when session is deactivated.

2003-03-17 Thread Jon Wingfield
I think in servlet spec 2.4 there is an event generated just before the 
session is invalidated. Until then:

I implemented a HttpSessionAttributeListener. When a session is about to 
be invalidated all its attributes are removed. So, if you have an 
attribute which lasts for the lifetime of the session you can do your 
session clean-up when it gets removed :)

Also, if you have session persistance turned on sessionDestroyed(...) 
won't necessarily be called when you shut down tomcat. It may be called 
when you start up tomcat again later and the persisted session 
immediately times out ;)

Jon

Alexander Wallace wrote:
I tryed that but when I do getAttribute(myObj) from the session, I get an 
error saying that the session has already been invalidated.

Any clues?

On Friday 14 March 2003 13:17, Shapira, Yoav wrote:

Howdy,
In a SessionListener's sessionDestroyed() method, the HttpSessionEvent
argument has a getSession() method you get use to get the Session
itself, and then do getAttribute(...) on the session to get the
object.
Yoav Shapira
Millennium ChemInformatics




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Ejectute a method on an object instance when session is deactivated.

2003-03-14 Thread Shapira, Yoav

Howdy,
In a SessionListener's sessionDestroyed() method, the HttpSessionEvent
argument has a getSession() method you get use to get the Session
itself, and then do getAttribute(...) on the session to get the
object.

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Alexander Wallace [mailto:[EMAIL PROTECTED]
Sent: Friday, March 14, 2003 2:13 PM
To: Tomcat Users List
Subject: Ejectute a method on an object instance when session is
deactivated.

Hi there... I don't need sessionpersistence. Bu i do need to execute a
method
on an instance of an object that is in the session when it's about to
expire.
Can someone point me on a direction? I know I can implement a session
listener, but ho do I grab the objects of the session that is about to
be
closed?

Thanks.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Ejectute a method on an object instance when session is deactivated.

2003-03-14 Thread Alexander Wallace
Thanyou very much for the help!

On Friday 14 March 2003 13:17, Shapira, Yoav wrote:
 Howdy,
 In a SessionListener's sessionDestroyed() method, the HttpSessionEvent
 argument has a getSession() method you get use to get the Session
 itself, and then do getAttribute(...) on the session to get the
 object.

 Yoav Shapira
 Millennium ChemInformatics

 -Original Message-

 From: Alexander Wallace [mailto:[EMAIL PROTECTED]

 Sent: Friday, March 14, 2003 2:13 PM
 To: Tomcat Users List
 Subject: Ejectute a method on an object instance when session is
 deactivated.
 
 Hi there... I don't need sessionpersistence. Bu i do need to execute a
 method
 on an instance of an object that is in the session when it's about to
 expire.
 Can someone point me on a direction? I know I can implement a session
 listener, but ho do I grab the objects of the session that is about to

 be

 closed?
 
 Thanks.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 This e-mail, including any attachments, is a confidential business
 communication, and may contain information that is confidential,
 proprietary and/or privileged.  This e-mail is intended only for the
 individual(s) to whom it is addressed, and may not be saved, copied,
 printed, disclosed or used by anyone else.  If you are not the(an) intended
 recipient, please immediately delete this e-mail from your computer system
 and notify the sender.  Thank you.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Ejectute a method on an object instance when session is deactivated.

2003-03-14 Thread Alexander Wallace
I tryed that but when I do getAttribute(myObj) from the session, I get an 
error saying that the session has already been invalidated.

Any clues?

On Friday 14 March 2003 13:17, Shapira, Yoav wrote:
 Howdy,
 In a SessionListener's sessionDestroyed() method, the HttpSessionEvent
 argument has a getSession() method you get use to get the Session
 itself, and then do getAttribute(...) on the session to get the
 object.

 Yoav Shapira
 Millennium ChemInformatics

 -Original Message-

 From: Alexander Wallace [mailto:[EMAIL PROTECTED]

 Sent: Friday, March 14, 2003 2:13 PM
 To: Tomcat Users List
 Subject: Ejectute a method on an object instance when session is
 deactivated.
 
 Hi there... I don't need sessionpersistence. Bu i do need to execute a
 method
 on an instance of an object that is in the session when it's about to
 expire.
 Can someone point me on a direction? I know I can implement a session
 listener, but ho do I grab the objects of the session that is about to

 be

 closed?
 
 Thanks.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 This e-mail, including any attachments, is a confidential business
 communication, and may contain information that is confidential,
 proprietary and/or privileged.  This e-mail is intended only for the
 individual(s) to whom it is addressed, and may not be saved, copied,
 printed, disclosed or used by anyone else.  If you are not the(an) intended
 recipient, please immediately delete this e-mail from your computer system
 and notify the sender.  Thank you.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]