tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MartinOShea <app...@dsl.pipex.com>
Subject Re: Programmatically detecting a login or logout using Apache Tomcat
Date Mon, 28 Jul 2008 08:18:37 GMT



Johnny Kewl wrote:
> 
> 
> ----- Original Message ----- 
> From: "MartinOShea" <appy74@dsl.pipex.com>
> To: <dev@tomcat.apache.org>
> 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


Mime
View raw message