Directory

← Back

ICEPush

Push support for Vaadin 6 and 7 using ICEPush

Author

Contributors

Rating

Note:

This add-on is unnecessary since Vaadin 7.2. The built in push mechanism is more performant and more reliable and should be used instead of this add-on.

A component that adds push support to Vaadin!

Add the component to your application and call push() in a background server thread to update the application.

Note that you must use org.vaadin.artur.icepush.ICEPushServlet instead of com.vaadin.terminal.gwt.server.ApplicationServlet.

Based on ICEPush 2.0.0 alpha 3. Make sure that you add icepush.jar and icepush-gwt.jar to your WEB-INF/lib.

To use in a portlet you can use the same servlet to provide push capabilities. You need to add a web.xml that contians the following (headers, footers omitted):

<servlet>
    <servlet-name>ICEPush for Portlets</servlet-name>
    <servlet-class>org.vaadin.artur.icepush.ICEPushServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>ICEPush for Portlets</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

Please note that the add-on uses Servlet API 2.5 so you need a servlet container that supports that version (e.g. Tomcat 6.0 or newer)

Sample code

public class ICEPushDemo extends Application {

    private ICEPush pusher = new ICEPush();

    @Override
    public void init() {
        Window mainWindow = new Window("Icepushaddon Application");
        setMainWindow(mainWindow);

        // Add the push component
        mainWindow.addComponent(pusher);

        // Add a button for starting background work
        getMainWindow().addComponent(
                new Button("Do stuff in the background", new ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {
                        getMainWindow()
                                .addComponent(
                                        new Label(
                                                "Waiting for background process to complete..."));
                        new BackgroundThread().start();
                    }
                }));

    }

    public class BackgroundThread extends Thread {

        @Override
        public void run() {
            // Simulate background work
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
            }

            // Update UI
            synchronized (ICEPushDemo.this) {
                getMainWindow().addComponent(new Label("All done"));
            }

            // Push the changes
            pusher.push();
        }

    }
}

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Fixes a bug where updates would not be rendered until user does something, e.g. move the mouse

Released
2015-12-20
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 7.0+
Vaadin 6.0+ in 0.2.1
Vaadin 6.3+ in 0.2.0
Browser
Internet Explorer
Internet Explorer
Internet Explorer
Firefox
Opera
Safari
Google Chrome
Internet Explorer
iOS Browser
Android Browser
Internet Explorer
Internet Explorer
Online