RE: How do I get the total number of users logged into my app

2003-07-21 Thread Kevin Ritter
I never thought about doing it this way. Great solution! I'll let you know
how it turns out.

With kind regards,
Kevin Ritter

-Original Message-
From: Bill Barker [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 18, 2003 9:57 PM
To: [EMAIL PROTECTED]
Subject: Re: How do I get the total number of users logged into my app

I'd go for something a little safer myself.  Declaire a HttpSessionListener
something like:

public class MyCounter implements HttpSessionListener {
private boolean registered = false;
private int sessionCount = 0;

public void sessionCreated(HttpSessionEvent ev) {
if(!registered) {
ServletContext context = ev.getSession().getServletContext();
context.setAttribute(com.myfirm.session.counter, this);
registered = true;
   }
   ++sessionCount;
   }
   public void sessionDestroyed(HttpSessionEvent ev) {
   --sessionCount;
   }
   public int getSessionCount() {
return sessionCount;
   }
}

Your servlet/jsp can then just get the attribute from the ServletContext,
and query the count.

Tim Funk [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 When you declare your webapp, it must be privledged. Look at the manager
 webapp declaration.

 -Tim

 Kevin Ritter wrote:
  Thanks for the quick response; however, when I do I get the following
error
 
  java.lang.SecurityException: Servlet of class
  org.apache.catalina.servlets.ManagerServlet is privileged and cannot be
  loaded by this web application
 
  The url is http://localhost:8080/manager/sessions?path=/LMS
 
  Again, thanks in advance.
 
  Kevin Ritter
 
  -Original Message-
  From: Angus Mezick [mailto:[EMAIL PROTECTED]
  Sent: Friday, July 18, 2003 2:12 PM
  To: Tomcat Users List
  Subject: RE: How do I get the total number of users logged into my app
 
  Look in the manager app.
 
 
 -Original Message-
 From: Kevin Ritter [mailto:[EMAIL PROTECTED]
 Sent: Friday, July 18, 2003 3:17 PM
 To: 'Tomcat Users List'
 Subject: How do I get the total number of users logged into my app
 
 
 I would like to know if there is a parameter or class or JSP
 that I could
 use to return the total number of users/sessions that are
 using/logged into
 my application.
 
 Thank you in advance.
 
 Kevin Ritter
 
 -
 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]

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



RE: How do I get the total number of users logged into my app

2003-07-18 Thread Angus Mezick
Look in the manager app.

 -Original Message-
 From: Kevin Ritter [mailto:[EMAIL PROTECTED] 
 Sent: Friday, July 18, 2003 3:17 PM
 To: 'Tomcat Users List'
 Subject: How do I get the total number of users logged into my app
 
 
 I would like to know if there is a parameter or class or JSP 
 that I could
 use to return the total number of users/sessions that are 
 using/logged into
 my application.
 
 Thank you in advance.
 
 Kevin Ritter
 
 -
 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: How do I get the total number of users logged into my app

2003-07-18 Thread Kevin Ritter
Thanks for the quick response; however, when I do I get the following error

java.lang.SecurityException: Servlet of class
org.apache.catalina.servlets.ManagerServlet is privileged and cannot be
loaded by this web application

The url is http://localhost:8080/manager/sessions?path=/LMS

Again, thanks in advance.

Kevin Ritter

-Original Message-
From: Angus Mezick [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 18, 2003 2:12 PM
To: Tomcat Users List
Subject: RE: How do I get the total number of users logged into my app

Look in the manager app.

 -Original Message-
 From: Kevin Ritter [mailto:[EMAIL PROTECTED] 
 Sent: Friday, July 18, 2003 3:17 PM
 To: 'Tomcat Users List'
 Subject: How do I get the total number of users logged into my app
 
 
 I would like to know if there is a parameter or class or JSP 
 that I could
 use to return the total number of users/sessions that are 
 using/logged into
 my application.
 
 Thank you in advance.
 
 Kevin Ritter
 
 -
 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: How do I get the total number of users logged into my app

2003-07-18 Thread Tim Funk
When you declare your webapp, it must be privledged. Look at the manager 
webapp declaration.

-Tim

Kevin Ritter wrote:
Thanks for the quick response; however, when I do I get the following error

java.lang.SecurityException: Servlet of class
org.apache.catalina.servlets.ManagerServlet is privileged and cannot be
loaded by this web application
The url is http://localhost:8080/manager/sessions?path=/LMS

Again, thanks in advance.

Kevin Ritter

-Original Message-
From: Angus Mezick [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 18, 2003 2:12 PM
To: Tomcat Users List
Subject: RE: How do I get the total number of users logged into my app

Look in the manager app.


-Original Message-
From: Kevin Ritter [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 18, 2003 3:17 PM
To: 'Tomcat Users List'
Subject: How do I get the total number of users logged into my app

I would like to know if there is a parameter or class or JSP 
that I could
use to return the total number of users/sessions that are 
using/logged into
my application.

Thank you in advance.

Kevin Ritter

-
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: How do I get the total number of users logged into my app

2003-07-18 Thread Bill Barker
I'd go for something a little safer myself.  Declaire a HttpSessionListener
something like:

public class MyCounter implements HttpSessionListener {
private boolean registered = false;
private int sessionCount = 0;

public void sessionCreated(HttpSessionEvent ev) {
if(!registered) {
ServletContext context = ev.getSession().getServletContext();
context.setAttribute(com.myfirm.session.counter, this);
registered = true;
   }
   ++sessionCount;
   }
   public void sessionDestroyed(HttpSessionEvent ev) {
   --sessionCount;
   }
   public int getSessionCount() {
return sessionCount;
   }
}

Your servlet/jsp can then just get the attribute from the ServletContext,
and query the count.

Tim Funk [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 When you declare your webapp, it must be privledged. Look at the manager
 webapp declaration.

 -Tim

 Kevin Ritter wrote:
  Thanks for the quick response; however, when I do I get the following
error
 
  java.lang.SecurityException: Servlet of class
  org.apache.catalina.servlets.ManagerServlet is privileged and cannot be
  loaded by this web application
 
  The url is http://localhost:8080/manager/sessions?path=/LMS
 
  Again, thanks in advance.
 
  Kevin Ritter
 
  -Original Message-
  From: Angus Mezick [mailto:[EMAIL PROTECTED]
  Sent: Friday, July 18, 2003 2:12 PM
  To: Tomcat Users List
  Subject: RE: How do I get the total number of users logged into my app
 
  Look in the manager app.
 
 
 -Original Message-
 From: Kevin Ritter [mailto:[EMAIL PROTECTED]
 Sent: Friday, July 18, 2003 3:17 PM
 To: 'Tomcat Users List'
 Subject: How do I get the total number of users logged into my app
 
 
 I would like to know if there is a parameter or class or JSP
 that I could
 use to return the total number of users/sessions that are
 using/logged into
 my application.
 
 Thank you in advance.
 
 Kevin Ritter
 
 -
 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]