aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/AbstractTestUI.java
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2014-01-22 17:48:19 +0200
committerArtur Signell <artur@vaadin.com>2014-01-31 09:21:44 +0000
commitefd8f211612fa55a2b35d1c72a9913f2011bfe7a (patch)
tree27851a8c6ebcd7c408054a9152f8fd870a771bc2 /uitest/src/com/vaadin/tests/components/AbstractTestUI.java
parent3c5644c4a3e0484b7e65a2852d9cedeeab167419 (diff)
downloadvaadin-framework-efd8f211612fa55a2b35d1c72a9913f2011bfe7a.tar.gz
vaadin-framework-efd8f211612fa55a2b35d1c72a9913f2011bfe7a.zip
Implement long polling support for push (#13011)
* The Transport enum has a new LONG_POLLING constant * AbstractTestUI supports the ?transport=long-polling GET parameter Change-Id: Ic2f5abfbd4aa3c875f5c83932ce5ee6f31c366ad
Diffstat (limited to 'uitest/src/com/vaadin/tests/components/AbstractTestUI.java')
-rw-r--r--uitest/src/com/vaadin/tests/components/AbstractTestUI.java30
1 files changed, 15 insertions, 15 deletions
diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestUI.java b/uitest/src/com/vaadin/tests/components/AbstractTestUI.java
index 8f92ff3118..cbca4bcf7f 100644
--- a/uitest/src/com/vaadin/tests/components/AbstractTestUI.java
+++ b/uitest/src/com/vaadin/tests/components/AbstractTestUI.java
@@ -113,27 +113,27 @@ public abstract class AbstractTestUI extends UI {
protected void setTransport(VaadinRequest request) {
String transport = request.getParameter("transport");
PushConfiguration config = getPushConfiguration();
- PushMode mode = config.getPushMode();
if ("xhr".equals(transport)) {
config.setPushMode(PushMode.DISABLED);
} else if ("websocket".equals(transport)) {
- if (!mode.isEnabled()) {
- config.setPushMode(PushMode.AUTOMATIC);
- }
- config.setTransport(Transport.WEBSOCKET);
- // Ensure no fallback is used
- getPushConfiguration().setParameter(
- PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");
+ enablePush(Transport.WEBSOCKET);
} else if ("streaming".equals(transport)) {
- if (!mode.isEnabled()) {
- config.setPushMode(PushMode.AUTOMATIC);
- }
- config.setTransport(Transport.STREAMING);
- // Ensure no fallback is used
- getPushConfiguration().setParameter(
- PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");
+ enablePush(Transport.STREAMING);
+ } else if ("long-polling".equals(transport)) {
+ enablePush(Transport.LONG_POLLING);
+ }
+ }
+
+ protected void enablePush(Transport transport) {
+ PushConfiguration config = getPushConfiguration();
+ if (!config.getPushMode().isEnabled()) {
+ config.setPushMode(PushMode.AUTOMATIC);
}
+ config.setTransport(transport);
+ // Ensure no fallback is used
+ getPushConfiguration().setParameter(
+ PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");
}
private VerticalLayout layout;