From 55841c374c2e10e92428037fcdd713acc1908c03 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Tue, 2 Oct 2012 12:34:28 +0300 Subject: [PATCH] Remove default bootstrap parameter support (#9824) Also remove the code that used to set the pathInfo parameter which is never used. Change-Id: I0ec7cc8453766bccf9527bfcf5e78411364da5f0 --- WebContent/VAADIN/vaadinBootstrap.js | 12 ------ .../com/vaadin/server/BootstrapHandler.java | 40 +++++++------------ .../server/PortletCommunicationManager.java | 15 ------- 3 files changed, 14 insertions(+), 53 deletions(-) diff --git a/WebContent/VAADIN/vaadinBootstrap.js b/WebContent/VAADIN/vaadinBootstrap.js index c6a7b7ed5d..fc1de31bc8 100644 --- a/WebContent/VAADIN/vaadinBootstrap.js +++ b/WebContent/VAADIN/vaadinBootstrap.js @@ -1,5 +1,4 @@ (function() { - var defaults; var apps = {}; var themesLoaded = {}; var widgetsets = {}; @@ -60,14 +59,6 @@ }; window.vaadin = window.vaadin || { - setDefaults: function(d) { - if (defaults) { - log("Ignoring new defaults as defaults have already been loaded"); - return; - } - log("Got defaults", d); - defaults = d; - }, initApplication: function(appId, config) { if (apps[appId]) { throw "Application " + appId + " already initialized"; @@ -83,9 +74,6 @@ var getConfig = function(name) { var value = config[name]; - if (value === undefined) { - value = defaults[name]; - } return value; }; diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java index 0886507caf..e10351b4ad 100644 --- a/server/src/com/vaadin/server/BootstrapHandler.java +++ b/server/src/com/vaadin/server/BootstrapHandler.java @@ -379,16 +379,11 @@ public abstract class BootstrapHandler implements RequestHandler { protected void appendMainScriptTagContents(BootstrapContext context, StringBuilder builder) throws JSONException, IOException { - JSONObject defaults = getDefaultParameters(context); JSONObject appConfig = getApplicationParameters(context); boolean isDebug = !context.getSession().getConfiguration() .isProductionMode(); - builder.append("vaadin.setDefaults("); - appendJsonObject(builder, defaults, isDebug); - builder.append(");\n"); - builder.append("vaadin.initApplication(\""); builder.append(context.getAppId()); builder.append("\","); @@ -407,6 +402,10 @@ public abstract class BootstrapHandler implements RequestHandler { protected JSONObject getApplicationParameters(BootstrapContext context) throws JSONException, PaintException { + VaadinRequest request = context.getRequest(); + VaadinServiceSession session = context.getSession(); + VaadinService vaadinService = request.getService(); + JSONObject appConfig = new JSONObject(); String themeName = context.getThemeName(); @@ -420,10 +419,10 @@ public abstract class BootstrapHandler implements RequestHandler { appConfig.put("widgetset", context.getWidgetsetName()); - appConfig.put("initialPath", context.getRequest().getRequestPathInfo()); + appConfig.put("initialPath", request.getRequestPathInfo()); Map parameterMap = new HashMap( - context.getRequest().getParameterMap()); + request.getParameterMap()); // Include theme as a fake initial param so that UI can know its theme // for serving CustomLayout templates @@ -431,17 +430,6 @@ public abstract class BootstrapHandler implements RequestHandler { appConfig.put("initialParams", parameterMap); - return appConfig; - } - - protected JSONObject getDefaultParameters(BootstrapContext context) - throws JSONException { - JSONObject defaults = new JSONObject(); - - VaadinRequest request = context.getRequest(); - VaadinServiceSession session = context.getSession(); - VaadinService vaadinService = request.getService(); - // Get system messages SystemMessages systemMessages = vaadinService.getSystemMessages(); if (systemMessages != null) { @@ -453,7 +441,7 @@ public abstract class BootstrapHandler implements RequestHandler { systemMessages.getCommunicationErrorMessage()); comErrMsg.put("url", systemMessages.getCommunicationErrorURL()); - defaults.put("comErrMsg", comErrMsg); + appConfig.put("comErrMsg", comErrMsg); JSONObject authErrMsg = new JSONObject(); authErrMsg.put("caption", @@ -462,29 +450,29 @@ public abstract class BootstrapHandler implements RequestHandler { systemMessages.getAuthenticationErrorMessage()); authErrMsg.put("url", systemMessages.getAuthenticationErrorURL()); - defaults.put("authErrMsg", authErrMsg); + appConfig.put("authErrMsg", authErrMsg); } String staticFileLocation = vaadinService .getStaticFileLocation(request); String widgetsetBase = staticFileLocation + "/" + VaadinServlet.WIDGETSET_DIRECTORY_PATH; - defaults.put("widgetsetBase", widgetsetBase); + appConfig.put("widgetsetBase", widgetsetBase); if (!session.getConfiguration().isProductionMode()) { - defaults.put("debug", true); + appConfig.put("debug", true); } if (vaadinService.isStandalone(request)) { - defaults.put("standalone", true); + appConfig.put("standalone", true); } - defaults.put("heartbeatInterval", vaadinService + appConfig.put("heartbeatInterval", vaadinService .getDeploymentConfiguration().getHeartbeatInterval()); - defaults.put("appUri", getAppUri(context)); + appConfig.put("appUri", getAppUri(context)); - return defaults; + return appConfig; } protected abstract String getAppUri(BootstrapContext context); diff --git a/server/src/com/vaadin/server/PortletCommunicationManager.java b/server/src/com/vaadin/server/PortletCommunicationManager.java index c77c195197..8d39eee9ac 100644 --- a/server/src/com/vaadin/server/PortletCommunicationManager.java +++ b/server/src/com/vaadin/server/PortletCommunicationManager.java @@ -88,21 +88,6 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { return renderResponse; } - @Override - protected JSONObject getDefaultParameters(BootstrapContext context) - throws JSONException { - /* - * We need this in order to get uploads to work. TODO this is - * not needed for uploads anymore, check if this is needed for - * some other things - */ - JSONObject defaults = super.getDefaultParameters(context); - - defaults.put("pathInfo", ""); - - return defaults; - } - @Override protected void appendMainScriptTagContents( BootstrapContext context, StringBuilder builder) -- 2.39.5