You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by esajjkh <pr...@gmail.com> on 2012/09/10 14:38:15 UTC

HazelCast and Atmosphere Integration with Wicket 6

Hi

I am using HazelCast(HazelcastBroadcaster) and Atmosphere in Wicket 6
application. When a new message is published the application throws a
*WicketRunTimeException* "There is no application attached with current
thread" in the follwing signature of MyHazelcastBroadcaster :

class MyHazelcastBroadcaster extends HazelcastBroadcaster{
......
 @Override
    public void incomingBroadcast() {
         ITopic topic = Hazelcast.getTopic(getID());
        topic.addMessageListener(new SSPMessageListner() {

            @Override
            public void onMessage(String e) {
              * EventBus.get().post(e);*    //post the event so the method
with @Subscribe annotation should be called.
           }
        });

}
    }

In my ApplicationClass i configured this broadcaster and Atmospher like
this:
.......
MyHazelcastBroadcaster bc = (MyHazelcastBroadcaster)
BroadcasterFactory.getDefault().get(MY_EVENT);
        bc.setUp();
eventBus= new EventBus(this,bc)   //my broadcaster is registered with
eventbus


Am I missing anything? Thank you!




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/HazelCast-and-Atmosphere-Integration-with-Wicket-6-tp4651891.html
Sent from the Users forum 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: HazelCast and Atmosphere Integration with Wicket 6

Posted by Emond Papegaaij <em...@topicus.nl>.
Then you probably didn't register the EventBus in your application's init 
method. Please take a look at the demo-application I've setup:
https://github.com/papegaaij/wicket-atmosphere-quickstart

It contains the minimal configuration needed for wicket-atmosphere.

Best regards,
Emond

On Wednesday 12 September 2012 04:40:41 esajjkh wrote:
> Thanks for your help and support. I am using now wicket-atmosphere 0.4
> snapshot and atmosphere 1.0.0 .
> 
> I managed the reference of applicationclass in MyHazelcastBroadcaster class.
> Both classes looks like this now:
> 
> class MyApplicationClass extends AuthenticatedWebApplication{
> 
>          .....
> @Override
>     protected void init() {
>         super.init();
>         bc = (MyHazelCastBroadcaster)
> BroadcasterFactory.getDefault().get(MY_EVENT);
>         bc.setUp();
>         *bc.setApplication(this);*   // setting the application in
> MyHazelCastBroadcaster
> 
>         eventBus = new EventBus(this, bc);
> 
>          ............
>                       }
> }
> 
> and in MyHazelBroadcaster class I am publishing the event like this:
> 
>          EventBus.get(myapplication).post(message)
> 
> Now it throws exception in EventBus class
> on*application.getMetaData(EVENT_BUS_KEY)*  call, as it doesn't find any
> metadata associated with this event bus :(
> Any help pease? Tack
> 
> 
> 
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/HazelCast-and-Atmosphere-Integra
> tion-with-Wicket-6-tp4651891p4651939.html Sent from the Users forum 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: HazelCast and Atmosphere Integration with Wicket 6

Posted by esajjkh <pr...@gmail.com>.
Thanks for your help and support. I am using now wicket-atmosphere 0.4
snapshot and atmosphere 1.0.0 . 

I managed the reference of applicationclass in MyHazelcastBroadcaster class.
Both classes looks like this now:

class MyApplicationClass extends AuthenticatedWebApplication{

         .....
@Override
    protected void init() {      
        super.init();
        bc = (MyHazelCastBroadcaster)
BroadcasterFactory.getDefault().get(MY_EVENT);
        bc.setUp();
        *bc.setApplication(this);*   // setting the application in
MyHazelCastBroadcaster

        eventBus = new EventBus(this, bc);

         ............
                      }
}

and in MyHazelBroadcaster class I am publishing the event like this:

         EventBus.get(myapplication).post(message)  

Now it throws exception in EventBus class
on*application.getMetaData(EVENT_BUS_KEY)*  call, as it doesn't find any
metadata associated with this event bus :( 
Any help pease? Tack



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/HazelCast-and-Atmosphere-Integration-with-Wicket-6-tp4651891p4651939.html
Sent from the Users forum 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: HazelCast and Atmosphere Integration with Wicket 6

Posted by Martin Grigorov <mg...@apache.org>.
Briefly, just add:

 <repositories>
                <repository>
                        <id>Apache Nexus</id>

<url>https://repository.apache.org/content/repositories/snapshots/</url>
                        <releases>
                                <enabled>false</enabled>
                        </releases>
                        <snapshots>
                                <enabled>true</enabled>
                        </snapshots>
                </repository>
        </repositories>

to your pom.xml

On Tue, Sep 11, 2012 at 3:02 PM, Emond Papegaaij
<em...@topicus.nl> wrote:
> You can find all information about Wicket's downloads, repositories and scm on
> http://wicket.apache.org/start/download.html
>
> Best regards,
> Emond
>
> On Tuesday 11 September 2012 04:37:36 esajjkh wrote:
>> Thanks Emond, Where I can find the wicket-atmosphere 0.4-snapshot maven
>> dependency?
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/HazelCast-and-Atmosphere-Integra
>> tion-with-Wicket-6-tp4651891p4651909.html Sent from the Users forum 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
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: HazelCast and Atmosphere Integration with Wicket 6

Posted by Emond Papegaaij <em...@topicus.nl>.
You can find all information about Wicket's downloads, repositories and scm on 
http://wicket.apache.org/start/download.html

Best regards,
Emond

On Tuesday 11 September 2012 04:37:36 esajjkh wrote:
> Thanks Emond, Where I can find the wicket-atmosphere 0.4-snapshot maven
> dependency?
> 
> 
> 
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/HazelCast-and-Atmosphere-Integra
> tion-with-Wicket-6-tp4651891p4651909.html Sent from the Users forum 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: HazelCast and Atmosphere Integration with Wicket 6

Posted by esajjkh <pr...@gmail.com>.
Thanks Emond, Where I can find the wicket-atmosphere 0.4-snapshot maven
dependency? 



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/HazelCast-and-Atmosphere-Integration-with-Wicket-6-tp4651891p4651909.html
Sent from the Users forum 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: HazelCast and Atmosphere Integration with Wicket 6

Posted by Emond Papegaaij <em...@topicus.nl>.
You will need the application. Without the application, it won't work. There 
are dozens of ways to pass the application to where you need it. For example, 
you could inject it using your favorite dependency injection framework, or you 
could pass it manually to the place where you need it.

Best regards,
Emond

On Tuesday 11 September 2012 00:56:59 esajjkh wrote:
> Hi,
> Thank you for your support. MyHazelCastBroadCaster is not a wicket component
> so when i tried to get the Application either from my application class  or
> from *Session.get().getApplcation()*  throws exception. Your help will be
> appreciated. Thank you!
> 
> 
> 
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/HazelCast-and-Atmosphere-Integra
> tion-with-Wicket-6-tp4651891p4651905.html Sent from the Users forum 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: getting AutoCompleteTextField to display values

Posted by Paul Bors <pa...@bors.ws>.
I would recommend using Select2 if you really want to show all the available
options and let the user filter through them.

See wicket-select2:
https://github.com/ivaynberg/wicket-select2

And also the live demos at:
http://ivaynberg.github.com/select2/

~ Thank you,
  Paul Bors

-----Original Message-----
From: Carter, Isaac [mailto:Isaac.Carter@ManTech.com] 
Sent: Friday, September 14, 2012 2:34 PM
To: users@wicket.apache.org
Subject: getting AutoCompleteTextField to display values

Hi,

I'm currently using an AutoCompleteTextField for a couple of textfields on
my form.  It works well, but would like for the user to be able to see all
the values that are contained within that field.  Is there a way to be able
to present the user the values by default or do I just set up a value that
when typed in presents all the values the user could choose from?

-Isaac

This e-mail and any attachments are intended only for the use of the
addressee(s) named herein and may contain proprietary information. If you
are not the intended recipient of this e-mail or believe that you received
this email in error, please take immediate action to notify the sender of
the apparent error by reply e-mail; permanently delete the e-mail and any
attachments from your computer; and do not disseminate, distribute, use, or
copy this message and any attachments.

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


getting AutoCompleteTextField to display values

Posted by "Carter, Isaac" <Is...@ManTech.com>.
Hi,

I'm currently using an AutoCompleteTextField for a couple of textfields on my form.  It works well, but would like for the user to be able to see all the values that are contained within that field.  Is there a way to be able to present the user the values by default or do I just set up a value that when typed in presents all the values the user could choose from?

-Isaac

This e-mail and any attachments are intended only for the use of the addressee(s) named herein and may contain proprietary information. If you are not the intended recipient of this e-mail or believe that you received this email in error, please take immediate action to notify the sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments from your computer; and do not disseminate, distribute, use, or copy this message and any attachments.

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


Re: HazelCast and Atmosphere Integration with Wicket 6

Posted by esajjkh <pr...@gmail.com>.
Hi,
Thank you for your support. MyHazelCastBroadCaster is not a wicket component
so when i tried to get the Application either from my application class  or
from *Session.get().getApplcation()*  throws exception. Your help will be
appreciated. Thank you!



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/HazelCast-and-Atmosphere-Integration-with-Wicket-6-tp4651891p4651905.html
Sent from the Users forum 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: HazelCast and Atmosphere Integration with Wicket 6

Posted by Emond Papegaaij <em...@gmail.com>.
Hi,

I just noticed a small error in my advice: the class is not called
ThreadLocal but ThreadContext. The idea is very simple:

try {
  ThreadContext.setApplication(application);
  /* do your thing */
} finally {
  ThreadContext.setApplication(null);
}

The problem with this code is that you might potentially overwrite the
application in ThreadContext, therefore it is better to use the new
method from wicket-atmosphere-0.4-SNAPSHOT: EventBus.get(application).
0.4 is better than 0.3 anyway, because it supports multiple tabs for
the same page, has better cleanup on disconnections and is based on
atmosphere-1.0.0, which fixes many issues.

Best regards,
Emond

On Mon, Sep 10, 2012 at 4:13 PM, esajjkh <pr...@gmail.com> wrote:
> Hello Emonds,
>
> Thank you for your help.  Will you please enlighten your idea of attaching
> application with ThreadLocal with a code snippet?
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/HazelCast-and-Atmosphere-Integration-with-Wicket-6-tp4651891p4651894.html
> Sent from the Users forum 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: HazelCast and Atmosphere Integration with Wicket 6

Posted by esajjkh <pr...@gmail.com>.
Hello Emonds,

Thank you for your help.  Will you please enlighten your idea of attaching
application with ThreadLocal with a code snippet? 



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/HazelCast-and-Atmosphere-Integration-with-Wicket-6-tp4651891p4651894.html
Sent from the Users forum 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: HazelCast and Atmosphere Integration with Wicket 6

Posted by Emond Papegaaij <em...@topicus.nl>.
Hi,

I don't know HazelCast, but the problem you are seeing is that EventBus.get() 
only works when the application is attached to the current thread. You either 
have to pass a reference to the EventBus to your broadcaster, or, if you have 
access to the Wicket Application, you can set it on ThreadLocal (make sure you 
unset it in a finally). wicket-atmosphere-0.4-SNAPSHOT has a  
EventBus.get(Application), where you can pass in to application to use.

Best regards,
Emonds

On Monday 10 September 2012 05:38:15 esajjkh wrote:
> Hi
> 
> I am using HazelCast(HazelcastBroadcaster) and Atmosphere in Wicket 6
> application. When a new message is published the application throws a
> *WicketRunTimeException* "There is no application attached with current
> thread" in the follwing signature of MyHazelcastBroadcaster :
> 
> class MyHazelcastBroadcaster extends HazelcastBroadcaster{
> ......
>  @Override
>     public void incomingBroadcast() {
>          ITopic topic = Hazelcast.getTopic(getID());
>         topic.addMessageListener(new SSPMessageListner() {
> 
>             @Override
>             public void onMessage(String e) {
>               * EventBus.get().post(e);*    //post the event so the method
> with @Subscribe annotation should be called.
>            }
>         });
> 
> }
>     }
> 
> In my ApplicationClass i configured this broadcaster and Atmospher like
> this:
> .......
> MyHazelcastBroadcaster bc = (MyHazelcastBroadcaster)
> BroadcasterFactory.getDefault().get(MY_EVENT);
>         bc.setUp();
> eventBus= new EventBus(this,bc)   //my broadcaster is registered with
> eventbus
> 
> 
> Am I missing anything? Thank you!
> 
> 
> 
> 
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/HazelCast-and-Atmosphere-Integra
> tion-with-Wicket-6-tp4651891.html Sent from the Users forum 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