RE: sharing sessions across multiple webapps
Howdy, You want to find out the number of active sessions (or active users) in each app. So you write an HttpSessionListener which keeps a counter that is incremented in every sessionCreated event and decremented in every sessionDestroyed event. This is fairly simple and has been covered many times on this list in the past. Your case is slightly more complicates, because you want one object to keep track of users in all web applications. Even though I think this is a bad idea (it violates webapp self-containment principles), here's how you would go about it. You can't just use the listener approach above because there will be one instance of the listener for each webapp. So you instead have a singleton object which keeps the counter (either one total counter or one counter per webapp, or both, depending on what you want to do). Your listeners don't keep a count themselves: instead, they increment and decrement the count in the singleton. The singleton is deployed in $CATALINA_HOME/common/lib or $CATALINA_HOME/shared/lib, so that all applications can access it. Yoav Shapira Millennium ChemInformatics >-Original Message- >From: Kumar, Sumit [mailto:[EMAIL PROTECTED] >Sent: Tuesday, November 25, 2003 3:09 PM >To: 'Tomcat Users List' >Subject: RE: sharing sessions across multiple webapps > >Didn't get you. Can you explain it a little more for me. > >Thanks >-sumit > >-Original Message- >From: Shapira, Yoav [mailto:[EMAIL PROTECTED] >Sent: Tuesday, November 25, 2003 1:40 PM >To: Tomcat Users List >Subject: RE: sharing sessions across multiple webapps > > > >Howdy, >Yes, write an HttpSessionListener which accesses a singleton whose code >is in common/lib. > >Yoav Shapira >Millennium ChemInformatics > > >>-Original Message- >>From: Kumar, Sumit [mailto:[EMAIL PROTECTED] >>Sent: Tuesday, November 25, 2003 2:16 PM >>To: 'Tomcat Users List' >>Subject: sharing sessions across multiple webapps >> >>I have two webapps on my server. >>I am using the same userInformation object in both the webapps that is >>located in tomcat/common/classes. When a user is authenticated by any >>webapp >>it puts the userinformation object in session. I want to track number >of >>active users for each application. My userinformation object is >>implementing >>the HttpSessionBindingListener. The problem is it shows the total >number of >>users for both apps. Can I find out the number of active users for each >app >>and still use the code at one place. >> >>thanks >>-sumit >> >>- >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] > > > > >This e-mail, including any attachments, is a confidential business >communication, and may contain information that is confidential, >proprietary >and/or privileged. This e-mail is intended only for the individual(s) to >whom it is addressed, and may not be saved, copied, printed, disclosed or >used by anyone else. If you are not the(an) intended recipient, please >immediately delete this e-mail from your computer system and notify the >sender. Thank you. > > >- >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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: sharing sessions across multiple webapps
Didn't get you. Can you explain it a little more for me. Thanks -sumit -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 25, 2003 1:40 PM To: Tomcat Users List Subject: RE: sharing sessions across multiple webapps Howdy, Yes, write an HttpSessionListener which accesses a singleton whose code is in common/lib. Yoav Shapira Millennium ChemInformatics >-Original Message- >From: Kumar, Sumit [mailto:[EMAIL PROTECTED] >Sent: Tuesday, November 25, 2003 2:16 PM >To: 'Tomcat Users List' >Subject: sharing sessions across multiple webapps > >I have two webapps on my server. >I am using the same userInformation object in both the webapps that is >located in tomcat/common/classes. When a user is authenticated by any >webapp >it puts the userinformation object in session. I want to track number of >active users for each application. My userinformation object is >implementing >the HttpSessionBindingListener. The problem is it shows the total number of >users for both apps. Can I find out the number of active users for each app >and still use the code at one place. > >thanks >-sumit > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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: sharing sessions across multiple webapps
Howdy, Yes, write an HttpSessionListener which accesses a singleton whose code is in common/lib. Yoav Shapira Millennium ChemInformatics >-Original Message- >From: Kumar, Sumit [mailto:[EMAIL PROTECTED] >Sent: Tuesday, November 25, 2003 2:16 PM >To: 'Tomcat Users List' >Subject: sharing sessions across multiple webapps > >I have two webapps on my server. >I am using the same userInformation object in both the webapps that is >located in tomcat/common/classes. When a user is authenticated by any >webapp >it puts the userinformation object in session. I want to track number of >active users for each application. My userinformation object is >implementing >the HttpSessionBindingListener. The problem is it shows the total number of >users for both apps. Can I find out the number of active users for each app >and still use the code at one place. > >thanks >-sumit > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
sharing sessions across multiple webapps
I have two webapps on my server. I am using the same userInformation object in both the webapps that is located in tomcat/common/classes. When a user is authenticated by any webapp it puts the userinformation object in session. I want to track number of active users for each application. My userinformation object is implementing the HttpSessionBindingListener. The problem is it shows the total number of users for both apps. Can I find out the number of active users for each app and still use the code at one place. thanks -sumit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]