tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnny Kewl" <j...@kewlstuff.co.za>
Subject Re: Programmatically detecting a login or logout using Apache Tomcat
Date Mon, 28 Jul 2008 06:45:41 GMT

----- 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


Mime
View raw message