summaryrefslogtreecommitdiffstats
path: root/shared/src/com/vaadin
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2013-02-27 14:33:04 +0200
committerVaadin Code Review <review@vaadin.com>2013-04-04 12:46:42 +0000
commit69def694d5d98f518ad08c039195fd2ac8781d2f (patch)
tree8ec221cf013607180bf08b65ea189d44cd9dda49 /shared/src/com/vaadin
parent008d51dba378c2feb57bd5d30550561567f3f91a (diff)
downloadvaadin-framework-69def694d5d98f518ad08c039195fd2ac8781d2f.tar.gz
vaadin-framework-69def694d5d98f518ad08c039195fd2ac8781d2f.zip
Server push (#111)
* Asynchronous bidirectional communication * Use Atmosphere as a backend * Use websockets if available, fallback to HTTP streaming * Push mode (disabled, manual, automatic) * Configurable via servlet parameter pushMode * Disabled: The default; regular AJAX communication * Manual: Need explicit UI.push() call * Automatic: push all UIs in session when lock released * UI.push() * Push pending state and RPC to client asynchronously * Must hold session lock when invoking Change-Id: Idb5978ac81f7ff1e66665df4e3f96e29e4c419d4
Diffstat (limited to 'shared/src/com/vaadin')
-rw-r--r--shared/src/com/vaadin/shared/ApplicationConstants.java2
-rw-r--r--shared/src/com/vaadin/shared/communication/PushMode.java55
2 files changed, 57 insertions, 0 deletions
diff --git a/shared/src/com/vaadin/shared/ApplicationConstants.java b/shared/src/com/vaadin/shared/ApplicationConstants.java
index 220679e69c..5f23a3dc38 100644
--- a/shared/src/com/vaadin/shared/ApplicationConstants.java
+++ b/shared/src/com/vaadin/shared/ApplicationConstants.java
@@ -28,6 +28,8 @@ public class ApplicationConstants implements Serializable {
public static final String HEARTBEAT_PATH = "HEARTBEAT";
+ public static final String PUSH_PATH = "PUSH";
+
public static final String PUBLISHED_FILE_PATH = APP_PATH + '/'
+ "PUBLISHED";
diff --git a/shared/src/com/vaadin/shared/communication/PushMode.java b/shared/src/com/vaadin/shared/communication/PushMode.java
new file mode 100644
index 0000000000..f7414a89ea
--- /dev/null
+++ b/shared/src/com/vaadin/shared/communication/PushMode.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.shared.communication;
+
+/**
+ * The mode of bidirectional ("push") communication that is in use.
+ *
+ * @see com.vaadin.server.DeploymentConfiguration#getPushMode()
+ *
+ * @author Vaadin Ltd
+ * @since 7.1
+ */
+public enum PushMode {
+ /**
+ * Push is disabled. Regular AJAX requests are used to communicate between
+ * the client and the server. Asynchronous messages from the server are not
+ * possible. {@link com.vaadin.ui.UI#push() ui.push()} throws
+ * IllegalStateException.
+ * <p>
+ * This is the default mode unless
+ * {@link com.vaadin.server.DeploymentConfiguration#getPushMode()
+ * configured} otherwise.
+ */
+ DISABLED,
+
+ /**
+ * Push is enabled. A bidirectional channel is established between the
+ * client and server and used to communicate state changes and RPC
+ * invocations. The client is not automatically updated if the server-side
+ * state is asynchronously changed; {@link com.vaadin.ui.UI#push()
+ * ui.push()} must be explicitly called.
+ */
+ MANUAL,
+
+ /**
+ * Push is enabled. Like {@link #MANUAL}, but asynchronous changes to the
+ * server-side state are automatically pushed to the client once the session
+ * lock is released.
+ */
+ AUTOMATIC;
+}