You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by landry soules <la...@gmail.com> on 2007/09/11 23:24:38 UTC

How to get a list of the connected users ?

Hello,

I have to display a list of the connected users in a page of my app. I 
know it sounds definitely dumb, but i don't know how to achieve this...
Users login to my site (i extended AuthenticatedWebApplication), and 
then i update a "isConnected" flag in users table.
Thus i display the connected users in a list view, retrieved by the 
"isConnected" flag.
It implies of course that users will use a "logoff" button when they 
leave, which i don't believe they will do...
I'm aware it's not a Wicket related problem, but a more generally web 
apps problem, but what is the best solution to deal with this ?
Thanks for your answers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to get a list of the connected users ?

Posted by Eelco Hillenius <ee...@gmail.com>.
> If you don't want to tread on the lower-level servlet API, maybe you
> could do something with WebApplication.sessionDestroyed or
> ISessionStore.unbind. Although I'm not exactly sure when they are called
> (just browsing javadoc, that's all).

Yep. You can override onBind (if you extend either HttpSessionStore or
SecondLevelCacheSessionStore, which is recommended) and onUnbind to
register/ deregister sessions. Do note however that this doesn't work
in a cluster unless you do some extra work (though I think that with
e.g. Terracotta it should be easy to cluster the list you keep with
the sessions).

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to get a list of the connected users ?

Posted by landry soules <la...@gmail.com>.
Thanks a lot for your answers, guys.
I will try the 2 approches.
Cheers.

Landry

2007/9/12, Matthijs Wensveen <m....@func.nl>:
>
> landry soules wrote:
> > Hello,
> >
> > I have to display a list of the connected users in a page of my app. I
> > know it sounds definitely dumb, but i don't know how to achieve this...
> > Users login to my site (i extended AuthenticatedWebApplication), and
> > then i update a "isConnected" flag in users table.
> > Thus i display the connected users in a list view, retrieved by the
> > "isConnected" flag.
> > It implies of course that users will use a "logoff" button when they
> > leave, which i don't believe they will do...
> > I'm aware it's not a Wicket related problem, but a more generally web
> > apps problem, but what is the best solution to deal with this ?
> > Thanks for your answers.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> If you don't want to tread on the lower-level servlet API, maybe you
> could do something with WebApplication.sessionDestroyed or
> ISessionStore.unbind. Although I'm not exactly sure when they are called
> (just browsing javadoc, that's all).
>
> Matthijs
>
> --
> Matthijs Wensveen
> Func. Internet Integration
> W http://www.func.nl
> T +31 20 4230000
> F +31 20 4223500
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: How to get a list of the connected users ?

Posted by Matthijs Wensveen <m....@func.nl>.
landry soules wrote:
> Hello,
>
> I have to display a list of the connected users in a page of my app. I 
> know it sounds definitely dumb, but i don't know how to achieve this...
> Users login to my site (i extended AuthenticatedWebApplication), and 
> then i update a "isConnected" flag in users table.
> Thus i display the connected users in a list view, retrieved by the 
> "isConnected" flag.
> It implies of course that users will use a "logoff" button when they 
> leave, which i don't believe they will do...
> I'm aware it's not a Wicket related problem, but a more generally web 
> apps problem, but what is the best solution to deal with this ?
> Thanks for your answers.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
If you don't want to tread on the lower-level servlet API, maybe you 
could do something with WebApplication.sessionDestroyed or 
ISessionStore.unbind. Although I'm not exactly sure when they are called 
(just browsing javadoc, that's all).

Matthijs

-- 
Matthijs Wensveen
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to get a list of the connected users ?

Posted by Carlos Pita <ca...@gmail.com>.
Maybe you can write a session listener to intercept session
destruction (give a look at servlet api, in particular
HttpSessionListener). For sessions that do have an associated (logged
in) user you can set the isConnected flag to false then.

I wouldn't recommend keeping these flags in a persistent store anyway.
A session manager that keeps an in-memory transient set of logged in
users feels better to me. The users themselves need not to be kept all
the time in memory, of course, that would swallow up resources. This
way, if your application hangs up your currently logged in users state
will disappear together with your sessions.

Regards,
Carlos

On 9/11/07, landry soules <la...@gmail.com> wrote:
> Hello,
>
> I have to display a list of the connected users in a page of my app. I
> know it sounds definitely dumb, but i don't know how to achieve this...
> Users login to my site (i extended AuthenticatedWebApplication), and
> then i update a "isConnected" flag in users table.
> Thus i display the connected users in a list view, retrieved by the
> "isConnected" flag.
> It implies of course that users will use a "logoff" button when they
> leave, which i don't believe they will do...
> I'm aware it's not a Wicket related problem, but a more generally web
> apps problem, but what is the best solution to deal with this ?
> Thanks for your answers.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to get a list of the connected users ?

Posted by John Krasnay <jo...@krasnay.ca>.
On Tue, Sep 11, 2007 at 11:24:38PM +0200, landry soules wrote:
> Hello,
> 
> I have to display a list of the connected users in a page of my app. I 
> know it sounds definitely dumb, but i don't know how to achieve this...
> Users login to my site (i extended AuthenticatedWebApplication), and 
> then i update a "isConnected" flag in users table.
> Thus i display the connected users in a list view, retrieved by the 
> "isConnected" flag.
> It implies of course that users will use a "logoff" button when they 
> leave, which i don't believe they will do...

Implement an HttpSessionListener that clears the flag when the session
is destroyed, and register it in your web.xml. This will handle both the
case when they press the Logout button and when the session expires due
to inactivity.

http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpSessionListener.html

jk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org