aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-09-04 14:59:15 +0300
committerArtur Signell <artur@vaadin.com>2015-09-04 14:59:15 +0300
commite603ea3cf91e5dd0893b766f27d400947527fba9 (patch)
tree4d126bc0dd181411c10f229a9b5edaca18daeed2
parentf03e488f206c92f321e7e79bfb9c86c56077b341 (diff)
downloadvaadin-framework-e603ea3cf91e5dd0893b766f27d400947527fba9.tar.gz
vaadin-framework-e603ea3cf91e5dd0893b766f27d400947527fba9.zip
Pass AtmosphereResponse to event handler to be able to report real error causes (#11733)
Change-Id: I1117872a4d4b5cbc9a533d0644a40f457be477ca
-rw-r--r--client/src/com/vaadin/client/communication/AtmospherePushConnection.java10
-rw-r--r--client/src/com/vaadin/client/communication/ConnectionStateHandler.java15
-rw-r--r--client/src/com/vaadin/client/communication/DefaultConnectionStateHandler.java14
3 files changed, 27 insertions, 12 deletions
diff --git a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
index def2f65e2a..8276bf68bb 100644
--- a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
+++ b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
@@ -386,17 +386,17 @@ public class AtmospherePushConnection implements PushConnection {
*/
protected void onError(AtmosphereResponse response) {
state = State.DISCONNECTED;
- getConnectionStateHandler().pushError(this);
+ getConnectionStateHandler().pushError(this, response);
}
protected void onClose(AtmosphereResponse response) {
state = State.CONNECT_PENDING;
- getConnectionStateHandler().pushClosed(this);
+ getConnectionStateHandler().pushClosed(this, response);
}
protected void onClientTimeout(AtmosphereResponse response) {
state = State.DISCONNECTED;
- getConnectionStateHandler().pushClientTimeout(this);
+ getConnectionStateHandler().pushClientTimeout(this, response);
}
protected void onReconnect(JavaScriptObject request,
@@ -575,8 +575,8 @@ public class AtmospherePushConnection implements PushConnection {
@Override
public void onError(ResourceLoadEvent event) {
- getConnectionStateHandler()
- .pushScriptLoadError(event.getResourceUrl());
+ getConnectionStateHandler().pushScriptLoadError(
+ event.getResourceUrl());
}
});
}
diff --git a/client/src/com/vaadin/client/communication/ConnectionStateHandler.java b/client/src/com/vaadin/client/communication/ConnectionStateHandler.java
index 4bbca9055a..cc33dd0086 100644
--- a/client/src/com/vaadin/client/communication/ConnectionStateHandler.java
+++ b/client/src/com/vaadin/client/communication/ConnectionStateHandler.java
@@ -15,6 +15,7 @@
*/
package com.vaadin.client.communication;
+import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.Response;
import com.vaadin.client.ApplicationConnection;
@@ -76,8 +77,11 @@ public interface ConnectionStateHandler {
*
* @param pushConnection
* The push connection which was closed
+ * @param response
+ * An object containing response data
*/
- void pushClosed(PushConnection pushConnection);
+ void pushClosed(PushConnection pushConnection,
+ JavaScriptObject responseObject);
/**
* Called when a client side timeout occurs before a push connection to the
@@ -88,8 +92,11 @@ public interface ConnectionStateHandler {
*
* @param pushConnection
* The push connection which timed out
+ * @param response
+ * An object containing response data
*/
- void pushClientTimeout(PushConnection pushConnection);
+ void pushClientTimeout(PushConnection pushConnection,
+ JavaScriptObject response);
/**
* Called when a fatal error fatal error occurs in the push connection.
@@ -102,8 +109,10 @@ public interface ConnectionStateHandler {
*
* @param pushConnection
* The push connection where the error occurred
+ * @param response
+ * An object containing response data
*/
- void pushError(PushConnection pushConnection);
+ void pushError(PushConnection pushConnection, JavaScriptObject response);
/**
* Called when the push connection has lost the connection to the server and
diff --git a/client/src/com/vaadin/client/communication/DefaultConnectionStateHandler.java b/client/src/com/vaadin/client/communication/DefaultConnectionStateHandler.java
index e5c9e317d0..9d4ea6e112 100644
--- a/client/src/com/vaadin/client/communication/DefaultConnectionStateHandler.java
+++ b/client/src/com/vaadin/client/communication/DefaultConnectionStateHandler.java
@@ -17,6 +17,7 @@ package com.vaadin.client.communication;
import java.util.logging.Logger;
+import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.Response;
@@ -27,6 +28,7 @@ import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.ApplicationConnection.ApplicationStoppedEvent;
import com.vaadin.client.ApplicationConnection.ApplicationStoppedHandler;
import com.vaadin.client.WidgetUtil;
+import com.vaadin.client.communication.AtmospherePushConnection.AtmosphereResponse;
import com.vaadin.shared.ui.ui.UIState.ReconnectDialogConfigurationState;
import elemental.json.JsonObject;
@@ -562,14 +564,17 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {
}
@Override
- public void pushError(PushConnection pushConnection) {
+ public void pushError(PushConnection pushConnection,
+ JavaScriptObject response) {
debug("pushError()");
connection.handleCommunicationError("Push connection using "
- + pushConnection.getTransportType() + " failed!", -1);
+ + ((AtmosphereResponse) response).getTransport() + " failed!",
+ -1);
}
@Override
- public void pushClientTimeout(PushConnection pushConnection) {
+ public void pushClientTimeout(PushConnection pushConnection,
+ JavaScriptObject response) {
debug("pushClientTimeout()");
// TODO Reconnect, allowing client timeout to be set
// https://dev.vaadin.com/ticket/18429
@@ -580,7 +585,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {
}
@Override
- public void pushClosed(PushConnection pushConnection) {
+ public void pushClosed(PushConnection pushConnection,
+ JavaScriptObject response) {
debug("pushClosed()");
getLogger().info("Push connection closed");
}