Server-client Push with Vaadin

DZone 's Guide to

Server-client Push with Vaadin

· Java Zone ·
Free Resource

I’m more and more committed to Vaadin since I see so many advantages to this solution. This time, I’ve investigated how to push server data to the client.

Vaadin is a general purpose framework that is wise enough not to force you to code in one way or another. Many features are available in the core distribution but many more are available in the add-ons directory. One such add-on let you add push feature to your simple application. This add-on is based on ICEPush technologies and is aptly named ICEPush add-on.

ICEPush is a brand of technology usable with both Java and JavaScript that uses long polling in order to achieve push and as such does not need port opening (save the one the standard HTTP stream uses, of course). The ICEPush Vaadin add-on integrates ICEPush into your Vaadin application in a very simple way, so that only so much steps are needed in order to develop a full-fledged application with push features.

Set-up ICEPush add-on

Once you’ve created your Vaadin project (and application), add the ICEPush libraries to your project. If you use Maven, just add the following snippet to your POM:



If not, just download the ZIP available in the directory. Beware that all JAR inside should be copied to your WEB-INF/lib. Even though 2 of them look alike, one is the ICEPush JAR, the other the integration layer on Vaadin.

Note: if you use the Vaadin plugin with your IDE, and it asks you to recompile your widgetset, just click yes and be done with it.

Use the right servlet

Replace the default servlet configured in your web.xml (probably com.vaadin.terminal.gwt.server.ApplicationServlet) with org.vaadin.artur.icepush.ICEPushServlet.

Add the ICEPush object to your window

In order to use push technology, you’ll have to add a new ICEPush object to the window in use, like so:

public class PushApplication extends Application {

private ICEPush push = new ICEPush();

public void init() {

Window mainWindow = new Window("Push Application Example");


Now, each time you nee to update the window, just call push.push() and it’s done!

This method call will update the client’s window with the update you made. Vaadin will do true AJAX in that it won’t reload the page, just update the view with the changes.

As usual, you’ll find the source of this article here, in Eclipse format.

To go further:

From http://blog.frankel.ch/server-client-push-with-vaadin


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}