I guess you get your singleton using a static method. But how do you write your 
hivemodule.xml to do that ?

Mike Snare <[EMAIL PROTECTED]> wrote: I do a similar thing, and I have a 
standard, plain vanilla singleton
that is accessed via a service wrapper by pages/services (purely for
injection's sake) but is accessed via standard java by the listener.

-Mike

On 5/4/06, Haldane, Sam  wrote:
>
> How would one access tapestry from a listener like this?  For example, access 
> a tapestry application state object which holds the list of users.
>
> Sam
>
> -----Original Message-----
> From: Martijn Hinten [mailto:[EMAIL PROTECTED]
> Sent: Thu 5/4/2006 10:22 PM
> To: Tapestry users
> Subject: Re: List of logged users
>
> Implement a HttpSessionListener. This listener will be notified of all
> sessions that are destroyed (it's sessionDestroyed() method will be
> called). In that method you can check which user is logged off en remove
> that user from the (applicationscope, I guess) list.
>
> See code sample below.
>
> Good luck,
> Martijn
>
> An example of a session listener that just counts sessions:
>
> import javax.servlet.http.HttpSessionEvent;
> import javax.servlet.http.HttpSessionListener;
>
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
>
> public class SessionWatcher implements HttpSessionListener {
>
> private static final Log log = LogFactory.getLog(HttpSessionListener.class);
>
> private static int activeSessions = 0;
>
> /*
> * @see
> javax.servlet.http.HttpSessionListener#sessionCreated(javax.servlet.http.HttpSessionEvent)
> */
> public void sessionCreated(HttpSessionEvent event) {
> activeSessions++;
>
> log.debug("Session created with id:"+event.getSession().getId()
> +". No of active sessions:"+activeSessions);
> System.out.println("Session created with id:"+event.getSession().getId()
> +". No of active sessions:"+activeSessions);
>
>
> }
>
>
> /*
> * @see
> javax.servlet.http.HttpSessionListener#sessionDestroyed(javax.servlet.http.HttpSessionEvent)
> */
> public void sessionDestroyed(HttpSessionEvent event) {
> if(activeSessions > 0) {
> activeSessions--;
> }
> log.debug("Session destroyed with id:"+event.getSession().getId()
> +". No of active sessions:"+activeSessions);
> System.out.println("Session destroyed with id:"+event.getSession().getId()
> +". No of active sessions:"+activeSessions);
>
> }
>
>
> }
>
>
> Add something like this to your web.xml:
>
> 

> 

> com.zenz.mzz.view.listeners.SessionWatcher
> 
> 
>
>
>
>
> Oscar Picasso wrote:
>
> >Hi,
> >
> >I am looking for advises on how to implement a use case that is, think, 
> >quite common.
> >
> >In my application users can log in. They can also loggout either explicitly 
> >or because of session timeout.
> >
> >In one part of my application I want to display the total number of logged 
> >users and a list of each of these users.
> >
> >My main problem is how to remove an user from the list when he is logged out 
> >implicitly by a  session timeout.
> >
> >How would you solve this ?
> >
> >Thanks
> >
> >
> >---------------------------------
> >How low will we go? Check out Yahoo! Messenger's low  PC-to-Phone call rates.
> >
> >
>
> --
>
>
> *Cumquat Information Technology*
> De Dreef 19
> 3706 BR Zeist
> T +31 (0)30 - 6940490
> F +31 (0)10 - 6940499
> http://www.cumquat.nl 
>
> [EMAIL PROTECTED] 
> M +31 6 22 384 318
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



                
---------------------------------
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.

Reply via email to