From c1e1b2022990e8d00d3510fb14953b1a4a510af7 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Thu, 6 Sep 2012 13:29:44 +0300 Subject: Remove some 'Application' from the Bootstrap API (#9402) --- .../vaadin/server/BootstrapFragmentResponse.java | 8 ++++---- server/src/com/vaadin/server/BootstrapHandler.java | 24 ++++++++++------------ .../com/vaadin/server/BootstrapPageResponse.java | 8 ++++---- .../src/com/vaadin/server/BootstrapResponse.java | 19 ++++++++--------- .../com/vaadin/server/CommunicationManager.java | 4 ++-- 5 files changed, 30 insertions(+), 33 deletions(-) diff --git a/server/src/com/vaadin/server/BootstrapFragmentResponse.java b/server/src/com/vaadin/server/BootstrapFragmentResponse.java index 4b960263e7..ea13a04b8f 100644 --- a/server/src/com/vaadin/server/BootstrapFragmentResponse.java +++ b/server/src/com/vaadin/server/BootstrapFragmentResponse.java @@ -44,8 +44,8 @@ public class BootstrapFragmentResponse extends BootstrapResponse { * @param request * the wrapped request for which the bootstrap page should be * generated - * @param application - * the application for which the bootstrap page should be + * @param session + * the vaadin session for which the bootstrap page should be * generated * @param uiClass * the class of the UI that will be displayed on the page @@ -54,9 +54,9 @@ public class BootstrapFragmentResponse extends BootstrapResponse { * application HTML */ public BootstrapFragmentResponse(BootstrapHandler handler, - WrappedRequest request, VaadinSession application, + WrappedRequest request, VaadinSession session, Class uiClass, List fragmentNodes) { - super(handler, request, application, uiClass); + super(handler, request, session, uiClass); this.fragmentNodes = fragmentNodes; } diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java index ffd036d66d..29792d710a 100644 --- a/server/src/com/vaadin/server/BootstrapHandler.java +++ b/server/src/com/vaadin/server/BootstrapHandler.java @@ -67,8 +67,8 @@ public abstract class BootstrapHandler implements RequestHandler { return bootstrapResponse.getRequest(); } - public VaadinSession getApplication() { - return bootstrapResponse.getApplication(); + public VaadinSession getVaadinSession() { + return bootstrapResponse.getVaadinSession(); } public Class getUIClass() { @@ -140,7 +140,7 @@ public abstract class BootstrapHandler implements RequestHandler { Map headers = new LinkedHashMap(); Document document = Document.createShell(""); BootstrapPageResponse pageResponse = new BootstrapPageResponse( - this, request, context.getApplication(), + this, request, context.getVaadinSession(), context.getUIClass(), document, headers); List fragmentNodes = fragmentResponse.getFragmentNodes(); Element body = document.body(); @@ -149,7 +149,7 @@ public abstract class BootstrapHandler implements RequestHandler { } setupStandaloneDocument(context, pageResponse); - context.getApplication().modifyBootstrapResponse(pageResponse); + context.getVaadinSession().modifyBootstrapResponse(pageResponse); sendBootstrapHeaders(response, headers); @@ -216,7 +216,7 @@ public abstract class BootstrapHandler implements RequestHandler { head.appendElement("meta").attr("http-equiv", "X-UA-Compatible") .attr("content", "chrome=1"); - String title = context.getApplication() + String title = context.getVaadinSession() .getUiProvider(context.getRequest(), context.getUIClass()) .getPageTitleForUI(context.getRequest(), context.getUIClass()); if (title != null) { @@ -269,7 +269,7 @@ public abstract class BootstrapHandler implements RequestHandler { public String getWidgetsetForUI(BootstrapContext context) { WrappedRequest request = context.getRequest(); - String widgetset = context.getApplication() + String widgetset = context.getVaadinSession() .getUiProvider(context.getRequest(), context.getUIClass()) .getWidgetsetForUI(context.getRequest(), context.getUIClass()); if (widgetset == null) { @@ -307,7 +307,7 @@ public abstract class BootstrapHandler implements RequestHandler { */ String appClass = "v-app-" - + context.getApplication().getClass().getSimpleName(); + + context.getVaadinSession().getClass().getSimpleName(); String classNames = "v-app " + appClass; List fragmentNodes = context.getBootstrapResponse() @@ -365,7 +365,7 @@ public abstract class BootstrapHandler implements RequestHandler { JSONObject defaults = getDefaultParameters(context); JSONObject appConfig = getApplicationParameters(context); - boolean isDebug = !context.getApplication().getConfiguration() + boolean isDebug = !context.getVaadinSession().getConfiguration() .isProductionMode(); builder.append("vaadin.setDefaults("); @@ -390,8 +390,6 @@ public abstract class BootstrapHandler implements RequestHandler { protected JSONObject getApplicationParameters(BootstrapContext context) throws JSONException, PaintException { - VaadinSession application = context.getApplication(); - JSONObject appConfig = new JSONObject(); if (context.getThemeName() != null) { @@ -419,7 +417,7 @@ public abstract class BootstrapHandler implements RequestHandler { JSONObject defaults = new JSONObject(); WrappedRequest request = context.getRequest(); - VaadinSession application = context.getApplication(); + VaadinSession session = context.getVaadinSession(); VaadinService vaadinService = request.getVaadinService(); // Get system messages @@ -451,7 +449,7 @@ public abstract class BootstrapHandler implements RequestHandler { + VaadinServlet.WIDGETSET_DIRECTORY_PATH; defaults.put("widgetsetBase", widgetsetBase); - if (!application.getConfiguration().isProductionMode()) { + if (!session.getConfiguration().isProductionMode()) { defaults.put("debug", true); } @@ -495,7 +493,7 @@ public abstract class BootstrapHandler implements RequestHandler { * @return */ public String getThemeName(BootstrapContext context) { - return context.getApplication() + return context.getVaadinSession() .getUiProvider(context.getRequest(), context.getUIClass()) .getThemeForUI(context.getRequest(), context.getUIClass()); } diff --git a/server/src/com/vaadin/server/BootstrapPageResponse.java b/server/src/com/vaadin/server/BootstrapPageResponse.java index 8f56042f8f..0b98c59e22 100644 --- a/server/src/com/vaadin/server/BootstrapPageResponse.java +++ b/server/src/com/vaadin/server/BootstrapPageResponse.java @@ -46,8 +46,8 @@ public class BootstrapPageResponse extends BootstrapResponse { * @param request * the wrapped request for which the bootstrap page should be * generated - * @param application - * the application for which the bootstrap page should be + * @param session + * the vaadin session for which the bootstrap page should be * generated * @param uiClass * the class of the UI that will be displayed on the page @@ -57,10 +57,10 @@ public class BootstrapPageResponse extends BootstrapResponse { * a map into which header data can be added */ public BootstrapPageResponse(BootstrapHandler handler, - WrappedRequest request, VaadinSession application, + WrappedRequest request, VaadinSession session, Class uiClass, Document document, Map headers) { - super(handler, request, application, uiClass); + super(handler, request, session, uiClass); this.headers = headers; this.document = document; } diff --git a/server/src/com/vaadin/server/BootstrapResponse.java b/server/src/com/vaadin/server/BootstrapResponse.java index b75544a87c..c0c8d4e699 100644 --- a/server/src/com/vaadin/server/BootstrapResponse.java +++ b/server/src/com/vaadin/server/BootstrapResponse.java @@ -29,7 +29,7 @@ import com.vaadin.ui.UI; */ public abstract class BootstrapResponse extends EventObject { private final WrappedRequest request; - private final VaadinSession application; + private final VaadinSession session; private final Class uiClass; /** @@ -40,17 +40,16 @@ public abstract class BootstrapResponse extends EventObject { * @param request * the wrapped request for which the bootstrap page should be * generated - * @param application - * the application for which the bootstrap page should be - * generated + * @param session + * the session for which the bootstrap page should be generated * @param uiClass * the class of the UI that will be displayed on the page */ public BootstrapResponse(BootstrapHandler handler, WrappedRequest request, - VaadinSession application, Class uiClass) { + VaadinSession session, Class uiClass) { super(handler); this.request = request; - this.application = application; + this.session = session; this.uiClass = uiClass; } @@ -78,12 +77,12 @@ public abstract class BootstrapResponse extends EventObject { } /** - * Gets the application to which the rendered view belongs. + * Gets the vaadin session to which the rendered view belongs. * - * @return the application + * @return the vaadin session */ - public VaadinSession getApplication() { - return application; + public VaadinSession getVaadinSession() { + return session; } /** diff --git a/server/src/com/vaadin/server/CommunicationManager.java b/server/src/com/vaadin/server/CommunicationManager.java index 81169f1feb..7cdff288d4 100644 --- a/server/src/com/vaadin/server/CommunicationManager.java +++ b/server/src/com/vaadin/server/CommunicationManager.java @@ -87,8 +87,8 @@ public class CommunicationManager extends AbstractCommunicationManager { // don't use server and port in uri. It may cause problems with // some // virtual server configurations which lose the server name - VaadinSession application = context.getApplication(); - URL url = application.getURL(); + VaadinSession session = context.getVaadinSession(); + URL url = session.getURL(); String appUrl = url.getPath(); if (appUrl.endsWith("/")) { appUrl = appUrl.substring(0, appUrl.length() - 1); -- cgit v1.2.3