You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Eunice <pe...@gmail.com> on 2009/01/13 03:41:11 UTC

Update number of login users in all user's page when new user login


Hi,

i wanted to have the number of login users to be shown on all user's screen.
This means, once a new user login, the number of login users shows on other
active
user's screen will be updated.


Let say there are 2 sessions is currently log in into my application.


session.getSessionId()  == [bm1pgdr1y9hf]
session.getSessionId()  == [198y9m0etdvpj]


When the first user  [bm1pgdr1y9hf] login, i want to update the page to show
'Logged on users:1'
in [bm1pgdr1y9hf] 's homepage.

When the second user   [198y9m0etdvpj] login, i want to update the page to
show 'Logged on users:2'
in both [bm1pgdr1y9hf]  and [198y9m0etdvpj] 's homepage.

How can I update [bm1pgdr1y9hf] 's homepage after the second user 
[198y9m0etdvpj]  login?



Thanks alot again for your replies

 

-- 
View this message in context: http://www.nabble.com/Update-number-of-login-users-in-all-user%27s-page-when-new-user-login-tp21428448p21428448.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Update number of login users in all user's page when new user login

Posted by Michael O'Cleirigh <mi...@rivulet.ca>.
Hello,

You need a static (singleton) counter somewhere that is incremented when 
a user is authenticated and decremented when the session is destroyed.

One way would be to have a static AtomicLong in your WebApplication 
subclass; or a spring bean; or via persistence for an authenticated 
users table.


Your home page label would have a model that does a:

new AbstractReadOnlyModel() {

    public Object getObject() {

        YourApplication ya = (YourApplication)getApplication();
       // the simple AtomicLong case
        return "Logged on users:" + ya.getLoggedInUsers();
    }
};


This would keep the label accurate (at the time of each users most 
recent page render).

Mike

>
> i wanted to have the number of login users to be shown on all user's screen.
> This means, once a new user login, the number of login users shows on other
> active
> user's screen will be updated.
>
>
> Let say there are 2 sessions is currently log in into my application.
>
>
> session.getSessionId()  == [bm1pgdr1y9hf]
> session.getSessionId()  == [198y9m0etdvpj]
>
>
> When the first user  [bm1pgdr1y9hf] login, i want to update the page to show
> 'Logged on users:1'
> in [bm1pgdr1y9hf] 's homepage.
>
> When the second user   [198y9m0etdvpj] login, i want to update the page to
> show 'Logged on users:2'
> in both [bm1pgdr1y9hf]  and [198y9m0etdvpj] 's homepage.
>
> How can I update [bm1pgdr1y9hf] 's homepage after the second user 
> [198y9m0etdvpj]  login?
>
>
>
> Thanks alot again for your replies
>
>  
>
>   


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


Re: Update number of login users in all user's page when new user login

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
How does this perform in a clustered environment?

The specification says: "A servlet container is not required to
propagate HttpSessionEvents to different JVMs"

**
Martin

2009/1/13 Eunice <pe...@gmail.com>:
>
> Ok..Thanks for your reply..
>
>
>
> igor.vaynberg wrote:
>>
>> see HttpSessionListener
>>
>> -igor
>>
>> On Mon, Jan 12, 2009 at 6:41 PM, Eunice <pe...@gmail.com> wrote:
>>>
>>>
>>> Hi,
>>>
>>> i wanted to have the number of login users to be shown on all user's
>>> screen.
>>> This means, once a new user login, the number of login users shows on
>>> other
>>> active
>>> user's screen will be updated.
>>>
>>>
>>> Let say there are 2 sessions is currently log in into my application.
>>>
>>>
>>> session.getSessionId()  == [bm1pgdr1y9hf]
>>> session.getSessionId()  == [198y9m0etdvpj]
>>>
>>>
>>> When the first user  [bm1pgdr1y9hf] login, i want to update the page to
>>> show
>>> 'Logged on users:1'
>>> in [bm1pgdr1y9hf] 's homepage.
>>>
>>> When the second user   [198y9m0etdvpj] login, i want to update the page
>>> to
>>> show 'Logged on users:2'
>>> in both [bm1pgdr1y9hf]  and [198y9m0etdvpj] 's homepage.
>>>
>>> How can I update [bm1pgdr1y9hf] 's homepage after the second user
>>> [198y9m0etdvpj]  login?
>>>
>>>
>>>
>>> Thanks alot again for your replies
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Update-number-of-login-users-in-all-user%27s-page-when-new-user-login-tp21428448p21428448.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Update-number-of-login-users-in-all-user%27s-page-when-new-user-login-tp21428448p21429864.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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: Update number of login users in all user's page when new user login

Posted by Eunice <pe...@gmail.com>.
Ok..Thanks for your reply..



igor.vaynberg wrote:
> 
> see HttpSessionListener
> 
> -igor
> 
> On Mon, Jan 12, 2009 at 6:41 PM, Eunice <pe...@gmail.com> wrote:
>>
>>
>> Hi,
>>
>> i wanted to have the number of login users to be shown on all user's
>> screen.
>> This means, once a new user login, the number of login users shows on
>> other
>> active
>> user's screen will be updated.
>>
>>
>> Let say there are 2 sessions is currently log in into my application.
>>
>>
>> session.getSessionId()  == [bm1pgdr1y9hf]
>> session.getSessionId()  == [198y9m0etdvpj]
>>
>>
>> When the first user  [bm1pgdr1y9hf] login, i want to update the page to
>> show
>> 'Logged on users:1'
>> in [bm1pgdr1y9hf] 's homepage.
>>
>> When the second user   [198y9m0etdvpj] login, i want to update the page
>> to
>> show 'Logged on users:2'
>> in both [bm1pgdr1y9hf]  and [198y9m0etdvpj] 's homepage.
>>
>> How can I update [bm1pgdr1y9hf] 's homepage after the second user
>> [198y9m0etdvpj]  login?
>>
>>
>>
>> Thanks alot again for your replies
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Update-number-of-login-users-in-all-user%27s-page-when-new-user-login-tp21428448p21428448.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Update-number-of-login-users-in-all-user%27s-page-when-new-user-login-tp21428448p21429864.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Update number of login users in all user's page when new user login

Posted by Igor Vaynberg <ig...@gmail.com>.
see HttpSessionListener

-igor

On Mon, Jan 12, 2009 at 6:41 PM, Eunice <pe...@gmail.com> wrote:
>
>
> Hi,
>
> i wanted to have the number of login users to be shown on all user's screen.
> This means, once a new user login, the number of login users shows on other
> active
> user's screen will be updated.
>
>
> Let say there are 2 sessions is currently log in into my application.
>
>
> session.getSessionId()  == [bm1pgdr1y9hf]
> session.getSessionId()  == [198y9m0etdvpj]
>
>
> When the first user  [bm1pgdr1y9hf] login, i want to update the page to show
> 'Logged on users:1'
> in [bm1pgdr1y9hf] 's homepage.
>
> When the second user   [198y9m0etdvpj] login, i want to update the page to
> show 'Logged on users:2'
> in both [bm1pgdr1y9hf]  and [198y9m0etdvpj] 's homepage.
>
> How can I update [bm1pgdr1y9hf] 's homepage after the second user
> [198y9m0etdvpj]  login?
>
>
>
> Thanks alot again for your replies
>
>
>
> --
> View this message in context: http://www.nabble.com/Update-number-of-login-users-in-all-user%27s-page-when-new-user-login-tp21428448p21428448.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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