diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-04-12 10:44:41 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-04-12 09:53:08 +0000 |
commit | eed51a5d58d4318816f1c0f13cc19c9b4e91731c (patch) | |
tree | 38aad3f049418a282d1433e55a199698a9942002 | |
parent | f3ff72947293b455f6debf8eca711696b17e323b (diff) | |
download | vaadin-framework-eed51a5d58d4318816f1c0f13cc19c9b4e91731c.tar.gz vaadin-framework-eed51a5d58d4318816f1c0f13cc19c9b4e91731c.zip |
Ignore duplicate ?restartApplication during UI init (#11587)
Change-Id: I8d3519bbf0ec47ec66bf08faea15ca00eb45af66
-rw-r--r-- | WebContent/VAADIN/vaadinBootstrap.js | 5 | ||||
-rw-r--r-- | server/src/com/vaadin/server/BootstrapHandler.java | 13 | ||||
-rw-r--r-- | server/src/com/vaadin/server/VaadinService.java | 15 |
3 files changed, 29 insertions, 4 deletions
diff --git a/WebContent/VAADIN/vaadinBootstrap.js b/WebContent/VAADIN/vaadinBootstrap.js index 40f9ce470f..b2995dd0bd 100644 --- a/WebContent/VAADIN/vaadinBootstrap.js +++ b/WebContent/VAADIN/vaadinBootstrap.js @@ -120,6 +120,11 @@ url += '&theme=' + encodeURIComponent(theme); } + var extraParams = getConfig('extraParams') + if (extraParams !== undefined) { + url += extraParams; + } + url += '&' + vaadin.getBrowserDetailsParameters(appId); // Timestamp to avoid caching diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java index d4f1ad308a..822db77b7d 100644 --- a/server/src/com/vaadin/server/BootstrapHandler.java +++ b/server/src/com/vaadin/server/BootstrapHandler.java @@ -54,6 +54,13 @@ import com.vaadin.ui.UI; @Deprecated public abstract class BootstrapHandler extends SynchronizedRequestHandler { + /** + * Parameter that is added to the UI init request if the session has already + * been restarted when generating the bootstrap HTML and ?restartApplication + * should thus be ignored when handling the UI init request. + */ + public static final String IGNORE_RESTART_PARAM = "ignoreRestart"; + protected class BootstrapContext implements Serializable { private final VaadinResponse response; @@ -428,6 +435,12 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { appConfig.put("theme", themeName); } + // Ignore restartApplication that might be passed to UI init + if (request + .getParameter(VaadinService.URL_PARAMETER_RESTART_APPLICATION) != null) { + appConfig.put("extraParams", "&" + IGNORE_RESTART_PARAM + "=1"); + } + JSONObject versionInfo = new JSONObject(); versionInfo.put("vaadinVersion", Version.getFullVersion()); appConfig.put("versionInfo", versionInfo); diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java index ceabaaf729..86ccf00a78 100644 --- a/server/src/com/vaadin/server/VaadinService.java +++ b/server/src/com/vaadin/server/VaadinService.java @@ -590,10 +590,12 @@ public abstract class VaadinService implements Serializable, Callback { * not specifically requested to close or restart it. */ - final boolean restartApplication = (request - .getParameter(URL_PARAMETER_RESTART_APPLICATION) != null); - final boolean closeApplication = (request - .getParameter(URL_PARAMETER_CLOSE_APPLICATION) != null); + final boolean restartApplication = hasParameter(request, + URL_PARAMETER_RESTART_APPLICATION) + && !hasParameter(request, + BootstrapHandler.IGNORE_RESTART_PARAM); + final boolean closeApplication = hasParameter(request, + URL_PARAMETER_CLOSE_APPLICATION); if (restartApplication) { closeSession(session, request.getWrappedSession(false)); @@ -624,6 +626,11 @@ public abstract class VaadinService implements Serializable, Callback { } + private static boolean hasParameter(VaadinRequest request, + String parameterName) { + return request.getParameter(parameterName) != null; + } + /** * Creates and registers a new VaadinSession for this service. Assumes * proper locking has been taken care of by the caller. |