Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 55392 invoked from network); 28 Jul 2008 08:19:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Jul 2008 08:19:13 -0000 Received: (qmail 46045 invoked by uid 500); 28 Jul 2008 08:19:12 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 45293 invoked by uid 500); 28 Jul 2008 08:19:09 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 45282 invoked by uid 99); 28 Jul 2008 08:19:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Jul 2008 01:19:09 -0700 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Jul 2008 08:18:12 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1KNNwD-00066P-VA for dev@tomcat.apache.org; Mon, 28 Jul 2008 01:18:37 -0700 Message-ID: <18685968.post@talk.nabble.com> Date: Mon, 28 Jul 2008 01:18:37 -0700 (PDT) From: MartinOShea To: dev@tomcat.apache.org Subject: Re: Programmatically detecting a login or logout using Apache Tomcat In-Reply-To: <000801c8f07d$8dad6b30$0300000a@animal> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: appy74@dsl.pipex.com References: <18679788.post@talk.nabble.com> <000801c8f07d$8dad6b30$0300000a@animal> X-Virus-Checked: Checked by ClamAV on apache.org Johnny Kewl wrote: > > > ----- Original Message ----- > From: "MartinOShea" > To: > Sent: Sunday, July 27, 2008 9:40 PM > Subject: Programmatically detecting a login or logout using Apache Tomcat > > >> >> Hello >> >> I'm trying to find a way to detect a user logging into or logging out of >> an >> application I'm working on. I want to record these events so that I know >> the >> exact steps a user has taken through the application's JSPs and servlets. >> I >> want to do this without reference to the Apache Tomcat server logs as >> well. >> >> I have tried the following code in index.jsp (which is serving as each >> user's home page): >> >> <% if (request.getParameter("logoff") != null) { >> session.invalidate(); >> response.sendRedirect("/myDataSharer/jsp/user/index.jsp"); >> return; >> } %> >> >> And I have tried using variations like: >> >> <% if (request.getParameter("logon") == true) { >> >> But without success. >> >> does anyone know a way that the login and logout events can be recorded >> by >> an event in a program, a session object and so on? >> >> I'm using NetBeans 6.1 with Apache Tomcat 6.X. >> >> Thanks >> >> Martin O'Shea. > > Martin, you in the wrong mailing list... this ones for the guru's that > build > tomcat. > > You looking for this > > request.getRemoteUser(); > > Will give you the user name if user logged in and will become null when > user > closes the browser... > You also need to setup basic authentication in web.xml > > If you get stuck... ask more questions in the user group.. > > --------------------------------------------------------------------------- > HARBOR : http://www.kewlstuff.co.za/index.htm > The most powerful application server on earth. > The only real POJO Application Server. > See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm > --------------------------------------------------------------------------- > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org > For additional commands, e-mail: dev-help@tomcat.apache.org > > > Johnny Thanks for the reply and I have re-posted the message to the correct forum. However, I don't understand your reference to request.getRemoteUser(). I use this at various points in my application to determine the current user but how can it tell me the time that user logged in or logged out? Or do you mean some method of querying the session object used? Thanks Martin O'Shea. -- View this message in context: http://www.nabble.com/Programmatically-detecting-a-login-or-logout-using-Apache-Tomcat-tp18679788p18685968.html Sent from the Tomcat - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org