summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorTapio Aali <tapio@vaadin.com>2015-02-09 15:37:41 +0200
committerVaadin Code Review <review@vaadin.com>2015-02-18 14:44:27 +0000
commit735f0748344d7ee594c4e52a715d867dfdb23cb1 (patch)
treea1a940c03cb1595e30486ddaa5cb1f64d61e412f /server
parentd23382ad25b0a9f1ab1bf864f8fd3746e5b1c320 (diff)
downloadvaadin-framework-735f0748344d7ee594c4e52a715d867dfdb23cb1.tar.gz
vaadin-framework-735f0748344d7ee594c4e52a715d867dfdb23cb1.zip
Make push path configurable (#14432).
In order to use websockets with Weblogic 12.1.2 or later, push path 'ws' needs to be used instead of 'PUSH'. Change-Id: Ia90d11c20a375cef9cf4a53986a70d616a83db06
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/server/Constants.java5
-rw-r--r--server/src/com/vaadin/server/DefaultDeploymentConfiguration.java19
-rw-r--r--server/src/com/vaadin/server/DeploymentConfiguration.java10
-rw-r--r--server/src/com/vaadin/server/ServletPortletHelper.java3
-rw-r--r--server/src/com/vaadin/server/communication/UIInitHandler.java5
-rw-r--r--server/src/com/vaadin/ui/PushConfiguration.java47
-rw-r--r--server/tests/src/com/vaadin/server/AbstractDeploymentConfigurationTest.java4
-rw-r--r--server/tests/src/com/vaadin/tests/util/MockDeploymentConfiguration.java6
8 files changed, 92 insertions, 7 deletions
diff --git a/server/src/com/vaadin/server/Constants.java b/server/src/com/vaadin/server/Constants.java
index 8036490333..b20b8004a5 100644
--- a/server/src/com/vaadin/server/Constants.java
+++ b/server/src/com/vaadin/server/Constants.java
@@ -67,7 +67,7 @@ public interface Constants {
// Keep the version number in sync with push/build.xml and other locations
// listed in that file
- static final String REQUIRED_ATMOSPHERE_RUNTIME_VERSION = "2.2.4.vaadin2";
+ static final String REQUIRED_ATMOSPHERE_RUNTIME_VERSION = "2.2.4.vaadin3";
static final String INVALID_ATMOSPHERE_VERSION_WARNING = "\n"
+ "=================================================================\n"
@@ -132,11 +132,12 @@ public interface Constants {
static final String SERVLET_PARAMETER_RESOURCE_CACHE_TIME = "resourceCacheTime";
static final String SERVLET_PARAMETER_HEARTBEAT_INTERVAL = "heartbeatInterval";
static final String SERVLET_PARAMETER_CLOSE_IDLE_SESSIONS = "closeIdleSessions";
- static final String SERVLET_PARAMETER_PUSH_MODE = "pushMode";
static final String SERVLET_PARAMETER_UI_PROVIDER = "UIProvider";
static final String SERVLET_PARAMETER_LEGACY_PROPERTY_TOSTRING = "legacyPropertyToString";
static final String SERVLET_PARAMETER_SYNC_ID_CHECK = "syncIdCheck";
static final String SERVLET_PARAMETER_SENDURLSASPARAMETERS = "sendUrlsAsParameters";
+ static final String SERVLET_PARAMETER_PUSH_MODE = "pushMode";
+ static final String SERVLET_PARAMETER_PUSH_PATH = "pushPath";
// Configurable parameter names
static final String PARAMETER_VAADIN_RESOURCES = "Resources";
diff --git a/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java b/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java
index b26e048431..5402979be8 100644
--- a/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java
+++ b/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java
@@ -61,6 +61,13 @@ public class DefaultDeploymentConfiguration extends
public static final boolean DEFAULT_SEND_URLS_AS_PARAMETERS = true;
+ /**
+ * Default value for {@link #getPushPath()} = {@value} .
+ *
+ * @since 7.4.1
+ */
+ public static final String DEFAULT_PUSH_PATH = "PUSH";
+
private final Properties initParameters;
private boolean productionMode;
private boolean xsrfProtectionEnabled;
@@ -285,6 +292,18 @@ public class DefaultDeploymentConfiguration extends
}
/**
+ * {@inheritDoc}
+ * <p>
+ * The default path {@link DEFAULT_PUSH_PATH} can be changed by using init
+ * parameter {@link Constants.SERVLET_PARAMETER_PUSH_PATH}.
+ */
+ @Override
+ public String getPushPath() {
+ return getApplicationOrSystemProperty(
+ Constants.SERVLET_PARAMETER_PUSH_PATH, DEFAULT_PUSH_PATH);
+ }
+
+ /**
* Log a warning if Vaadin is not running in production mode.
*/
private void checkProductionMode() {
diff --git a/server/src/com/vaadin/server/DeploymentConfiguration.java b/server/src/com/vaadin/server/DeploymentConfiguration.java
index 968ec7c0c3..06556e28a7 100644
--- a/server/src/com/vaadin/server/DeploymentConfiguration.java
+++ b/server/src/com/vaadin/server/DeploymentConfiguration.java
@@ -195,7 +195,7 @@ public interface DeploymentConfiguration extends Serializable {
*
* @since 7.4
*
- * @return UI class name
+ * @return the name of the widgetset
*/
public String getWidgetset(String defaultValue);
@@ -214,6 +214,14 @@ public interface DeploymentConfiguration extends Serializable {
public String getClassLoaderName();
/**
+ * Returns the push path configuration option value. Should never be null.
+ *
+ * @since 7.4.1
+ * @return the path used with server push
+ */
+ public String getPushPath();
+
+ /**
* Returns to legacy Property.toString() mode used. See
* {@link AbstractProperty#isLegacyToStringEnabled()} for more information.
*
diff --git a/server/src/com/vaadin/server/ServletPortletHelper.java b/server/src/com/vaadin/server/ServletPortletHelper.java
index 197d9fe416..1f0c7f02b9 100644
--- a/server/src/com/vaadin/server/ServletPortletHelper.java
+++ b/server/src/com/vaadin/server/ServletPortletHelper.java
@@ -124,7 +124,8 @@ public class ServletPortletHelper implements Serializable {
}
public static boolean isPushRequest(VaadinRequest request) {
- return hasPathPrefix(request, ApplicationConstants.PUSH_PATH + '/');
+ return hasPathPrefix(request, request.getService()
+ .getDeploymentConfiguration().getPushPath() + '/');
}
public static void initDefaultUIProvider(VaadinSession session,
diff --git a/server/src/com/vaadin/server/communication/UIInitHandler.java b/server/src/com/vaadin/server/communication/UIInitHandler.java
index 3a6dc1e55f..02b4e64159 100644
--- a/server/src/com/vaadin/server/communication/UIInitHandler.java
+++ b/server/src/com/vaadin/server/communication/UIInitHandler.java
@@ -198,10 +198,11 @@ public abstract class UIInitHandler extends SynchronizedRequestHandler {
PushMode pushMode = provider.getPushMode(event);
if (pushMode == null) {
- pushMode = session.getService().getDeploymentConfiguration()
- .getPushMode();
+ pushMode = session.getConfiguration().getPushMode();
}
ui.getPushConfiguration().setPushMode(pushMode);
+ ui.getPushConfiguration().setPushPath(
+ session.getConfiguration().getPushPath());
Transport transport = provider.getPushTransport(event);
if (transport != null) {
diff --git a/server/src/com/vaadin/ui/PushConfiguration.java b/server/src/com/vaadin/ui/PushConfiguration.java
index 90ad28542c..d5e89b4b14 100644
--- a/server/src/com/vaadin/ui/PushConfiguration.java
+++ b/server/src/com/vaadin/ui/PushConfiguration.java
@@ -105,6 +105,26 @@ public interface PushConfiguration extends Serializable {
public void setFallbackTransport(Transport fallbackTransport);
/**
+ * Sets the path that is used with push.
+ *
+ * @since 7.4.1
+ * @param pushPath
+ * The path to be used with push
+ *
+ * @throws IllegalArgumentException
+ * if the argument is null or empty.
+ */
+ public void setPushPath(String pushPath);
+
+ /**
+ * Returns the path used with push.
+ *
+ * @since 7.4.1
+ * @return The path that is used with push
+ */
+ public String getPushPath();
+
+ /**
* Returns the given parameter, if set.
* <p>
* This method provides low level access to push parameters and is typically
@@ -258,6 +278,32 @@ class PushConfigurationImpl implements PushConfiguration {
/*
* (non-Javadoc)
*
+ * @see com.vaadin.ui.PushConfiguration#setPushPath(java.lang.String)
+ */
+ @Override
+ public void setPushPath(String pushPath) {
+ if (pushPath != null && !pushPath.isEmpty()) {
+ getState().pushPath = pushPath;
+ } else {
+ throw new IllegalArgumentException(
+ "Push path can't be empty or null");
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.PushConfiguration#getPushPath()
+ */
+ @Override
+ public String getPushPath() {
+ return getState(false).pushPath;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see com.vaadin.ui.PushConfiguration#getParameter(java.lang.String)
*/
@Override
@@ -290,5 +336,4 @@ class PushConfigurationImpl implements PushConfiguration {
return Collections.unmodifiableCollection(getState(false).parameters
.keySet());
}
-
}
diff --git a/server/tests/src/com/vaadin/server/AbstractDeploymentConfigurationTest.java b/server/tests/src/com/vaadin/server/AbstractDeploymentConfigurationTest.java
index 0518bea650..ccdbfea150 100644
--- a/server/tests/src/com/vaadin/server/AbstractDeploymentConfigurationTest.java
+++ b/server/tests/src/com/vaadin/server/AbstractDeploymentConfigurationTest.java
@@ -158,5 +158,9 @@ public class AbstractDeploymentConfigurationTest {
return DefaultDeploymentConfiguration.DEFAULT_SEND_URLS_AS_PARAMETERS;
}
+ @Override
+ public String getPushPath() {
+ return null;
+ }
}
}
diff --git a/server/tests/src/com/vaadin/tests/util/MockDeploymentConfiguration.java b/server/tests/src/com/vaadin/tests/util/MockDeploymentConfiguration.java
index ddee23a9ec..175dcb2b94 100644
--- a/server/tests/src/com/vaadin/tests/util/MockDeploymentConfiguration.java
+++ b/server/tests/src/com/vaadin/tests/util/MockDeploymentConfiguration.java
@@ -22,6 +22,7 @@ public class MockDeploymentConfiguration extends
private LegacyProperyToStringMode legacyPropertyToStringMode = LegacyProperyToStringMode.DISABLED;
private boolean syncIdCheckEnabled = true;
private boolean sendUrlsAsParameters = true;
+ private String pushPath = "PUSH";
@Override
public boolean isProductionMode() {
@@ -125,4 +126,9 @@ public class MockDeploymentConfiguration extends
return sendUrlsAsParameters;
}
+ @Override
+ public String getPushPath() {
+ return pushPath;
+ }
+
}