summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-03-19 09:49:32 +0000
committerVaadin Code Review <review@vaadin.com>2015-03-25 11:37:42 +0000
commit140844eaff3de1b926460081405eb7d53ec811f8 (patch)
tree22df06e4607937bbbb8b299beb05d6f4acb8de16
parent1c569304b3f10960854c2045030d907408978d05 (diff)
downloadvaadin-framework-140844eaff3de1b926460081405eb7d53ec811f8.tar.gz
vaadin-framework-140844eaff3de1b926460081405eb7d53ec811f8.zip
Revert "Make push path configurable (#14432)."
Breaks long polling fallback when implemented this way This reverts commit 735f0748344d7ee594c4e52a715d867dfdb23cb1. Conflicts: push/build.xml push/ivy.xml server/src/com/vaadin/server/Constants.java uitest/src/com/vaadin/tests/push/PushPathTest.java Change-Id: I07f6fedafc648b0ee403865ccb322017d2a8d571
-rw-r--r--WebContent/WEB-INF/web.xml22
-rw-r--r--client/src/com/vaadin/client/communication/AtmospherePushConnection.java15
-rw-r--r--server/src/com/vaadin/server/Constants.java3
-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
-rw-r--r--shared/src/com/vaadin/shared/ApplicationConstants.java12
-rw-r--r--shared/src/com/vaadin/shared/ui/ui/UIState.java1
-rw-r--r--uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java9
-rw-r--r--uitest/src/com/vaadin/tests/push/PushPath.java77
-rw-r--r--uitest/src/com/vaadin/tests/push/PushPathTest.java39
15 files changed, 24 insertions, 248 deletions
diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml
index c1102f4682..ef60364202 100644
--- a/WebContent/WEB-INF/web.xml
+++ b/WebContent/WEB-INF/web.xml
@@ -87,9 +87,9 @@
</servlet>
<servlet>
- <!-- This servlet is a separate instance for the sole purpose of testing
- #12446 (com.vaadin.tests.components.ui.TimeoutRedirectResetsOnActivity) because
- it modifies the VaadinService timeout parameters -->
+ <!-- This servlet is a separate instance for the sole purpose of
+ testing #12446 (com.vaadin.tests.components.ui.TimeoutRedirectResetsOnActivity)
+ because it modifies the VaadinService timeout parameters -->
<servlet-name>VaadinApplicationRunnerWithTimeoutRedirect</servlet-name>
<servlet-class>com.vaadin.launcher.ApplicationRunnerServlet</servlet-class>
</servlet>
@@ -115,17 +115,6 @@
<async-supported>true</async-supported>
</servlet>
- <!-- For testing custom push path with, for example, Weblogic 12.1.2 -->
- <servlet>
- <servlet-name>VaadinApplicationRunnerWithPushPathTest</servlet-name>
- <servlet-class>com.vaadin.launcher.ApplicationRunnerServlet</servlet-class>
- <init-param>
- <param-name>pushPath</param-name>
- <param-value>ws</param-value>
- </init-param>
- <async-supported>true</async-supported>
- </servlet>
-
<servlet-mapping>
<servlet-name>Embed App 1</servlet-name>
<url-pattern>/embed1/*</url-pattern>
@@ -160,11 +149,6 @@
</servlet-mapping>
<servlet-mapping>
- <servlet-name>VaadinApplicationRunnerWithPushPathTest</servlet-name>
- <url-pattern>/run-pushpath/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
<servlet-name>IntegrationTest</servlet-name>
<url-pattern>/integration/*</url-pattern>
</servlet-mapping>
diff --git a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
index 787da9bc6f..e544c91d0f 100644
--- a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
+++ b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
@@ -43,7 +43,7 @@ import elemental.json.JsonObject;
/**
* The default {@link PushConnection} implementation that uses Atmosphere for
* handling the communication channel.
- *
+ *
* @author Vaadin Ltd
* @since 7.1
*/
@@ -135,8 +135,6 @@ public class AtmospherePushConnection implements PushConnection {
*/
private Command pendingDisconnectCommand;
- private String pushPath;
-
public AtmospherePushConnection() {
}
@@ -183,9 +181,6 @@ public class AtmospherePushConnection implements PushConnection {
pushConfiguration.parameters.get(param));
}
- pushPath = pushConfiguration.pushPath;
- assert pushPath != null;
-
runWhenAtmosphereLoaded(new Command() {
@Override
public void execute() {
@@ -202,7 +197,7 @@ public class AtmospherePushConnection implements PushConnection {
private void connect() {
String baseUrl = connection
.translateVaadinUri(ApplicationConstants.APP_PROTOCOL_PREFIX
- + pushPath + '/');
+ + ApplicationConstants.PUSH_PATH + '/');
String extraParams = UIConstants.UI_ID_PARAMETER + "="
+ connection.getConfiguration().getUIId();
@@ -277,9 +272,9 @@ public class AtmospherePushConnection implements PushConnection {
/**
* Called whenever a server push connection is established (or
* re-established).
- *
+ *
* @param response
- *
+ *
* @since 7.2
*/
protected void onConnect(AtmosphereResponse response) {
@@ -360,7 +355,7 @@ public class AtmospherePushConnection implements PushConnection {
/**
* Called if the push connection fails. Atmosphere will automatically retry
* the connection until successful.
- *
+ *
*/
protected void onError(AtmosphereResponse response) {
state = State.DISCONNECTED;
diff --git a/server/src/com/vaadin/server/Constants.java b/server/src/com/vaadin/server/Constants.java
index b7c2a1ff3e..f3cdd48d58 100644
--- a/server/src/com/vaadin/server/Constants.java
+++ b/server/src/com/vaadin/server/Constants.java
@@ -132,12 +132,11 @@ 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 5402979be8..b26e048431 100644
--- a/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java
+++ b/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java
@@ -61,13 +61,6 @@ 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;
@@ -292,18 +285,6 @@ 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 06556e28a7..968ec7c0c3 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 the name of the widgetset
+ * @return UI class name
*/
public String getWidgetset(String defaultValue);
@@ -214,14 +214,6 @@ 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 1f0c7f02b9..197d9fe416 100644
--- a/server/src/com/vaadin/server/ServletPortletHelper.java
+++ b/server/src/com/vaadin/server/ServletPortletHelper.java
@@ -124,8 +124,7 @@ public class ServletPortletHelper implements Serializable {
}
public static boolean isPushRequest(VaadinRequest request) {
- return hasPathPrefix(request, request.getService()
- .getDeploymentConfiguration().getPushPath() + '/');
+ return hasPathPrefix(request, ApplicationConstants.PUSH_PATH + '/');
}
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 02b4e64159..3a6dc1e55f 100644
--- a/server/src/com/vaadin/server/communication/UIInitHandler.java
+++ b/server/src/com/vaadin/server/communication/UIInitHandler.java
@@ -198,11 +198,10 @@ public abstract class UIInitHandler extends SynchronizedRequestHandler {
PushMode pushMode = provider.getPushMode(event);
if (pushMode == null) {
- pushMode = session.getConfiguration().getPushMode();
+ pushMode = session.getService().getDeploymentConfiguration()
+ .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 d5e89b4b14..90ad28542c 100644
--- a/server/src/com/vaadin/ui/PushConfiguration.java
+++ b/server/src/com/vaadin/ui/PushConfiguration.java
@@ -105,26 +105,6 @@ 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
@@ -278,32 +258,6 @@ 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
@@ -336,4 +290,5 @@ 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 ccdbfea150..0518bea650 100644
--- a/server/tests/src/com/vaadin/server/AbstractDeploymentConfigurationTest.java
+++ b/server/tests/src/com/vaadin/server/AbstractDeploymentConfigurationTest.java
@@ -158,9 +158,5 @@ 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 175dcb2b94..ddee23a9ec 100644
--- a/server/tests/src/com/vaadin/tests/util/MockDeploymentConfiguration.java
+++ b/server/tests/src/com/vaadin/tests/util/MockDeploymentConfiguration.java
@@ -22,7 +22,6 @@ 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() {
@@ -126,9 +125,4 @@ public class MockDeploymentConfiguration extends
return sendUrlsAsParameters;
}
- @Override
- public String getPushPath() {
- return pushPath;
- }
-
}
diff --git a/shared/src/com/vaadin/shared/ApplicationConstants.java b/shared/src/com/vaadin/shared/ApplicationConstants.java
index 990564a6b8..d7aaee6267 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";
@@ -74,7 +76,7 @@ public class ApplicationConstants implements Serializable {
/**
* The name of the javascript containing the bootstrap code. The file is
* located in the VAADIN directory.
- *
+ *
* @since 7.3
*/
public static final String VAADIN_BOOTSTRAP_JS = "vaadinBootstrap.js";
@@ -88,7 +90,7 @@ public class ApplicationConstants implements Serializable {
/**
* The name of the debug version of the javascript containing push support.
* The file is located in the VAADIN directory.
- *
+ *
* @since 7.1.6
*/
public static final String VAADIN_PUSH_DEBUG_JS = "vaadinPush.debug.js";
@@ -100,14 +102,14 @@ public class ApplicationConstants implements Serializable {
/**
* The name of the parameter used to transmit RPC invocations
- *
+ *
* @since 7.2
*/
public static final String RPC_INVOCATIONS = "rpc";
/**
* The name of the parameter used to transmit the CSRF token
- *
+ *
* @since 7.2
*/
public static final String CSRF_TOKEN = "csrfToken";
@@ -116,7 +118,7 @@ public class ApplicationConstants implements Serializable {
* The name of the parameter used to transmit the sync id. The value can be
* set to -1 e.g. when testing with pre-recorded requests to make the
* framework ignore the sync id.
- *
+ *
* @see com.vaadin.ui.ConnectorTracker#getCurrentSyncId()
* @since 7.2
*/
diff --git a/shared/src/com/vaadin/shared/ui/ui/UIState.java b/shared/src/com/vaadin/shared/ui/ui/UIState.java
index 04e182c5d4..2f51fef6ee 100644
--- a/shared/src/com/vaadin/shared/ui/ui/UIState.java
+++ b/shared/src/com/vaadin/shared/ui/ui/UIState.java
@@ -110,7 +110,6 @@ public class UIState extends TabIndexState {
public static final String FALLBACK_TRANSPORT_PARAM = "fallbackTransport";
public PushMode mode = PushMode.DISABLED;
- public String pushPath;
public Map<String, String> parameters = new HashMap<String, String>();
{
parameters
diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
index 5c2e58d3a2..e2b93ab7d2 100644
--- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
+++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
@@ -402,12 +402,9 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet {
try {
VaadinServletService service = (VaadinServletService) VaadinService
.getCurrent();
- if (service != null) {
- session = service
- .findVaadinSession(new VaadinServletRequest(
- currentRequest, service));
- }
-
+ session = service
+ .findVaadinSession(new VaadinServletRequest(
+ currentRequest, service));
} finally {
/*
* Clear some state set by findVaadinSession to
diff --git a/uitest/src/com/vaadin/tests/push/PushPath.java b/uitest/src/com/vaadin/tests/push/PushPath.java
deleted file mode 100644
index 20771bd84f..0000000000
--- a/uitest/src/com/vaadin/tests/push/PushPath.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2000-2014 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.tests.push;
-
-import com.vaadin.annotations.Push;
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.ui.Transport;
-import com.vaadin.tests.components.AbstractTestUI;
-import com.vaadin.ui.Label;
-
-@Push(transport = Transport.WEBSOCKET)
-public class PushPath extends AbstractTestUI {
-
- public static final String PUSH_PATH_LABEL_ID = "push-path-label-id";
- public static final String PUSH_PATH_LABEL_TEXT = "Label by push";
-
- @Override
- protected void setup(VaadinRequest request) {
- // use only websockets
- getPushConfiguration().setFallbackTransport(Transport.WEBSOCKET);
-
- String pushPath = request.getService().getDeploymentConfiguration()
- .getPushPath();
- String transport = getPushConfiguration().getTransport().name();
- Label pushPathLabel = new Label(String.format(
- "Waiting for push from path '%s' using %s in 3 seconds.",
- pushPath, transport));
- addComponent(pushPathLabel);
-
- new PushThread().start();
- }
-
- public class PushThread extends Thread {
-
- @Override
- public void run() {
- try {
- Thread.sleep(3000);
- } catch (InterruptedException e) {
- }
- access(new Runnable() {
-
- @Override
- public void run() {
- Label pushLabel = new Label(PUSH_PATH_LABEL_TEXT);
- pushLabel.setId(PUSH_PATH_LABEL_ID);
- addComponent(pushLabel);
- }
- });
-
- }
- }
-
- @Override
- public Integer getTicketNumber() {
- return 14432;
- }
-
- @Override
- public String getDescription() {
- return "Push path should be configurable since some servers can't serve both websockets and long polling from same URL.";
- }
-
-}
diff --git a/uitest/src/com/vaadin/tests/push/PushPathTest.java b/uitest/src/com/vaadin/tests/push/PushPathTest.java
deleted file mode 100644
index 0af9c8d3a7..0000000000
--- a/uitest/src/com/vaadin/tests/push/PushPathTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2000-2014 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.tests.push;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import com.vaadin.tests.tb3.WebsocketTest;
-
-public class PushPathTest extends WebsocketTest {
-
- private static final int TEN_SECONDS_IN_MS = 10 * 1000;
-
- @Test
- public void testCustomPushPath() throws InterruptedException {
- openTestURL();
- sleep(TEN_SECONDS_IN_MS);
- Assert.assertEquals(vaadinElementById(PushPath.PUSH_PATH_LABEL_ID)
- .getText(), PushPath.PUSH_PATH_LABEL_TEXT);
- }
-
- @Override
- protected String getDeploymentPath(Class<?> uiClass) {
- return "/run-pushpath/" + uiClass.getCanonicalName();
- }
-}