You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Jann Forrer <ja...@id.unizh.ch> on 2005/05/06 13:33:26 UTC

Re: showing logged-in users

On Sat, 30 Apr 2005, Michael Wechner wrote:

> Michael Wechner wrote:
>
> > Hi
> >
> > It seems to me that we could implement the feature of
> >
> > "showing logged-in users" with
> >
> > http://www.javaworld.com/javaworld/jw-01-2001/jw-0126-servletapi-p2.html
> >
> > (was recently posted by Reinhard Poetz on the Cocoon mailing list)
>
>
> we could add to the web.xml something like
>
> <listener>
>   <listener-class>org.apache.lenya.cms.servlet.UserLogger</listener-class>
> </listener>
>
> and implement
>
> public class UserLogger implements HttpSessionListener {
> ...
>

I did try to do this starting with a simple example i.e. a listener which
only counts the active sessions. This works quite well now but i noted
that a logut did not invalidate the session (meaning that if a user did
log out i still had the same number of sessions).
The reason is that session.invalidate(); is not called in logout.xsp. If
i add it to login.xsp:

<xsp:content><uri><xsp-request:get-context-path/><xsp:expr>uri</xsp:expr></uri></xsp:content>
         }
       }
+      session.invalidate();
     }
   </xsp:logic>
 </logout>

i got the proper number of sessions. Is this a bug or is
session.invalidate not called on purpose?

Jann

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: showing logged-in users

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Michael Wechner wrote:

> I think it was just forgotton. If nobody disagrees I would suggest that we
> add the invalidation.

+1

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: showing logged-in users

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Jann Forrer wrote:

> As you and Andreas suggested i will try to use a usecase for this in 1.4.
> I am not quite sure how-to it in 1.2.

you can reuse the code:

1.4 it will be displayed by a usecase that instantiates the necessary 
java backend class, in 1.2 that is the job of a generator.

> I did fax the CLA and a CCLA some time ago but I did not have
> received any reply yet.

ok, i will take a look at this.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: showing logged-in users

Posted by Jann Forrer <ja...@id.unizh.ch>.
On Thu, 12 May 2005, Gregor J. Rothfuss wrote:

> Jann Forrer wrote:
>
> > - Write a cocoon generator in order to generate xml including all
> >   logged in users. Or are there other possiblities to make the info
> >   available to the sitemap?
>
> i would avoid a generator for this, and instead seperate it into a java
> component that emits a collection of users, and a flow/jx page that
> displays it. that way, you can easily reuse this information in the
> sitemap and also in java.
>

As you and Andreas suggested i will try to use a usecase for this in 1.4.
I am not quite sure how-to it in 1.2.


> > - Show only the users which are logged in into the respective publication.
> >
> > WDYT?
> >
> > [ ...]
> >
> >
> >>very cool. Has your CLA been accepted? Time to get started checking
> >>stuff ;-)
> >
> > not yet ...
>
> i dropped the ball on this.. did you fax it in yet? if it has been
> recorded with the ASF, then it should be a simple matter of getting your
> account.
>

I did fax the CLA and a CCLA some time ago but I did not have
received any reply yet.

Jann

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: showing logged-in users

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Jann Forrer wrote:

> - Write a cocoon generator in order to generate xml including all
>   logged in users. Or are there other possiblities to make the info
>   available to the sitemap?

i would avoid a generator for this, and instead seperate it into a java 
component that emits a collection of users, and a flow/jx page that 
displays it. that way, you can easily reuse this information in the 
sitemap and also in java.

> - Show only the users which are logged in into the respective publication.
> 
> WDYT?
> 
> [ ...]
> 
> 
>>very cool. Has your CLA been accepted? Time to get started checking
>>stuff ;-)
> 
> not yet ...

i dropped the ball on this.. did you fax it in yet? if it has been 
recorded with the ASF, then it should be a simple matter of getting your 
account.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: showing logged-in users

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Andreas Hartmann wrote:

> This way you get a framework for the GUI handling and it fits nicely
> into the overall architecture. A generator would just add complexity,
> I'd rather pass the user info directly from the session-analyzation
> component to the JX template.

exactly my thoughts

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: showing logged-in users

Posted by Andreas Hartmann <an...@apache.org>.
Jann Forrer wrote:
> On Sun, 8 May 2005, Michael Wechner wrote:
> 
> 
>>Jann Forrer wrote:
>>
>>
>>>I did try to do this starting with a simple example i.e. a listener which
>>>only counts the active sessions. This works quite well now but i noted
>>>that a logut did not invalidate the session (meaning that if a user did
>>>log out i still had the same number of sessions).
>>>The reason is that session.invalidate(); is not called in logout.xsp. If
>>>i add it to login.xsp:
>>>
> 
> 
> I carry on with that functionality and wrote a class which implements
> HttpSessionAttributeListener where the identity of a user is stored in a
> HashMap in the attributeAdded method or is removed from the HashMap in the
> attributeRemoved method respectivelly.
> 
> Just to check it i wrote an cocoon action which display the logged in
> user. This works quite well.
> 
> The next step would be:
> 
> - Write a cocoon generator in order to generate xml including all
>   logged in users. Or are there other possiblities to make the info
>   available to the sitemap?

I'd rather implement the logic in a separate component.

In 1.2, the data generated by this component could indeed be presented
using a generator.

In 1.4, I'd recommend to implement a usecase:

http://lenya.apache.org/1_4/reference/usecase-framework/index.html

This way you get a framework for the GUI handling and it fits nicely
into the overall architecture. A generator would just add complexity,
I'd rather pass the user info directly from the session-analyzation
component to the JX template.

-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: showing logged-in users

Posted by Jann Forrer <ja...@id.unizh.ch>.
On Sun, 8 May 2005, Michael Wechner wrote:

> Jann Forrer wrote:
>
> >I did try to do this starting with a simple example i.e. a listener which
> >only counts the active sessions. This works quite well now but i noted
> >that a logut did not invalidate the session (meaning that if a user did
> >log out i still had the same number of sessions).
> >The reason is that session.invalidate(); is not called in logout.xsp. If
> >i add it to login.xsp:
> >

I carry on with that functionality and wrote a class which implements
HttpSessionAttributeListener where the identity of a user is stored in a
HashMap in the attributeAdded method or is removed from the HashMap in the
attributeRemoved method respectivelly.

Just to check it i wrote an cocoon action which display the logged in
user. This works quite well.

The next step would be:

- Write a cocoon generator in order to generate xml including all
  logged in users. Or are there other possiblities to make the info
  available to the sitemap?

- Show only the users which are logged in into the respective publication.

WDYT?

[ ...]

>
> very cool. Has your CLA been accepted? Time to get started checking
> stuff ;-)
>

not yet ...

Jann


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: showing logged-in users

Posted by Michael Wechner <mi...@wyona.com>.
Jann Forrer wrote:

>I did try to do this starting with a simple example i.e. a listener which
>only counts the active sessions. This works quite well now but i noted
>that a logut did not invalidate the session (meaning that if a user did
>log out i still had the same number of sessions).
>The reason is that session.invalidate(); is not called in logout.xsp. If
>i add it to login.xsp:
>
><xsp:content><uri><xsp-request:get-context-path/><xsp:expr>uri</xsp:expr></uri></xsp:content>
>         }
>       }
>+      session.invalidate();
>     }
>   </xsp:logic>
> </logout>
>
>i got the proper number of sessions.
>

very cool. Has your CLA been accepted? Time to get started checking 
stuff ;-)

> Is this a bug or is
>session.invalidate not called on purpose?
>  
>

I think it was just forgotton. If nobody disagrees I would suggest that we
add the invalidation.

Michi

>Jann
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
>For additional commands, e-mail: dev-help@lenya.apache.org
>
>
>  
>


-- 
Michael Wechner
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: showing logged-in users

Posted by Michael Wechner <mi...@wyona.com>.
J. Wolfgang Kaltz wrote:

> Jann Forrer schrieb:
>
>> (...)
>> I did try to do this starting with a simple example i.e. a listener 
>> which
>> only counts the active sessions. This works quite well now but i noted
>> that a logut did not invalidate the session (meaning that if a user did
>> log out i still had the same number of sessions).
>> The reason is that session.invalidate(); is not called in logout.xsp. If
>> i add it to login.xsp:
>>
>> <xsp:content><uri><xsp-request:get-context-path/><xsp:expr>uri</xsp:expr></uri></xsp:content> 
>>
>>          }
>>        }
>> +      session.invalidate();
>>      }
>>    </xsp:logic>
>>  </logout>
>>
>> i got the proper number of sessions. Is this a bug or is
>> session.invalidate not called on purpose?
>
>
> IMO it makes sense to explicitly call session.invalidate() on logout.


me too. I think Andreas implemented this, maybe he can say if this was just
forgotten of if there is another reason for this.

Otherwise I would suggest that we implement this.

>
> Note that in any case the session will be invalidated upon session 
> timeout, so your listener would still be notified even if logout did 
> not  call invalidate. It's just that the notification happens later.


right, but this might take some time (depending on the configuration ;-)

Michi

>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
>
>


-- 
Michael Wechner
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: showing logged-in users

Posted by "J. Wolfgang Kaltz" <jw...@apache.org>.
Jann Forrer schrieb:
> (...)
> I did try to do this starting with a simple example i.e. a listener which
> only counts the active sessions. This works quite well now but i noted
> that a logut did not invalidate the session (meaning that if a user did
> log out i still had the same number of sessions).
> The reason is that session.invalidate(); is not called in logout.xsp. If
> i add it to login.xsp:
> 
> <xsp:content><uri><xsp-request:get-context-path/><xsp:expr>uri</xsp:expr></uri></xsp:content>
>          }
>        }
> +      session.invalidate();
>      }
>    </xsp:logic>
>  </logout>
> 
> i got the proper number of sessions. Is this a bug or is
> session.invalidate not called on purpose?

IMO it makes sense to explicitly call session.invalidate() on logout.

Note that in any case the session will be invalidated upon session 
timeout, so your listener would still be notified even if logout did not 
  call invalidate. It's just that the notification happens later.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org