tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aggarwal, Ajay" <Ajay.Aggar...@stratus.com>
Subject RE: session listener and tomcat restart
Date Wed, 03 Nov 2010 16:34:07 GMT
I have found the answer and let me share it with others.

The solution is HttpSessionActivationListener.

Write a class that implements HttpSessionActivationListener. And to your
session add an attribute of this type. That's it.  This doesn't go into
web.xml (unlike HttpSessionListener).

-Ajay

-----Original Message-----
From: Aggarwal, Ajay [mailto:Ajay.Aggarwal@stratus.com] 
Sent: Wednesday, November 03, 2010 11:34 AM
To: Tomcat Users List
Subject: session listener and tomcat restart

My requirements:

1)      to be able to get the session given a JSESSIONID

2)      to persist active sessions across tomcat restart (which is
default tomcat behavior)

 

Since there is no way in tomcat (for security reasons?) to obtain the
session object given a JSESSIONID, I have implemented my own session
listener, which maintains a hash of active sessions. Now I can obtain
the session object given a JSESSIONID.

 

However I am broken on tomcat restart. Because session listener does not
notify me on the pre-existing active sessions upon restart. One solution
is to implement my own persistence in my session listener code. 

 

Q1. However I was wondering if there is a way to influence session
listener to notify me on the pre-existing active sessions upon tomcat
restart?

Q2. Is there another way to get the session given a JSESSIONID?

 

Thanks.

 

-Ajay

 

 


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


Mime
View raw message