Package com.vaadin.client.ApplicationConnection

Examples of com.vaadin.client.ApplicationConnection.ConnectionStatusEvent


            @Override
            public void onResponseReceived(Request request, Response response) {
                int status = response.getStatusCode();

                // Notify network observers about response status
                connection.fireEvent(new ConnectionStatusEvent(status));

                if (status == Response.SC_OK) {
                    getLogger().fine("Heartbeat response OK");
                } else if (status == 0) {
                    getLogger().warning(
                            "Failed sending heartbeat, server is unreachable, retrying in "
                                    + interval + "secs.");
                } else if (status >= 500) {
                    getLogger().warning(
                            "Failed sending heartbeat, see server logs, retrying in "
                                    + interval + "secs.");
                } else if (status == Response.SC_GONE) {
                    connection.showSessionExpiredError(null);
                    // If session is expired break the loop
                    return;
                } else {
                    getLogger().warning(
                            "Failed sending heartbeat to server. Error code: "
                                    + status);
                }

                // Don't break the loop
                schedule();
            }

            @Override
            public void onError(Request request, Throwable exception) {
                getLogger().severe(
                        "Exception sending heartbeat: "
                                + exception.getMessage());
                // Notify network observers about response status
                connection.fireEvent(new ConnectionStatusEvent(0));
                // Don't break the loop
                schedule();
            }
        };
View Full Code Here

TOP

Related Classes of com.vaadin.client.ApplicationConnection.ConnectionStatusEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.