Browse Source

Ignore duplicate ?restartApplication during UI init (#11587)

Change-Id: I8d3519bbf0ec47ec66bf08faea15ca00eb45af66
tags/7.1.0.beta1
Leif Åstrand 11 years ago
parent
commit
eed51a5d58

+ 5
- 0
WebContent/VAADIN/vaadinBootstrap.js View File

@@ -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

+ 13
- 0
server/src/com/vaadin/server/BootstrapHandler.java View File

@@ -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);

+ 11
- 4
server/src/com/vaadin/server/VaadinService.java View File

@@ -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.

Loading…
Cancel
Save