tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <>
Subject Re: Retrieve certain session data inside a servlet
Date Sat, 03 Jun 2006 02:17:05 GMT
I may be wrong about this, but I thought that it was expressly forbidden 
by the servlet spec to be able to get arbitrary sessions.  That is, even 
if you store the session ID in some table, you wouldn't be able to get 
any session other than that associated with the current request.

Now, that refers to standards-compliant ways to do it... I'm sure most 
app servers give you their own way to pull it off... JMX pops to mind as 
a likely possibility.

(unless I'm wrong-LOL)


Eric Haszlakiewicz wrote:
> On Fri, Jun 02, 2006 at 11:15:03AM +0200, Carlos Alonso Vega wrote:
>> Bob,
>> Thanks for the reply. My problem is that the session info I need is not 
>> of the session that makes the request. I need to check other sessions in 
>> the same context.  I can use the request because it is in the same 
>> context, so the manager is the same.
>> This servlet is called internally from the app, and checks if some 
>> session exists. It is similar to the case of obtaining all active 
>> sessions from one context using the manager inside the servlet code 
>> (findSessions). If someone have this piece of code (or similar), it will 
>> serve me.
> 	To do something like that you need to do it yourself.  i.e. store a
> HashTable in the application context, then add and remove sessions to
> it when people login and logout, or at some other convinient time.
> Of course, this assumes your app isn't running in a distributed environment.
> If it is, then it's impossible to get a session object from a different
> JVM.  (well, you could serialize it and transfer the data, but it won't
> be the same object and it won't be useful for much other than extracting
> some info)
> eric
> ---------------------------------------------------------------------
> To start a new topic, e-mail:
> To unsubscribe, e-mail:
> For additional commands, e-mail:
> .

Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
AIM: fzammetti
Yahoo: fzammetti
Java Web Parts -
Supplying the wheel, so you don't have to reinvent it!

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message