Re: Session listener
Hi... Can please let me know how to set my container to register the implementing class to creeive the events. Let me knoe how to do it in Weblogic7.0 java-web-server regards S.Karthikeyan -Original Message- From: Partha Ranjan Das [mailto:[EMAIL PROTECTED] Sent: Mon 3/10/2003 12:28 PM To: [EMAIL PROTECTED] Cc: Subject: Re: Session listener You can use the HttpSessionListener interface. In case the session is invalidated or canceled otherwise, the code to reinstate the db can be done inside the method sessionDestroyed(). Remember you need to set your conteiner to register the implementing class to receive the events. Regards, Partha -Original Message- From: Peter Dolukhanov [mailto:[EMAIL PROTECTED] Sent: Saturday, March 08, 2003 7:09 PM To: [EMAIL PROTECTED] Subject: Session listener Dear All, I'm fairly sure this has been mentioned previously, but I cannot find any discussion in the archives. The site I am developing has a standard shopping cart object implemented within a session object. Whenever a user adds an item to his shopping cart, it is temporarily removed from the main stock database to ensure that when the user checks out, that item will be available to them. However, for obvious reasons I need to keep a track on this session object, so either when the user closes his browser or the session times out, I need to reinstate the items back to the original database. Therefore, is there any available resource to keep a track on a session object, ideally a listener that will implement some given action at the end of a session object? Many thanks, Peter Dolukhanov === To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST. For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST. Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com * Disclaimer: The information in this e-mail and any attachments is confidential / privileged. It is intended solely for the addressee or addressees. If you are not the addressee indicated in this message, you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. Please advise immediately if you or your employer does not consent to Internet email for messages of this kind. * === To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST. For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST. Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com èº{.nÇ+·¦j)m¢X¬¶¾6¯jr°Ø[¡è}òRSLZ+v(²[h+-±êél¶èw+´ ÔÄDD[EMAIL PROTECTED](±mçèºwZ¶m§ÿãjö¬ºw(úk¡¶Ïm¶ÿj·!éo§µêØmXm¶ÿ~îÈ«.ÊÛiÿü0Â;){uê
Re: Session listener
You can use the HttpSessionListener interface. In case the session is invalidated or canceled otherwise, the code to reinstate the db can be done inside the method sessionDestroyed(). Remember you need to set your conteiner to register the implementing class to receive the events. Regards, Partha -Original Message- From: Peter Dolukhanov [mailto:[EMAIL PROTECTED] Sent: Saturday, March 08, 2003 7:09 PM To: [EMAIL PROTECTED] Subject: Session listener Dear All, I'm fairly sure this has been mentioned previously, but I cannot find any discussion in the archives. The site I am developing has a standard shopping cart object implemented within a session object. Whenever a user adds an item to his shopping cart, it is temporarily removed from the main stock database to ensure that when the user checks out, that item will be available to them. However, for obvious reasons I need to keep a track on this session object, so either when the user closes his browser or the session times out, I need to reinstate the items back to the original database. Therefore, is there any available resource to keep a track on a session object, ideally a listener that will implement some given action at the end of a session object? Many thanks, Peter Dolukhanov === To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST. For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST. Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com * Disclaimer: The information in this e-mail and any attachments is confidential / privileged. It is intended solely for the addressee or addressees. If you are not the addressee indicated in this message, you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. Please advise immediately if you or your employer does not consent to Internet email for messages of this kind. * === To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST. For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST. Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com
Re: Session listener
2 methods 1)put it into the Database but dont commit it until you log out (of the sesssion)2)dont put it into the DB until you are absolutely positively sure you want it in there(when you logout of the session)Makes Sense? Martin Gainty __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relating to the official business of Laconia Data Systems (LDS) is proprietary to the company. It is confidential, legally privileged and protected by law.LDS does not own and endorse any other content. From: Peter Dolukhanov <[EMAIL PROTECTED]> Reply-To: A mailing list about Java Server Pages specification and reference <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Session listener Date: Sat, 8 Mar 2003 13:38:31 - MIME-Version: 1.0 Received: from mc8-f29.law1.hotmail.com ([65.54.253.165]) by mc8-s14.law1.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Sat, 8 Mar 2003 06:09:46 -0800 Received: from swjscmail2.java.sun.com ([192.18.99.108]) by mc8-f29.law1.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Sat, 8 Mar 2003 06:09:44 -0800 Received: from swjscmail1 (swjscmail1.Sun.COM [192.18.99.107])by swjscmail2.java.sun.com (Postfix) with ESMTPid CF3BD21213; Sat, 8 Mar 2003 06:34:56 -0700 (MST) Received: from JAVA.SUN.COM by JAVA.SUN.COM (LISTSERV-TCP/IP release 1.8d) with spool id 6017975 for [EMAIL PROTECTED]; Sat, 8 Mar 2003 06:32:22 -0700 Received: from blueyonder.co.uk (pcow034o.blueyonder.co.uk [195.188.53.122]) by swjscmail1.java.sun.com (Postfix) with ESMTP id A016D4835 for <[EMAIL PROTECTED]>; Sat, 8 Mar 2003 06:32:21 -0700 (MST) Received: from scotproject ([80.194.221.128]) by blueyonder.co.uk with Microsoft SMTPSVC(5.5.1877.757.75); Sat, 8 Mar 2003 13:40:32 + X-Message-Info: dyVzE7im2MUs9FcS4EeG9Njhcv4GK1zv Delivered-To: [EMAIL PROTECTED] X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600. Message-ID: [EMAIL PROTECTED] Sender: A mailing list about Java Server Pages specification and reference <[EMAIL PROTECTED]> Return-Path: [EMAIL PROTECTED] X-OriginalArrivalTime: 08 Mar 2003 14:09:44.0874 (UTC) FILETIME=[5EC920A0:01C2E57C] Dear All, I'm fairly sure this has been mentioned previously, but I cannot find any discussion in the archives. The site I am developing has a standard shopping cart object implemented within a session object. Whenever a user adds an item to his shopping cart, it is temporarily removed from the main stock database to ensure that when the user checks out, that item will be available to them. However, for obvious reasons I need to keep a track on this session object, so either when the user closes his browser or the session times out, I need to reinstate the items back to the original database. Therefore, is there any available resource to keep a track on a session object, ideally a listener that will implement some given action at the end of a session object? Many thanks, Peter Dolukhanov === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com STOP MORE SPAM with the new MSN 8 and get 2 months FREE* === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com
Re: Session Listener
Sylvain Roche wrote: Hi, I'm working on an online mail application. Everything works fine, but I have an architectural problem with attachements. In order to read them form the web page showing the message, I have to record them on the application server (from the mail server). Then the user can download or read them. No problem. Then I add sessions, as I want multiple users to read their mails simultanously. Each session creates its own directory on the server, to save its attachements. How can I delete the directory when a session has expired. I suppose this has to do with HttpSessionBindingListener, but I cannot figure how to use this with a directory, ie not an object in memory. Another way could be to implement a detroy method in a bean, which erases the directory linked to it when destroyed. Am I on a totaly wrong way ? No, you're on the right track :-) You can create an instance of a class that implements the HttpSessionBindingListener interface and give it the directory name, e.g. a bean with a setDirName() method, and place this object in the session. When the session is terminated, either by an explicit call to invalidate() from the logic behind a logout page or due to a timeout, the HttpSessionBindingListener valueUnbound() method that you implemented in your bean is called by the container. In this method you can get use the directory name given to the bean and remove the directory using the standard Java File class methods. plug I describe more about how to use HttpSessionBindingListener objects in chapter 15 of my JavaServer Pages book (O'Reilly): http://TheJSPBook.com/ /plug Hans -- Hans Bergsten [EMAIL PROTECTED] Gefion Software http://www.gefionsoftware.com Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com === To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST. For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST. Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
Re: Session listener redirect
When the user successfully logs in u can put a value on sesion object. for e,g session.putValue("UserId",id of user) then on each page first check whether session.getValue("UserId") is null and if null redirect user to login page. Ron Quartel [EMAIL PROTECTED]@java.sun.com on 03/06/2001 05:09:17 PM Please respond to A mailing list about Java Server Pages specification and reference [EMAIL PROTECTED] Sent by: A mailing list about Java Server Pages specification and reference [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: Session listener redirect I have created the following session listener class which works but now I want to redirect the client to the start page of the application (index.jsp) if they are trying to enter the application from another page. Easy peasy lemon squeezey in asp using global.asa but at a loss with java. Any help greatly appreciated. Code shown below. Ron Quartel. import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class SessionListener implements HttpSessionListener{ public SessionListener() { } public void sessionCreated(HttpSessionEvent hse) { System.out.println("Session started"); //redirect to start page if not alread there i.e index.jsp. } public void sessionDestroyed(HttpSessionEvent hse) {} } === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
Re: Session listener redirect
Can you not use response.sendRedirect("index.jsp")?? If you can manage to get the handle for the HttpServletResponse object?? or else, you can include this code in JSP page to get the handle to it. I am not sure I got your problem correct. Regards, Sripada Ron Quartel wrote: I have created the following session listener class which works but now I want to redirect the client to the start page of the application (index.jsp) if they are trying to enter the application from another page. Easy peasy lemon squeezey in asp using global.asa but at a loss with java. Any help greatly appreciated. Code shown below. Ron Quartel. import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class SessionListener implements HttpSessionListener{ public SessionListener() { } public void sessionCreated(HttpSessionEvent hse) { System.out.println("Session started"); //redirect to start page if not alread there i.e index.jsp. } public void sessionDestroyed(HttpSessionEvent hse) {} } === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets