diff options
author | John Ahlroos <john@vaadin.com> | 2013-04-17 11:46:19 +0300 |
---|---|---|
committer | John Ahlroos <john@vaadin.com> | 2013-04-17 14:46:21 +0300 |
commit | 0f75f202d333ac507fb3e5efb8e9bd4d4719e098 (patch) | |
tree | bd19061fbde6c5cf665b0bd4fcefd1c78567800d /client | |
parent | 1c4adacdc2c59a4dd33633806902cb6224141954 (diff) | |
download | vaadin-framework-0f75f202d333ac507fb3e5efb8e9bd4d4719e098.tar.gz vaadin-framework-0f75f202d333ac507fb3e5efb8e9bd4d4719e098.zip |
Added test for testing push with different transports #11494
Change-Id: I0296bdee1925ba93ca7e4e65c68215e025d072f6
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/communication/PushConnection.java | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/client/src/com/vaadin/client/communication/PushConnection.java b/client/src/com/vaadin/client/communication/PushConnection.java index 0731d513ea..e3d2e576e6 100644 --- a/client/src/com/vaadin/client/communication/PushConnection.java +++ b/client/src/com/vaadin/client/communication/PushConnection.java @@ -42,7 +42,7 @@ public class PushConnection { private boolean connected = false; - private AtmosphereConfiguration config = createConfig(); + private AtmosphereConfiguration config; public PushConnection() { } @@ -72,7 +72,10 @@ public class PushConnection { } } - protected JavaScriptObject getConfig() { + protected AtmosphereConfiguration getConfig() { + if (config == null) { + config = createConfig(); + } return config; } @@ -102,8 +105,8 @@ public class PushConnection { */ protected void onTransportFailure() { VConsole.log("Push connection using primary method (" - + config.getTransport() + ") failed. Trying with " - + config.getFallbackTransport()); + + getConfig().getTransport() + ") failed. Trying with " + + getConfig().getFallbackTransport()); } /** @@ -112,7 +115,8 @@ public class PushConnection { * */ protected void onError() { - VConsole.error("Push connection using " + config.getTransport() + VConsole.error("Push connection using " + + getConfig().getTransport() + " failed!"); } @@ -126,11 +130,21 @@ public class PushConnection { return this[key]; }-*/; + protected final native void setStringValue(String key, String value) + /*-{ + this[key] = value; + }-*/; + protected final native int getIntValue(String key) /*-{ return this[key]; }-*/; + protected final native void setIntValue(String key, int value) + /*-{ + this[key] = value; + }-*/; + } public static class AtmosphereConfiguration extends AbstractJSO { @@ -146,6 +160,14 @@ public class PushConnection { public final String getFallbackTransport() { return getStringValue("fallbackTransport"); } + + public final void setTransport(String transport) { + setStringValue("transport", transport); + } + + public final void setFallbackTransport(String fallbackTransport) { + setStringValue("fallbackTransport", fallbackTransport); + } } public static class AtmosphereResponse extends AbstractJSO { @@ -172,7 +194,7 @@ public class PushConnection { } - private static native AtmosphereConfiguration createConfig() + protected native AtmosphereConfiguration createConfig() /*-{ return { transport: 'websocket', |