Re: Session listener
== Date: Mon, 14 Mar 2005 17:09:35 -0600 (CST) From: Christian Rebollar [EMAIL PROTECTED] To: Tomcat Users List tomcat-user@jakarta.apache.org, [EMAIL PROTECTED] Subject: Re: Session listener == I don't know, but when I closed the browser the listener class catch sessionDestroyed event. How do you close the browser? By a link on the page itself? By closing the window? G. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Session listener
I used weblogic and HttpSessionListener interface, and when I closed browser weblogic invalidated the session and the listener class catch it, but with tomcat didn't happen the same, the session died until timeout. There is a way to do it or it can't be done?? thx _ Do You Yahoo!? La mejor conexión a internet y 25MB extra a tu correo por $100 al mes. http://net.yahoo.com.mx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session listener
How could weblogic know that you closed your browser? On Mon, 2005-03-14 at 17:57, Christian Rebollar wrote: I used weblogic and HttpSessionListener interface, and when I closed browser weblogic invalidated the session and the listener class catch it, but with tomcat didn't happen the same, the session died until timeout. There is a way to do it or it can't be done?? thx _ Do You Yahoo!? La mejor conexin a internet y 25MB extra a tu correo por $100 al mes. http://net.yahoo.com.mx - 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: Session listener
I don't know, but when I closed the browser the listener class catch sessionDestroyed event. --- Ben Souther [EMAIL PROTECTED] wrote: How could weblogic know that you closed your browser? On Mon, 2005-03-14 at 17:57, Christian Rebollar wrote: I used weblogic and HttpSessionListener interface, and when I closed browser weblogic invalidated the session and the listener class catch it, but with tomcat didn't happen the same, the session died until timeout. There is a way to do it or it can't be done?? thx _ Do You Yahoo!? La mejor conexión a internet y 25MB extra a tu correo por $100 al mes. http://net.yahoo.com.mx - 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] _ Do You Yahoo!? La mejor conexión a internet y 25MB extra a tu correo por $100 al mes. http://net.yahoo.com.mx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: session listener not listening
Hi, Are you sure that page you are accessing creates a session? ;) Yoav Shapira Millennium Research Informatics -Original Message- From: Stephen Charles Huey [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 7:06 PM To: Tomcat User Subject: session listener not listening My session listener doesn't seem to be listening. At the top of my web.xml (before any servlet elements, and I have nothing like a filter or anything else before it), I have this: listener listener-classcentral.OurSessionListener/listener-class /listener Here is my listener class: package central; import java.util.HashMap; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; import wwxchange.utility.*; import wwxchange.beans.*; public class OurSessionListener implements HttpSessionListener { public void sessionCreated(HttpSessionEvent se) { HttpSession session = se.getSession(); UserAcctBean user = (UserAcctBean) session.getAttribute(currentuser); String loginID = user.getLoginID(); System.out.println(Added session: + session.getId() + for user + user.getLoginID()); SystemControl.addActiveUser(session.getId(), user.getLoginID() ); } public void sessionDestroyed(HttpSessionEvent se) { HttpSession session = se.getSession(); SystemControl.removeActiveUser(session.getId()); System.out.println(Removed session: + session.getId()); } } My SystemControl's static HashMap doesn't seem to be getting updated, and the above methods aren't even getting called because nothing is going to stdout when I log in as different users. What am I doing wrong? Is my listener not registered to listen? Thanks, Stephen - 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: session listener not listening
I'm trying to add this session listener to a production site that often has over 2,000 concurrent users (according to the Tomcat manager app). As far as I can tell, a session is created as soon as you log in because the very first JSP is accessing a bunch of session beans. However, my listener doesn't seem to be listening! - Original message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Fri, 16 Jul 2004 08:51:47 -0400 Subject: RE: session listener not listening Hi, Are you sure that page you are accessing creates a session? ;) Yoav Shapira Millennium Research Informatics -Original Message- From: Stephen Charles Huey [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 7:06 PM To: Tomcat User Subject: session listener not listening My session listener doesn't seem to be listening. At the top of my web.xml (before any servlet elements, and I have nothing like a filter or anything else before it), I have this: listener listener-classcentral.OurSessionListener/listener-class /listener Here is my listener class: package central; import java.util.HashMap; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; import wwxchange.utility.*; import wwxchange.beans.*; public class OurSessionListener implements HttpSessionListener { public void sessionCreated(HttpSessionEvent se) { HttpSession session = se.getSession(); UserAcctBean user = (UserAcctBean) session.getAttribute(currentuser); String loginID = user.getLoginID(); System.out.println(Added session: + session.getId() + for user + user.getLoginID()); SystemControl.addActiveUser(session.getId(), user.getLoginID() ); } public void sessionDestroyed(HttpSessionEvent se) { HttpSession session = se.getSession(); SystemControl.removeActiveUser(session.getId()); System.out.println(Removed session: + session.getId()); } } My SystemControl's static HashMap doesn't seem to be getting updated, and the above methods aren't even getting called because nothing is going to stdout when I log in as different users. What am I doing wrong? Is my listener not registered to listen? Thanks, Stephen - 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: session listener not listening
One other thing: most of our web app's Java classes are put into a single JAR file in JBuilder that we then dump into Tomcat's common\lib directory. However, we have to put our servlets individually into Tomcat's common\classes directory. My session listener class gets compiled into the JAR file with all of the other classes in that central package (see below), so I was wondering if perhaps this session listener class needed to be dropped individually into the same place as where the servlets go, and I've tried that (I've even tried making sure the class was also dropped into a directory in common\lib\central in case that's what it needed). However, this still isn't working for me! At least, sessionCreated and sessionDestroyed never seem to be called, according to my print statements (and the static methods they call don't seem to be updating my session HashMap). - Original message - From: Stephen Charles Huey [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Fri, 16 Jul 2004 11:41:53 -0500 Subject: RE: session listener not listening I'm trying to add this session listener to a production site that often has over 2,000 concurrent users (according to the Tomcat manager app). As far as I can tell, a session is created as soon as you log in because the very first JSP is accessing a bunch of session beans. However, my listener doesn't seem to be listening! - Original message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Fri, 16 Jul 2004 08:51:47 -0400 Subject: RE: session listener not listening Hi, Are you sure that page you are accessing creates a session? ;) Yoav Shapira Millennium Research Informatics -Original Message- From: Stephen Charles Huey [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 7:06 PM To: Tomcat User Subject: session listener not listening My session listener doesn't seem to be listening. At the top of my web.xml (before any servlet elements, and I have nothing like a filter or anything else before it), I have this: listener listener-classcentral.OurSessionListener/listener-class /listener Here is my listener class: package central; import java.util.HashMap; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; import wwxchange.utility.*; import wwxchange.beans.*; public class OurSessionListener implements HttpSessionListener { public void sessionCreated(HttpSessionEvent se) { HttpSession session = se.getSession(); UserAcctBean user = (UserAcctBean) session.getAttribute(currentuser); String loginID = user.getLoginID(); System.out.println(Added session: + session.getId() + for user + user.getLoginID()); SystemControl.addActiveUser(session.getId(), user.getLoginID() ); } public void sessionDestroyed(HttpSessionEvent se) { HttpSession session = se.getSession(); SystemControl.removeActiveUser(session.getId()); System.out.println(Removed session: + session.getId()); } } My SystemControl's static HashMap doesn't seem to be getting updated, and the above methods aren't even getting called because nothing is going to stdout when I log in as different users. What am I doing wrong? Is my listener not registered to listen? Thanks, Stephen - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
session listener not listening
My session listener doesn't seem to be listening. At the top of my web.xml (before any servlet elements, and I have nothing like a filter or anything else before it), I have this: listener listener-classcentral.OurSessionListener/listener-class /listener Here is my listener class: package central; import java.util.HashMap; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; import wwxchange.utility.*; import wwxchange.beans.*; public class OurSessionListener implements HttpSessionListener { public void sessionCreated(HttpSessionEvent se) { HttpSession session = se.getSession(); UserAcctBean user = (UserAcctBean) session.getAttribute(currentuser); String loginID = user.getLoginID(); System.out.println(Added session: + session.getId() + for user + user.getLoginID()); SystemControl.addActiveUser(session.getId(), user.getLoginID() ); } public void sessionDestroyed(HttpSessionEvent se) { HttpSession session = se.getSession(); SystemControl.removeActiveUser(session.getId()); System.out.println(Removed session: + session.getId()); } } My SystemControl's static HashMap doesn't seem to be getting updated, and the above methods aren't even getting called because nothing is going to stdout when I log in as different users. What am I doing wrong? Is my listener not registered to listen? Thanks, Stephen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
2 Problems with Session Listener
Hello, I am using Tomcat 4.1.18 and JDK 1.4.1 I found two problem or bugs: 1) Using Session Listener's sessionDestroyed event I tried to get the session from HttpSessionEvent and log certain information from the session, however this throws an IllegalStateException because the session is already invalid. Reading the servlet API (10.7 page 73), I think it means that sessionDestroyed event should be fired before the session is destroyed. I dunno, might be wrong. 2) Any case, found a work around and I am using HttpSessionAttributeListener's attributeRemoved which mostly works well, except that now I have a new problem. I am calling this.getServletContext() but it it is returning a null if I do it from init and a null pointer exception in GenericServlet if I do it from attributeRemoved. Any one know why? Or better yet, if I can work around it? Thanks, Chanan Braunstein knovel Corp. Web Development Manager 607-648-4770 x672 http://www.knovel.com
session listener
Hello, I'd like to add a listener to a session (there's no method for this in HttpSession class). I read that I have to configure the web.xml file but I don't know how Does anyone can help me? thanks Aline WEBCASTER T +33 (0)3 28 36 25 25 F +33 (0)3 20 13 06 04 http://www.oeilpouroeil.fr http://www.visiodrome.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
AW: session listener
Hi, you can create an object that implements HttpSessionBindingListener and store this object in your current session. This object will then be informed when the session gets bound and unbound. Oliver AXA eSolutions GmbH AXA Konzern AG Germany Oliver Lauer Web Architect Wörthstraße 34 D-50668 Köln Germany Tel.: +49 221 148 31277 Fax: +49 221 148 43963 Mobil: +49 179 59 064 59 e-Mail: [EMAIL PROTECTED] _ -Ursprüngliche Nachricht- Von: Aline [mailto:[EMAIL PROTECTED]] Gesendet: Freitag, 15. März 2002 11:31 An: Tomcat Users List Betreff: session listener Hello, I'd like to add a listener to a session (there's no method for this in HttpSession class). I read that I have to configure the web.xml file but I don't know how Does anyone can help me? thanks Aline WEBCASTER T +33 (0)3 28 36 25 25 F +33 (0)3 20 13 06 04 http://www.oeilpouroeil.fr http://www.visiodrome.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- Aus Rechts- und Sicherheitsgruenden ist die in dieser E-Mail gegebene Information nicht rechtsverbindlich. Eine rechtsverbindliche Bestaetigung reichen wir Ihnen gerne auf Anforderung in schriftlicher Form nach. Beachten Sie bitte, dass jede Form der unautorisierten Nutzung, Veroeffentlichung, Vervielfaeltigung oder Weitergabe des Inhalts dieser E-Mail nicht gestattet ist.Diese Nachricht ist ausschliesslich fuer den bezeichneten Adressaten oder dessen Vertreter bestimmt. Sollten Sie nicht der vorgesehene Adressat dieser E-Mail oder dessen Vertreter sein, so bitten wir Sie, sich mit dem Absender der E-Mail in Verbindung zu setzen. For legal and security reasons the information provided in this e-mail is not legally binding. Upon request we would be pleased to provide you with a legally binding confirmation in written form. Any form of unauthorised use, publication, reproduction, copying or disclosure of the content of this e-mail is not permitted. This message is exclusively for the person addressed or their representative. If you are not the intended recipient of this message and its contents, please notify the sender immediately. == -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: AW: session listener
On Fri, 15 Mar 2002, Lauer, Oliver wrote: Date: Fri, 15 Mar 2002 11:30:05 +0100 From: Lauer, Oliver [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Subject: AW: session listener Hi, you can create an object that implements HttpSessionBindingListener and store this object in your current session. This object will then be informed when the session gets bound and unbound. Oliver's solution works for both Servlet 2.2 (Tomcat 3.x) and Servlet 2.3 (Tomcat 4.x). If you are using Tomcat 4, however, you do have an additional option -- you can register application event listeners in the web.xml file that are notified of interesting events (such as session creation and deletion, or changes to session attributes). The /examples webapp has some listener elements to show you how they are registered. Look in the API Javadocs for the following APIs: javax.servlet.ServletContextListener javax.servlet.ServletContextAttributeListener javax.servlet.http.HttpSessionListener javax.servlet.http.HttpSessionActivationListener javax.servlet.http.HttpSessionAttributeListener for the interfaces you must implement. The functionality is defined in the Servlet 2.3 specification, which you can download at: http://java.sun.com/products/servlet/download.html Oliver Craig -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]