You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Simha, Kailas" <ka...@merck.com> on 2003/10/02 20:50:31 UTC

Accessing Sessions in the container

Hi all,
How would I be able to access/list all the sessions running on a
JVM/Container? Any sample code would be delightfully welcome!
Thanks in advance,
Kailas


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


Re: Accessing Sessions in the container

Posted by Filip Hanik <de...@hanik.com>.
put a Valve in your context and you can do all kinds of things there

on the invoke you can do

StandardManager manager =
(StandardManager)request.getContext().getManager();
Session[] sessions = manager.findSessions();

the valve if configured only to one context to so you will only get one
manager, ie one webapp

Filip

----- Original Message -----
From: "Tim Funk" <fu...@joedog.org>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Thursday, October 02, 2003 11:56 AM
Subject: Re: Accessing Sessions in the container


But that restriction can be bypssed by creating a SessionListener to store
these sessions yourself in ServletContext scope. Search the archive for more
info about this.

Doing so can also easily create a memory leak if one is not careful.

-Tim

Filip Hanik wrote:

> prohibited by spec
>
> Filip
>
> ----- Original Message -----
> From: "Simha, Kailas" <ka...@merck.com>
> To: "'Tomcat Users List'" <to...@jakarta.apache.org>
> Sent: Thursday, October 02, 2003 11:50 AM
> Subject: Accessing Sessions in the container
>
>
> Hi all,
> How would I be able to access/list all the sessions running on a
> JVM/Container? Any sample code would be delightfully welcome!
> Thanks in advance,
> Kailas
>
>
> ---------------------------------------------------------------------
> 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: Accessing Sessions in the container

Posted by Tim Funk <fu...@joedog.org>.
But that restriction can be bypssed by creating a SessionListener to store 
these sessions yourself in ServletContext scope. Search the archive for more 
info about this.

Doing so can also easily create a memory leak if one is not careful.

-Tim

Filip Hanik wrote:

> prohibited by spec
> 
> Filip
> 
> ----- Original Message ----- 
> From: "Simha, Kailas" <ka...@merck.com>
> To: "'Tomcat Users List'" <to...@jakarta.apache.org>
> Sent: Thursday, October 02, 2003 11:50 AM
> Subject: Accessing Sessions in the container
> 
> 
> Hi all,
> How would I be able to access/list all the sessions running on a
> JVM/Container? Any sample code would be delightfully welcome!
> Thanks in advance,
> Kailas
> 
> 
> ---------------------------------------------------------------------
> 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: Accessing Sessions in the container

Posted by Filip Hanik <de...@hanik.com>.
prohibited by spec

Filip

----- Original Message ----- 
From: "Simha, Kailas" <ka...@merck.com>
To: "'Tomcat Users List'" <to...@jakarta.apache.org>
Sent: Thursday, October 02, 2003 11:50 AM
Subject: Accessing Sessions in the container


Hi all,
How would I be able to access/list all the sessions running on a
JVM/Container? Any sample code would be delightfully welcome!
Thanks in advance,
Kailas


---------------------------------------------------------------------
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