]> source.dussan.org Git - vaadin-framework.git/commitdiff
[merge from 6.7] fixes 8491, more parameters to showCommunicationError method
authorAutomerge <automerge@vaadin.com>
Tue, 6 Mar 2012 14:06:00 +0000 (14:06 +0000)
committerAutomerge <automerge@vaadin.com>
Tue, 6 Mar 2012 14:06:00 +0000 (14:06 +0000)
svn changeset:23193/svn branch:6.8

src/com/vaadin/terminal/gwt/client/ApplicationConnection.java

index 944d9b5974b5e2912b42ea7dcc7db79d70d6bb09..fa5f102f5eae2eab33356831cbd1651389aea5c0 100644 (file)
@@ -479,7 +479,7 @@ public class ApplicationConnection {
         if (!synchronous) {
             RequestCallback requestCallback = new RequestCallback() {
                 public void onError(Request request, Throwable exception) {
-                    showCommunicationError(exception.getMessage());
+                    showCommunicationError(exception.getMessage(), -1);
                     endRequest();
                     if (!applicationRunning) {
                         // start failed, let's try to start the next app
@@ -497,7 +497,9 @@ public class ApplicationConnection {
 
                     switch (statusCode) {
                     case 0:
-                        showCommunicationError("Invalid status code 0 (server down?)");
+                        showCommunicationError(
+                                "Invalid status code 0 (server down?)",
+                                statusCode);
                         endRequest();
                         return;
 
@@ -530,8 +532,9 @@ public class ApplicationConnection {
                     if ((statusCode / 100) == 4) {
                         // Handle all 4xx errors the same way as (they are
                         // all permanent errors)
-                        showCommunicationError("UIDL could not be read from server. Check servlets mappings. Error code: "
-                                + statusCode);
+                        showCommunicationError(
+                                "UIDL could not be read from server. Check servlets mappings. Error code: "
+                                        + statusCode, statusCode);
                         endRequest();
                         return;
                     }
@@ -565,7 +568,8 @@ public class ApplicationConnection {
                     } catch (final Exception e) {
                         endRequest();
                         showCommunicationError(e.getMessage()
-                                + " - Original JSON-text:" + jsonText);
+                                + " - Original JSON-text:" + jsonText,
+                                statusCode);
                         return;
                     }
 
@@ -656,7 +660,10 @@ public class ApplicationConnection {
      * 
      * @param details
      *            Optional details for debugging.
+     * 
+     * @deprecated Use the method with errorCode instead
      */
+    @Deprecated
     protected void showCommunicationError(String details) {
         VConsole.error("Communication error: " + details);
         showError(details, configuration.getCommunicationErrorCaption(),
@@ -664,6 +671,19 @@ public class ApplicationConnection {
                 configuration.getCommunicationErrorUrl());
     }
 
+    /**
+     * Shows the communication error notification.
+     * 
+     * @param details
+     *            Optional details for debugging.
+     * @param statusCode
+     *            The http error code during the problematic request or -1 if
+     *            error happened before response was received.
+     */
+    protected void showCommunicationError(String details, int statusCode) {
+        showAuthenticationError(details);
+    }
+
     /**
      * Shows the authentication error notification.
      *