You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Joey <jo...@gmail.com> on 2008/06/26 12:53:28 UTC

How to get all sessions in one web application

Hi,

Just want to know how to get all sessions.
now, I used a listener to add ActionContext.getContext().getSession()
to a list by myself, I just wondering maybe there is a struts API can
get all sessions.

Thanks.

Joey

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


Re: How to get all sessions in one web application

Posted by Lukasz Lenart <lu...@googlemail.com>.
Hi,

The best option is to build your own session listener like that [1]
and register it with web.xml

[1] http://www.java2s.com/Code/Java/Servlets/Servletsessionlistener.htm


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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


Re: How to get all sessions in one web application

Posted by Jorge Martín Cuervo <jo...@defactops.com>.
Hi Joey, i think this is not a struts issue. As far as i know, you can't
access all sessions with servlet 2.3 compliant container (i don't know
earlier versions)

You can try to use session listeners to session store info in a common
place or jmx solution.

El jue, 26-06-2008 a las 18:53 +0800, Joey escribió:
> Hi,
> 
> Just want to know how to get all sessions.
> now, I used a listener to add ActionContext.getContext().getSession()
> to a list by myself, I just wondering maybe there is a struts API can
> get all sessions.
> 
> Thanks.
> 
> Joey
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
-- 
;-)
____________________________________
Jorge Martin Cuervo
 
Outsourcing Emarketplace
deFacto Powered by Standards
 
email <jo...@defactops.com>
voice +34 984 832 659
voice +34 660 026 384
____________________________________


DE FACTO STANDARDS, S.L., le informa que su dirección de correo electrónico, así 
como el resto de los datos de carácter personal que nos facilite, serán objeto 
de tratamiento automatizado en nuestros ficheros, con la finalidad del envío de 
información comercial y/o personal por vía electrónica. Vd. podrá en cualquier 
momento ejercer el derecho de acceso, rectificación, cancelación y oposición en 
los términos establecidos en la Ley Orgánica de Protección de Datos de Carácter 
Personal (LOPD. 15/1999),  dirigiendo un escrito a C/ Rivero 31 1º Izda. - 33402 
AVILES (Asturias), o a nuestra dirección de correo electrónico 
(info@defactops.com). También informamos que la información incluida en este 
e-mail es CONFIDENCIAL, siendo para uso exclusivo del destinatario arriba 
mencionado. Si Usted lee este mensaje y no es el destinatario indicado, le 
informamos que está totalmente prohibida cualquier utilización, divulgación, 
distribución y/o reproducción de esta comunicación sin autorización expresa en 
virtud de la legislación vigente.  Si ha recibido este mensaje por error, le 
rogamos nos lo notifique inmediatamente por esta misma vía y proceda a su 
eliminación.

This e-mail contains information that will be added to our computerised guest 
data base and will be trated in the strict confidence. If you wish to access, 
correct, oppose or cancel your details, as specified the Law 15/99, December 
13th, please send a certified letter to this effect to DE FACTO STANDARDS, 
S.L.., (C/ Rivero 31 1º Izda. - 33402 AVILES (Asturias) SPAIN). If you read this 
message, and is not the destinatary, we informal you that is forbidden anything 
utility, distribution, divulgation or reproduction of this communication without 
express authorization, of the present law.  If you received this message for 
mistake, we proud in order to the present law, immediate communication to us, 
and please erase this e-mail


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


Re: How to get all sessions in one web application

Posted by Paweł Wielgus <po...@gmail.com>.
Hi Joey,
from a security point of view, this should be forbiden.
But You may have a look at manager application from tomcat distribution,
there is exactly such thing that counts and show all sessions in
application. I've no idea how it's done there though, but most likely
there are sources for it in distribution.

Best greetings,
Paweł Wielgus.


On 26/06/2008, Joey <jo...@gmail.com> wrote:
> for example, in a application,  a admin user maybe want to check all
>  sessions on this application, just for this....
>  as I wrote in my first email, I am using  a listener to add each
>  session when a session created, but I am lazy', so just wondering
>  maybe there is a better and easier way to get all sessions.
>
>  On Thu, Jun 26, 2008 at 7:08 PM, Wendy Smoak <ws...@gmail.com> wrote:
>  > On Thu, Jun 26, 2008 at 3:53 AM, Joey <jo...@gmail.com> wrote:
>  >
>  >> Just want to know how to get all sessions.
>  >> now, I used a listener to add ActionContext.getContext().getSession()
>  >> to a list by myself, I just wondering maybe there is a struts API can
>  >> get all sessions.
>  >
>  > AFAIK there is no 'getSessions' method anywhere in the Servlet spec.
>  > (You should be able to see the session you are in, but not the
>  > others.)
>  >
>  > What problem are you trying to solve by doing this?
>  >
>  > --
>  > Wendy
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  > For additional commands, e-mail: user-help@struts.apache.org
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: How to get all sessions in one web application

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
Most application servers expose some kind of monitoring and management  
operations, usually through JMX. Check the documentation for your  
application server for more information.

Nils-H

On 26. juni. 2008, at 13.42, Joey <jo...@gmail.com> wrote:

> for example, in a application,  a admin user maybe want to check all
> sessions on this application, just for this....
> as I wrote in my first email, I am using  a listener to add each
> session when a session created, but I am lazy', so just wondering
> maybe there is a better and easier way to get all sessions.
>
> On Thu, Jun 26, 2008 at 7:08 PM, Wendy Smoak <ws...@gmail.com> wrote:
>> On Thu, Jun 26, 2008 at 3:53 AM, Joey <jo...@gmail.com>  
>> wrote:
>>
>>> Just want to know how to get all sessions.
>>> now, I used a listener to add ActionContext.getContext().getSession 
>>> ()
>>> to a list by myself, I just wondering maybe there is a struts API  
>>> can
>>> get all sessions.
>>
>> AFAIK there is no 'getSessions' method anywhere in the Servlet spec.
>> (You should be able to see the session you are in, but not the
>> others.)
>>
>> What problem are you trying to solve by doing this?
>>
>> --
>> Wendy
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

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


Re: How to get all sessions in one web application

Posted by Joey <jo...@gmail.com>.
for example, in a application,  a admin user maybe want to check all
sessions on this application, just for this....
as I wrote in my first email, I am using  a listener to add each
session when a session created, but I am lazy', so just wondering
maybe there is a better and easier way to get all sessions.

On Thu, Jun 26, 2008 at 7:08 PM, Wendy Smoak <ws...@gmail.com> wrote:
> On Thu, Jun 26, 2008 at 3:53 AM, Joey <jo...@gmail.com> wrote:
>
>> Just want to know how to get all sessions.
>> now, I used a listener to add ActionContext.getContext().getSession()
>> to a list by myself, I just wondering maybe there is a struts API can
>> get all sessions.
>
> AFAIK there is no 'getSessions' method anywhere in the Servlet spec.
> (You should be able to see the session you are in, but not the
> others.)
>
> What problem are you trying to solve by doing this?
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: How to get all sessions in one web application

Posted by Wendy Smoak <ws...@gmail.com>.
On Thu, Jun 26, 2008 at 3:53 AM, Joey <jo...@gmail.com> wrote:

> Just want to know how to get all sessions.
> now, I used a listener to add ActionContext.getContext().getSession()
> to a list by myself, I just wondering maybe there is a struts API can
> get all sessions.

AFAIK there is no 'getSessions' method anywhere in the Servlet spec.
(You should be able to see the session you are in, but not the
others.)

What problem are you trying to solve by doing this?

-- 
Wendy

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