I’m evaluating the use of vaadin to build an integrated application, where the server part already exists as Java application and the client part should be written using vaadin.
One evaluating point is: How can I push an event from server to the web client?
I created already an event receiver inside vaadin application, but when an event occurs, how the vaadin client can be updated (sample: fill a text box).
Any hints will be appreciated!
Thanks a lot!
Peter
[font=Courier New]
public class WebApplication extends Application implements ValueChangeListener {
Window mainWindow;
class EventReceiver implements com.mycompany.Util.UserInterfaceEvent {
public void EventOccured( String name, String value )
{
textField.setValue(value);
textField.commit(); // <-- this will not update the user interface
}
}
public void init() {
com.mycompany.Util.EventNotifier(new EventReceiver());
Throw in Dontpush Ozonelayer add-on and then your client side (browser) has constantly open connection to the server. Server side updates will then just work.
One thing to note is that when you are modifying the UI from a non-users initiated thread, you should manually synchronize over the application instance. Otherwise you’ll face odd “concurrency” issues at some point.
Thank you Matti for the response. Sounds like that DONTPUSH fullfill my needs.
I downloaded http://code.google.com/p/dontpush/
but I can’t get the sample running.
I’m working with
jdk1.6.0_26
Eclipse Indigo SR2 1.4.2.20120213-0813
Tomcat 6.0.26
Do I need any more, like Maven?
Can you give me some more information, how to get the chat-example running.
Thank you for your help!
Peter
Using DontPush itself don’t need Maven, but the example project there is using maven (like most modern java projects do) to handle various dependencies and project setup. If you are using eclipse you should install m2e plugin.
Hi Matti,
sorry for asking again.
I deployed the chat-example on my Apache Tomcat/6.0.26.
I can start the application in different browsers 1 and 2.
The text messages will not occur automatically in other browser.
Only after typing a new message in browser 2, the message from browser 1 will be shown in browser 2.
What is missing in my installation?
Below my web.xml.
Thank you for your help!
Regards,
Peter