Re: Getting other Sessions

2005-03-23 Thread Joseph Shraibman

Michael Greer wrote:
List servers = MBeanServerFactory.findMBeanServer(null);
MBeanServer server = (MBeanServer)servers.get(0);
ObjectName objName = new 
ObjectName(Catalina:type=Manager,path=/contextPath,host=localhost);

String sessionIds = 
(String)server.invoke(objName,listSessionIds,null, null);

You can get the rest by each sessionId.
How do I get a refrence to the Session once I have the id?
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


AW: Getting other Sessions

2005-02-23 Thread Bernhard Slominski
Hi,
HttpSession.getAttributeNames()
should do what you want!
From the javadoc:

getAttributeNames
public java.util.Enumeration getAttributeNames()
Returns an Enumeration of String objects containing the names of all the
objects bound to this session.

Cheers

Bernhard

-Ursprüngliche Nachricht-
Von: Joseph Shraibman [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 23. Februar 2005 05:18
An: tomcat-user@jakarta.apache.org
Betreff: Getting other Sessions


I want to make an admin page in my application.  I needs to be able to 
get access to all the current Session objects to access their 
attributes.  Is this possible?

-
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: Getting other Sessions

2005-02-23 Thread Dale, Matt

Hi,

That doesn't answer Joseph's question. It tells him how to access the objects 
in his own session but not how to access other peoples sessions. I would be 
interested to see how this is done as well.

Ta
Matt

-Original Message-
From: Bernhard Slominski [mailto:[EMAIL PROTECTED]
Sent: 23 February 2005 09:17
To: 'Tomcat Users List'
Subject: AW: Getting other Sessions


Hi,
HttpSession.getAttributeNames()
should do what you want!
From the javadoc:

getAttributeNames
public java.util.Enumeration getAttributeNames()
Returns an Enumeration of String objects containing the names of all the
objects bound to this session.

Cheers

Bernhard

-Ursprüngliche Nachricht-
Von: Joseph Shraibman [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 23. Februar 2005 05:18
An: tomcat-user@jakarta.apache.org
Betreff: Getting other Sessions


I want to make an admin page in my application.  I needs to be able to 
get access to all the current Session objects to access their 
attributes.  Is this possible?

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

Any opinions expressed in this E-mail may be those of the individual and not 
necessarily the company. This E-mail and any files transmitted with it are 
confidential and solely for the use of the intended recipient. If you are not 
the intended recipient or the person responsible for delivering to the intended 
recipient, be advised that you have received this E-mail in error and that any 
use or copying is strictly prohibited. If you have received this E-mail in 
error please notify the beCogent postmaster at [EMAIL PROTECTED]
Unless expressly stated, opinions in this email are those of the individual 
sender and not beCogent Ltd. You must take full responsibility for virus 
checking this email and any attachments.
Please note that the content of this email or any of its attachments may 
contain data that falls within the scope of the Data Protection Acts and that 
you must ensure that any handling or processing of such data by you is fully 
compliant with the terms and provisions of the Data Protection Act 1984 and 
1998.


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

AW: Getting other Sessions

2005-02-23 Thread Bernhard Slominski
Hi Matt, Joseph,

you're right,  I was not reading Joseph's question properly, I thought he
want wants all objects IN the session.
I also can't think of another solution than Antony mentioned earlier.

Bernhard

-Ursprüngliche Nachricht-
Von: Dale, Matt [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 23. Februar 2005 10:25
An: Tomcat Users List
Betreff: RE: Getting other Sessions



Hi,

That doesn't answer Joseph's question. It tells him how to access the
objects in his own session but not how to access other peoples sessions. I
would be interested to see how this is done as well.

Ta
Matt

-Original Message-
From: Bernhard Slominski [mailto:[EMAIL PROTECTED]
Sent: 23 February 2005 09:17
To: 'Tomcat Users List'
Subject: AW: Getting other Sessions


Hi,
HttpSession.getAttributeNames()
should do what you want!
From the javadoc:

getAttributeNames
public java.util.Enumeration getAttributeNames()
Returns an Enumeration of String objects containing the names of all the
objects bound to this session.

Cheers

Bernhard

-Ursprüngliche Nachricht-
Von: Joseph Shraibman [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 23. Februar 2005 05:18
An: tomcat-user@jakarta.apache.org
Betreff: Getting other Sessions


I want to make an admin page in my application.  I needs to be able to 
get access to all the current Session objects to access their 
attributes.  Is this possible?

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


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



RE: AW: Getting other Sessions

2005-02-23 Thread Mark Benussi
You need to implement a Session Listener like this.
public class SessionHelper implements HttpSessionListener {
	private static Hashtable sessionsById = null;
	/**
	 * @see 
javax.servlet.http.HttpSessionListener#sessionCreated(javax.servlet.http.HttpSessionEvent)
	 */
	public void sessionCreated(HttpSessionEvent sessionEvent) {
		if (sessionsById == null) {
			sessionsById = new Hashtable();
		}
		HttpSession session = sessionEvent.getSession();
		String sessionId = session.getId();
		sessionsById.put(sessionId, session);
	}
	/**
	 * @see 
javax.servlet.http.HttpSessionListener#sessionDestroyed(javax.servlet.http.HttpSessionEvent)
	 */
	public void sessionDestroyed(HttpSessionEvent sessionEvent) {
	}
}

Then you can access the sessions via this session helpers Hashtable.
Finally you need to add the following to your web.xml.
web-app id=WebApp
display-nameblah/display-name
listener
listener-classSessionHelper/listener-class
/listener
.. etc
Cheers,
Mark
Original Message Follows
From: Bernhard Slominski [EMAIL PROTECTED]
Reply-To: Tomcat Users List tomcat-user@jakarta.apache.org
To: 'Tomcat Users List' tomcat-user@jakarta.apache.org
Subject: AW: Getting other Sessions
Date: Wed, 23 Feb 2005 10:31:00 +0100
Hi Matt, Joseph,
you're right,  I was not reading Joseph's question properly, I thought he
want wants all objects IN the session.
I also can't think of another solution than Antony mentioned earlier.
Bernhard
-Ursprüngliche Nachricht-
Von: Dale, Matt [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 23. Februar 2005 10:25
An: Tomcat Users List
Betreff: RE: Getting other Sessions

Hi,
That doesn't answer Joseph's question. It tells him how to access the
objects in his own session but not how to access other peoples sessions. I
would be interested to see how this is done as well.
Ta
Matt
-Original Message-
From: Bernhard Slominski [mailto:[EMAIL PROTECTED]
Sent: 23 February 2005 09:17
To: 'Tomcat Users List'
Subject: AW: Getting other Sessions
Hi,
HttpSession.getAttributeNames()
should do what you want!
From the javadoc:
getAttributeNames
public java.util.Enumeration getAttributeNames()
Returns an Enumeration of String objects containing the names of all 
the
objects bound to this session.

Cheers
Bernhard
-Ursprüngliche Nachricht-
Von: Joseph Shraibman [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 23. Februar 2005 05:18
An: tomcat-user@jakarta.apache.org
Betreff: Getting other Sessions
I want to make an admin page in my application.  I needs to be able to
get access to all the current Session objects to access their
attributes.  Is this possible?
-
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]
-
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: Getting other Sessions

2005-02-23 Thread Christoph Kutzinski
Hi,
looks to me that this was included in a previous version of the API, but 
was removed for security reasons:
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSessionContext.html

Therefore the only way to get all sessions is probably a SessionListener.
HTH
Christoph
Dale, Matt wrote:
Hi,
That doesn't answer Joseph's question. It tells him how to access the objects 
in his own session but not how to access other peoples sessions. I would be 
interested to see how this is done as well.
Ta
Matt
-Original Message-
From: Bernhard Slominski [mailto:[EMAIL PROTECTED]
Sent: 23 February 2005 09:17
To: 'Tomcat Users List'
Subject: AW: Getting other Sessions
Hi,
HttpSession.getAttributeNames()
should do what you want!
From the javadoc:
getAttributeNames
public java.util.Enumeration getAttributeNames()
   Returns an Enumeration of String objects containing the names of all the
objects bound to this session.
Cheers
Bernhard
-Ursprüngliche Nachricht-
Von: Joseph Shraibman [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 23. Februar 2005 05:18
An: tomcat-user@jakarta.apache.org
Betreff: Getting other Sessions
I want to make an admin page in my application.  I needs to be able to 
get access to all the current Session objects to access their 
attributes.  Is this possible?

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


Any opinions expressed in this E-mail may be those of the individual and not 
necessarily the company. This E-mail and any files transmitted with it are 
confidential and solely for the use of the intended recipient. If you are not 
the intended recipient or the person responsible for delivering to the intended 
recipient, be advised that you have received this E-mail in error and that any 
use or copying is strictly prohibited. If you have received this E-mail in 
error please notify the beCogent postmaster at [EMAIL PROTECTED]
Unless expressly stated, opinions in this email are those of the individual 
sender and not beCogent Ltd. You must take full responsibility for virus 
checking this email and any attachments.
Please note that the content of this email or any of its attachments may 
contain data that falls within the scope of the Data Protection Acts and that 
you must ensure that any handling or processing of such data by you is fully 
compliant with the terms and provisions of the Data Protection Act 1984 and 
1998.
 


-
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: Getting other Sessions

2005-02-23 Thread Michael Greer
List servers = MBeanServerFactory.findMBeanServer(null);
MBeanServer server = (MBeanServer)servers.get(0);
	ObjectName objName = new 
ObjectName(Catalina:type=Manager,path=/contextPath,host=localhost);
	
	String sessionIds = 
(String)server.invoke(objName,listSessionIds,null, null);

You can get the rest by each sessionId. Take a look at the MBean docs 
on how to make jmx calls. There is a jmxproxy in 5.5 manager app which 
shows all of the mbeans by default, and lets you test your queries. 
Complex, but not hard.

-Michael Greer  
On Feb 22, 2005, at 11:17 PM, Joseph Shraibman wrote:
I want to make an admin page in my application.  I needs to be able to 
get access to all the current Session objects to access their 
attributes.  Is this possible?

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


Getting other Sessions

2005-02-22 Thread Joseph Shraibman
I want to make an admin page in my application.  I needs to be able to 
get access to all the current Session objects to access their 
attributes.  Is this possible?

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


Re: Getting other Sessions

2005-02-22 Thread Antony Paul
You can put all the sessions in List or Map when they login or use
HttpSessionListener to listen to session events.

rgds
Antony Paul


On Tue, 22 Feb 2005 23:17:56 -0500, Joseph Shraibman
jks@selectacast.net wrote:
 I want to make an admin page in my application.  I needs to be able to
 get access to all the current Session objects to access their
 attributes.  Is this possible?
 
 -
 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: Getting other Sessions

2005-02-22 Thread Joseph Shraibman

Antony Paul wrote:
You can put all the sessions in List or Map when they login or use
HttpSessionListener to listen to session events.
That was my fallback plan, if there wasn't an easier way.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]