+++ /dev/null
-/*
- * Copyright 2011 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;
-
-import java.util.Properties;
-import java.util.logging.Logger;
-
-import com.vaadin.server.ApplicationConfiguration;
-import com.vaadin.server.Constants;
-
-public class DefaultApplicationConfiguration implements
- ApplicationConfiguration {
- private final Properties applicationProperties;
- private boolean productionMode;
- private boolean xsrfProtectionEnabled;
- private int resourceCacheTime;
- private int heartbeatInterval;
- private boolean idleRootCleanupEnabled;
- private final Class<?> systemPropertyBaseClass;
-
- public DefaultApplicationConfiguration(Class<?> systemPropertyBaseClass,
- Properties applicationProperties) {
- this.applicationProperties = applicationProperties;
- this.systemPropertyBaseClass = systemPropertyBaseClass;
-
- checkProductionMode();
- checkXsrfProtection();
- checkResourceCacheTime();
- checkHeartbeatInterval();
- checkIdleUICleanup();
- }
-
- @Override
- public String getApplicationOrSystemProperty(String propertyName,
- String defaultValue) {
- String val = null;
-
- // Try application properties
- val = getApplicationProperty(propertyName);
- if (val != null) {
- return val;
- }
-
- // Try system properties
- val = getSystemProperty(propertyName);
- if (val != null) {
- return val;
- }
-
- return defaultValue;
- }
-
- /**
- * Gets an system property value.
- *
- * @param parameterName
- * the Name or the parameter.
- * @return String value or null if not found
- */
- protected String getSystemProperty(String parameterName) {
- String val = null;
-
- String pkgName;
- final Package pkg = systemPropertyBaseClass.getPackage();
- if (pkg != null) {
- pkgName = pkg.getName();
- } else {
- final String className = systemPropertyBaseClass.getName();
- pkgName = new String(className.toCharArray(), 0,
- className.lastIndexOf('.'));
- }
- val = System.getProperty(pkgName + "." + parameterName);
- if (val != null) {
- return val;
- }
-
- // Try lowercased system properties
- val = System.getProperty(pkgName + "." + parameterName.toLowerCase());
- return val;
- }
-
- /**
- * Gets an application property value.
- *
- * @param parameterName
- * the Name or the parameter.
- * @return String value or null if not found
- */
- public String getApplicationProperty(String parameterName) {
-
- String val = applicationProperties.getProperty(parameterName);
- if (val != null) {
- return val;
- }
-
- // Try lower case application properties for backward compatibility with
- // 3.0.2 and earlier
- val = applicationProperties.getProperty(parameterName.toLowerCase());
-
- return val;
- }
-
- /**
- * {@inheritDoc}
- *
- * The default is false.
- */
- @Override
- public boolean isProductionMode() {
- return productionMode;
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * The default is true.
- */
- @Override
- public boolean isXsrfProtectionEnabled() {
- return xsrfProtectionEnabled;
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * The default interval is 3600 seconds (1 hour).
- */
- @Override
- public int getResourceCacheTime() {
- return resourceCacheTime;
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * The default interval is 300 seconds (5 minutes).
- */
- @Override
- public int getHeartbeatInterval() {
- return heartbeatInterval;
- }
-
- @Override
- public boolean isIdleUICleanupEnabled() {
- return idleRootCleanupEnabled;
- }
-
- /**
- * Log a warning if Vaadin is not running in production mode.
- */
- private void checkProductionMode() {
- productionMode = getApplicationOrSystemProperty(
- Constants.SERVLET_PARAMETER_PRODUCTION_MODE, "false").equals(
- "true");
- if (!productionMode) {
- getLogger().warning(Constants.NOT_PRODUCTION_MODE_INFO);
- }
- }
-
- /**
- * Log a warning if cross-site request forgery protection is disabled.
- */
- private void checkXsrfProtection() {
- xsrfProtectionEnabled = !getApplicationOrSystemProperty(
- Constants.SERVLET_PARAMETER_DISABLE_XSRF_PROTECTION, "false")
- .equals("true");
- if (!xsrfProtectionEnabled) {
- getLogger().warning(Constants.WARNING_XSRF_PROTECTION_DISABLED);
- }
- }
-
- /**
- * Log a warning if resource cache time is set but is not an integer.
- */
- private void checkResourceCacheTime() {
- try {
- resourceCacheTime = Integer
- .parseInt(getApplicationOrSystemProperty(
- Constants.SERVLET_PARAMETER_RESOURCE_CACHE_TIME,
- "3600"));
- } catch (NumberFormatException e) {
- getLogger().warning(
- Constants.WARNING_RESOURCE_CACHING_TIME_NOT_NUMERIC);
- resourceCacheTime = 3600;
- }
- }
-
- private void checkHeartbeatInterval() {
- try {
- heartbeatInterval = Integer
- .parseInt(getApplicationOrSystemProperty(
- Constants.SERVLET_PARAMETER_HEARTBEAT_RATE, "300"));
- } catch (NumberFormatException e) {
- getLogger().warning(
- Constants.WARNING_HEARTBEAT_INTERVAL_NOT_NUMERIC);
- heartbeatInterval = 300;
- }
- }
-
- private void checkIdleUICleanup() {
- idleRootCleanupEnabled = getApplicationOrSystemProperty(
- Constants.SERVLET_PARAMETER_CLOSE_IDLE_UIS, "false").equals(
- "true");
- }
-
- private Logger getLogger() {
- return Logger.getLogger(getClass().getName());
- }
-
- @Override
- public Properties getInitParameters() {
- return applicationProperties;
- }
-
-}
--- /dev/null
+/*
+ * Copyright 2011 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;
+
+import java.util.Properties;
+import java.util.logging.Logger;
+
+import com.vaadin.server.Constants;
+import com.vaadin.server.DeploymentConfiguration;
+
+public class DefaultDeploymentConfiguration implements DeploymentConfiguration {
+ private final Properties initParameters;
+ private boolean productionMode;
+ private boolean xsrfProtectionEnabled;
+ private int resourceCacheTime;
+ private int heartbeatInterval;
+ private boolean idleRootCleanupEnabled;
+ private final Class<?> systemPropertyBaseClass;
+
+ public DefaultDeploymentConfiguration(Class<?> systemPropertyBaseClass,
+ Properties initParameters) {
+ this.initParameters = initParameters;
+ this.systemPropertyBaseClass = systemPropertyBaseClass;
+
+ checkProductionMode();
+ checkXsrfProtection();
+ checkResourceCacheTime();
+ checkHeartbeatInterval();
+ checkIdleUICleanup();
+ }
+
+ @Override
+ public String getApplicationOrSystemProperty(String propertyName,
+ String defaultValue) {
+ String val = null;
+
+ // Try application properties
+ val = getApplicationProperty(propertyName);
+ if (val != null) {
+ return val;
+ }
+
+ // Try system properties
+ val = getSystemProperty(propertyName);
+ if (val != null) {
+ return val;
+ }
+
+ return defaultValue;
+ }
+
+ /**
+ * Gets an system property value.
+ *
+ * @param parameterName
+ * the Name or the parameter.
+ * @return String value or null if not found
+ */
+ protected String getSystemProperty(String parameterName) {
+ String val = null;
+
+ String pkgName;
+ final Package pkg = systemPropertyBaseClass.getPackage();
+ if (pkg != null) {
+ pkgName = pkg.getName();
+ } else {
+ final String className = systemPropertyBaseClass.getName();
+ pkgName = new String(className.toCharArray(), 0,
+ className.lastIndexOf('.'));
+ }
+ val = System.getProperty(pkgName + "." + parameterName);
+ if (val != null) {
+ return val;
+ }
+
+ // Try lowercased system properties
+ val = System.getProperty(pkgName + "." + parameterName.toLowerCase());
+ return val;
+ }
+
+ /**
+ * Gets an application property value.
+ *
+ * @param parameterName
+ * the Name or the parameter.
+ * @return String value or null if not found
+ */
+ public String getApplicationProperty(String parameterName) {
+
+ String val = initParameters.getProperty(parameterName);
+ if (val != null) {
+ return val;
+ }
+
+ // Try lower case application properties for backward compatibility with
+ // 3.0.2 and earlier
+ val = initParameters.getProperty(parameterName.toLowerCase());
+
+ return val;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default is false.
+ */
+ @Override
+ public boolean isProductionMode() {
+ return productionMode;
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * The default is true.
+ */
+ @Override
+ public boolean isXsrfProtectionEnabled() {
+ return xsrfProtectionEnabled;
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * The default interval is 3600 seconds (1 hour).
+ */
+ @Override
+ public int getResourceCacheTime() {
+ return resourceCacheTime;
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * The default interval is 300 seconds (5 minutes).
+ */
+ @Override
+ public int getHeartbeatInterval() {
+ return heartbeatInterval;
+ }
+
+ @Override
+ public boolean isIdleUICleanupEnabled() {
+ return idleRootCleanupEnabled;
+ }
+
+ /**
+ * Log a warning if Vaadin is not running in production mode.
+ */
+ private void checkProductionMode() {
+ productionMode = getApplicationOrSystemProperty(
+ Constants.SERVLET_PARAMETER_PRODUCTION_MODE, "false").equals(
+ "true");
+ if (!productionMode) {
+ getLogger().warning(Constants.NOT_PRODUCTION_MODE_INFO);
+ }
+ }
+
+ /**
+ * Log a warning if cross-site request forgery protection is disabled.
+ */
+ private void checkXsrfProtection() {
+ xsrfProtectionEnabled = !getApplicationOrSystemProperty(
+ Constants.SERVLET_PARAMETER_DISABLE_XSRF_PROTECTION, "false")
+ .equals("true");
+ if (!xsrfProtectionEnabled) {
+ getLogger().warning(Constants.WARNING_XSRF_PROTECTION_DISABLED);
+ }
+ }
+
+ /**
+ * Log a warning if resource cache time is set but is not an integer.
+ */
+ private void checkResourceCacheTime() {
+ try {
+ resourceCacheTime = Integer
+ .parseInt(getApplicationOrSystemProperty(
+ Constants.SERVLET_PARAMETER_RESOURCE_CACHE_TIME,
+ "3600"));
+ } catch (NumberFormatException e) {
+ getLogger().warning(
+ Constants.WARNING_RESOURCE_CACHING_TIME_NOT_NUMERIC);
+ resourceCacheTime = 3600;
+ }
+ }
+
+ private void checkHeartbeatInterval() {
+ try {
+ heartbeatInterval = Integer
+ .parseInt(getApplicationOrSystemProperty(
+ Constants.SERVLET_PARAMETER_HEARTBEAT_RATE, "300"));
+ } catch (NumberFormatException e) {
+ getLogger().warning(
+ Constants.WARNING_HEARTBEAT_INTERVAL_NOT_NUMERIC);
+ heartbeatInterval = 300;
+ }
+ }
+
+ private void checkIdleUICleanup() {
+ idleRootCleanupEnabled = getApplicationOrSystemProperty(
+ Constants.SERVLET_PARAMETER_CLOSE_IDLE_UIS, "false").equals(
+ "true");
+ }
+
+ private Logger getLogger() {
+ return Logger.getLogger(getClass().getName());
+ }
+
+ @Override
+ public Properties getInitParameters() {
+ return initParameters;
+ }
+
+}
public abstract class AbstractVaadinService implements VaadinService {
private AddonContext addonContext;
- private final ApplicationConfiguration applicationConfiguration;
+ private final DeploymentConfiguration deploymentConfiguration;
- public AbstractVaadinService(
- ApplicationConfiguration applicationConfiguration) {
- this.applicationConfiguration = applicationConfiguration;
+ public AbstractVaadinService(DeploymentConfiguration deploymentConfiguration) {
+ this.deploymentConfiguration = deploymentConfiguration;
}
@Override
- public ApplicationConfiguration getApplicationConfiguration() {
- return applicationConfiguration;
+ public DeploymentConfiguration getDeploymentConfiguration() {
+ return deploymentConfiguration;
}
@Override
public ClassLoader getClassLoader() {
- final String classLoaderName = getApplicationConfiguration()
+ final String classLoaderName = getDeploymentConfiguration()
.getApplicationOrSystemProperty("ClassLoader", null);
ClassLoader classLoader;
if (classLoaderName == null) {
+++ /dev/null
-/*
- * Copyright 2011 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.server;
-
-import java.util.Properties;
-
-/**
- * A collection of properties configured for all applications as well as a way
- * of accessing third party properties not explicitely supported by this class.
- *
- * @author Vaadin Ltd
- * @version @VERSION@
- * @since 7.0.0
- */
-public interface ApplicationConfiguration {
- /**
- * Returns whether Vaadin is in production mode.
- *
- * @return true if in production mode, false otherwise.
- */
- public boolean isProductionMode();
-
- /**
- * Returns whether cross-site request forgery protection is enabled.
- *
- * @return true if XSRF protection is enabled, false otherwise.
- */
- public boolean isXsrfProtectionEnabled();
-
- /**
- * Returns the time resources can be cached in the browsers, in seconds.
- *
- * @return The resource cache time.
- */
- public int getResourceCacheTime();
-
- /**
- * Returns the number of seconds between heartbeat requests of a UI, or a
- * non-positive number if heartbeat is disabled.
- *
- * @return The time between heartbeats.
- */
- public int getHeartbeatInterval();
-
- /**
- * Returns whether UIs that have no other activity than heartbeat requests
- * should be closed after they have been idle the maximum inactivity time
- * enforced by the session.
- *
- * @see WrappedSession#getMaxInactiveInterval()
- *
- * @since 7.0.0
- *
- * @return True if UIs receiving only heartbeat requests are eventually
- * closed; false if heartbeat requests extend UI lifetime
- * indefinitely.
- */
- public boolean isIdleUICleanupEnabled();
-
- /**
- * Gets the properties configured for the deployment, e.g. as init
- * parameters to the servlet or portlet.
- *
- * @return properties for the application.
- */
- public Properties getInitParameters();
-
- /**
- * Gets a configured property. The properties are typically read from e.g.
- * web.xml or from system properties of the JVM.
- *
- * @param propertyName
- * The simple of the property, in some contexts, lookup might be
- * performed using variations of the provided name.
- * @param defaultValue
- * the default value that should be used if no value has been
- * defined
- * @return the property value, or the passed default value if no property
- * value is found
- */
- public String getApplicationOrSystemProperty(String propertyName,
- String defaultValue);
-
-}
}
defaults.put("heartbeatInterval", vaadinService
- .getApplicationConfiguration().getHeartbeatInterval());
+ .getDeploymentConfiguration().getHeartbeatInterval());
defaults.put("appUri", getAppUri(context));
--- /dev/null
+/*
+ * Copyright 2011 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.server;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+/**
+ * A collection of properties configured at deploy time as well as a way of
+ * accessing third party properties not explicitly supported by this class.
+ *
+ * @author Vaadin Ltd
+ * @version @VERSION@
+ * @since 7.0.0
+ */
+public interface DeploymentConfiguration extends Serializable {
+ /**
+ * Returns whether Vaadin is in production mode.
+ *
+ * @return true if in production mode, false otherwise.
+ */
+ public boolean isProductionMode();
+
+ /**
+ * Returns whether cross-site request forgery protection is enabled.
+ *
+ * @return true if XSRF protection is enabled, false otherwise.
+ */
+ public boolean isXsrfProtectionEnabled();
+
+ /**
+ * Returns the time resources can be cached in the browsers, in seconds.
+ *
+ * @return The resource cache time.
+ */
+ public int getResourceCacheTime();
+
+ /**
+ * Returns the number of seconds between heartbeat requests of a UI, or a
+ * non-positive number if heartbeat is disabled.
+ *
+ * @return The time between heartbeats.
+ */
+ public int getHeartbeatInterval();
+
+ /**
+ * Returns whether UIs that have no other activity than heartbeat requests
+ * should be closed after they have been idle the maximum inactivity time
+ * enforced by the session.
+ *
+ * @see WrappedSession#getMaxInactiveInterval()
+ *
+ * @since 7.0.0
+ *
+ * @return True if UIs receiving only heartbeat requests are eventually
+ * closed; false if heartbeat requests extend UI lifetime
+ * indefinitely.
+ */
+ public boolean isIdleUICleanupEnabled();
+
+ /**
+ * Gets the properties configured for the deployment, e.g. as init
+ * parameters to the servlet or portlet.
+ *
+ * @return properties for the application.
+ */
+ public Properties getInitParameters();
+
+ /**
+ * Gets a configured property. The properties are typically read from e.g.
+ * web.xml or from system properties of the JVM.
+ *
+ * @param propertyName
+ * The simple of the property, in some contexts, lookup might be
+ * performed using variations of the provided name.
+ * @param defaultValue
+ * the default value that should be used if no value has been
+ * defined
+ * @return the property value, or the passed default value if no property
+ * value is found
+ */
+ public String getApplicationOrSystemProperty(String propertyName,
+ String defaultValue);
+
+}
protected String getMainDivStyle(BootstrapContext context) {
VaadinService vaadinService = context.getRequest()
.getVaadinService();
- return vaadinService.getApplicationConfiguration()
+ return vaadinService.getDeploymentConfiguration()
.getApplicationOrSystemProperty(
VaadinPortlet.PORTLET_PARAMETER_STYLE, null);
}
static Class<? extends Application> getLegacyApplicationClass(
VaadinService vaadinService) throws ApplicationClassException {
- Properties initParameters = vaadinService.getApplicationConfiguration()
+ Properties initParameters = vaadinService.getDeploymentConfiguration()
.getInitParameters();
String applicationParameter = initParameters.getProperty("application");
ClassLoader classLoader = vaadinService.getClassLoader();
public static void initDefaultUIProvider(VaadinSession application,
VaadinService vaadinService) throws ApplicationClassException {
- String uiProperty = vaadinService.getApplicationConfiguration()
+ String uiProperty = vaadinService.getDeploymentConfiguration()
.getInitParameters().getProperty(VaadinSession.UI_PARAMETER);
if (uiProperty != null) {
verifyUIClass(uiProperty, vaadinService.getClassLoader());
import com.liferay.portal.kernel.util.PortalClassInvoker;
import com.liferay.portal.kernel.util.PropsUtil;
-import com.vaadin.DefaultApplicationConfiguration;
+import com.vaadin.DefaultDeploymentConfiguration;
import com.vaadin.server.AbstractCommunicationManager.Callback;
import com.vaadin.server.ServletPortletHelper.ApplicationClassException;
import com.vaadin.server.VaadinSession.ApplicationStartEvent;
private final VaadinPortlet portlet;
public PortletService(VaadinPortlet portlet,
- ApplicationConfiguration applicationConfiguration) {
- super(applicationConfiguration);
+ DeploymentConfiguration deploymentConfiguration) {
+ super(deploymentConfiguration);
this.portlet = portlet;
}
@Override
public String getConfiguredWidgetset(WrappedRequest request) {
- String widgetset = getApplicationConfiguration()
+ String widgetset = getDeploymentConfiguration()
.getApplicationOrSystemProperty(PARAMETER_WIDGETSET, null);
if (widgetset == null) {
@Override
public void init(PortletConfig config) throws PortletException {
super.init(config);
- Properties applicationProperties = new Properties();
+ Properties initParameters = new Properties();
// Read default parameters from the context
final PortletContext context = config.getPortletContext();
for (final Enumeration<String> e = context.getInitParameterNames(); e
.hasMoreElements();) {
final String name = e.nextElement();
- applicationProperties.setProperty(name,
- context.getInitParameter(name));
+ initParameters.setProperty(name, context.getInitParameter(name));
}
// Override with application settings from portlet.xml
for (final Enumeration<String> e = config.getInitParameterNames(); e
.hasMoreElements();) {
final String name = e.nextElement();
- applicationProperties.setProperty(name,
- config.getInitParameter(name));
+ initParameters.setProperty(name, config.getInitParameter(name));
}
- ApplicationConfiguration applicationConfiguration = createApplicationConfiguration(applicationProperties);
- vaadinService = createPortletService(applicationConfiguration);
+ DeploymentConfiguration deploymentConfiguration = createDeploymentConfiguration(initParameters);
+ vaadinService = createPortletService(deploymentConfiguration);
addonContext = new AddonContext(vaadinService);
addonContext.init();
}
- protected ApplicationConfiguration createApplicationConfiguration(
- Properties applicationProperties) {
- return new DefaultApplicationConfiguration(getClass(),
- applicationProperties);
+ protected DeploymentConfiguration createDeploymentConfiguration(
+ Properties initParameters) {
+ return new DefaultDeploymentConfiguration(getClass(), initParameters);
}
protected PortletService createPortletService(
- ApplicationConfiguration applicationConfiguration) {
- return new PortletService(this, applicationConfiguration);
+ DeploymentConfiguration deploymentConfiguration) {
+ return new PortletService(this, deploymentConfiguration);
}
@Override
newApplication.setLocale(locale);
// No application URL when running inside a portlet
newApplication.start(new ApplicationStartEvent(null, getVaadinService()
- .getApplicationConfiguration(),
- new PortletCommunicationManager(newApplication)));
+ .getDeploymentConfiguration(), new PortletCommunicationManager(
+ newApplication)));
addonContext.fireApplicationStarted(newApplication);
return newApplication;
public String getMimeType(String resourceName);
/**
- * Gets the application configuration.
+ * Gets the deployment configuration.
*
- * @return the application configuration
+ * @return the deployment configuration
*/
- public ApplicationConfiguration getApplicationConfiguration();
+ public DeploymentConfiguration getDeploymentConfiguration();
public Iterator<AddonContextListener> getAddonContextListeners();
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import com.vaadin.DefaultApplicationConfiguration;
+import com.vaadin.DefaultDeploymentConfiguration;
import com.vaadin.server.AbstractCommunicationManager.Callback;
import com.vaadin.server.ServletPortletHelper.ApplicationClassException;
import com.vaadin.server.VaadinSession.ApplicationStartEvent;
private final VaadinServlet servlet;
public ServletService(VaadinServlet servlet,
- ApplicationConfiguration applicationProperties) {
- super(applicationProperties);
+ DeploymentConfiguration deploymentConfiguration) {
+ super(deploymentConfiguration);
this.servlet = servlet;
}
.cast(request);
String staticFileLocation;
// if property is defined in configurations, use that
- staticFileLocation = getApplicationConfiguration()
+ staticFileLocation = getDeploymentConfiguration()
.getApplicationOrSystemProperty(PARAMETER_VAADIN_RESOURCES,
null);
if (staticFileLocation != null) {
@Override
public String getConfiguredWidgetset(WrappedRequest request) {
- return getApplicationConfiguration()
- .getApplicationOrSystemProperty(
- VaadinServlet.PARAMETER_WIDGETSET,
- VaadinServlet.DEFAULT_WIDGETSET);
+ return getDeploymentConfiguration().getApplicationOrSystemProperty(
+ VaadinServlet.PARAMETER_WIDGETSET,
+ VaadinServlet.DEFAULT_WIDGETSET);
}
@Override
public void init(javax.servlet.ServletConfig servletConfig)
throws javax.servlet.ServletException {
super.init(servletConfig);
- Properties applicationProperties = new Properties();
+ Properties initParameters = new Properties();
// Read default parameters from server.xml
final ServletContext context = servletConfig.getServletContext();
for (final Enumeration<String> e = context.getInitParameterNames(); e
.hasMoreElements();) {
final String name = e.nextElement();
- applicationProperties.setProperty(name,
- context.getInitParameter(name));
+ initParameters.setProperty(name, context.getInitParameter(name));
}
// Override with application config from web.xml
for (final Enumeration<String> e = servletConfig
.getInitParameterNames(); e.hasMoreElements();) {
final String name = e.nextElement();
- applicationProperties.setProperty(name,
+ initParameters.setProperty(name,
servletConfig.getInitParameter(name));
}
- ApplicationConfiguration applicationConfiguration = createApplicationConfiguration(applicationProperties);
- servletService = createServletService(applicationConfiguration);
+ DeploymentConfiguration deploymentConfiguration = createDeploymentConfiguration(initParameters);
+ servletService = createServletService(deploymentConfiguration);
addonContext = new AddonContext(servletService);
addonContext.init();
}
- protected ApplicationConfiguration createApplicationConfiguration(
- Properties applicationProperties) {
- return new DefaultApplicationConfiguration(getClass(),
- applicationProperties);
+ protected DeploymentConfiguration createDeploymentConfiguration(
+ Properties initParameters) {
+ return new DefaultDeploymentConfiguration(getClass(), initParameters);
}
protected ServletService createServletService(
- ApplicationConfiguration applicationConfiguration) {
- return new ServletService(this, applicationConfiguration);
+ DeploymentConfiguration deploymentConfiguration) {
+ return new ServletService(this, deploymentConfiguration);
}
@Override
Locale locale = request.getLocale();
newApplication.setLocale(locale);
newApplication.start(new ApplicationStartEvent(applicationUrl,
- getVaadinService().getApplicationConfiguration(),
+ getVaadinService().getDeploymentConfiguration(),
createCommunicationManager(newApplication)));
addonContext.fireApplicationStarted(newApplication);
* parameter in web.xml
*/
int resourceCacheTime = getVaadinService()
- .getApplicationConfiguration().getResourceCacheTime();
+ .getDeploymentConfiguration().getResourceCacheTime();
response.setHeader("Cache-Control",
"max-age= " + String.valueOf(resourceCacheTime));
}
public static class ApplicationStartEvent implements Serializable {
private final URL applicationUrl;
- private final ApplicationConfiguration configuration;
+ private final DeploymentConfiguration configuration;
private final AbstractCommunicationManager communicationManager;
* the communication manager for the application.
*/
public ApplicationStartEvent(URL applicationUrl,
- ApplicationConfiguration configuration,
+ DeploymentConfiguration configuration,
AbstractCommunicationManager communicationManager) {
this.applicationUrl = applicationUrl;
this.configuration = configuration;
}
/**
- * Returns the application configuration used by this application.
+ * Returns the deployment configuration used by this session.
*
* @return the deployment configuration.
*/
- public ApplicationConfiguration getConfiguration() {
+ public DeploymentConfiguration getConfiguration() {
return configuration;
}
/**
* Configuration for the application.
*/
- private ApplicationConfiguration configuration;
+ private DeploymentConfiguration configuration;
/**
* The application's URL.
*
* @return the application configuration
*/
- public ApplicationConfiguration getConfiguration() {
+ public DeploymentConfiguration getConfiguration() {
return configuration;
}
*
* @see #getUidlRequestTimeout()
* @see #closeInactiveUIs()
- * @see ApplicationConfiguration#getHeartbeatInterval()
+ * @see DeploymentConfiguration#getHeartbeatInterval()
*
* @since 7.0.0
*
* otherwise heartbeat requests are enough to extend UI lifetime
* indefinitely.
*
- * @see ApplicationConfiguration#isIdleUICleanupEnabled()
+ * @see DeploymentConfiguration#isIdleUICleanupEnabled()
* @see #getHeartbeatTimeout()
* @see #closeInactiveUIs()
*
import junit.framework.TestCase;
-import com.vaadin.DefaultApplicationConfiguration;
+import com.vaadin.DefaultDeploymentConfiguration;
import com.vaadin.server.VaadinServlet.ServletService;
public class TestAbstractApplicationServletStaticFilesLocation extends TestCase {
Field f = VaadinServlet.class.getDeclaredField("servletService");
f.setAccessible(true);
f.set(servlet, new ServletService(servlet,
- new DefaultApplicationConfiguration(servlet.getClass(),
+ new DefaultDeploymentConfiguration(servlet.getClass(),
new Properties())));
}
import org.easymock.EasyMock;
-import com.vaadin.DefaultApplicationConfiguration;
-import com.vaadin.server.ApplicationConfiguration;
+import com.vaadin.DefaultDeploymentConfiguration;
+import com.vaadin.server.DeploymentConfiguration;
import com.vaadin.server.DefaultUIProvider;
import com.vaadin.server.VaadinService;
import com.vaadin.server.VaadinSession;
assertEquals(MyUI.class, uiClass);
}
- private static ApplicationConfiguration createConfigurationMock() {
+ private static DeploymentConfiguration createConfigurationMock() {
Properties properties = new Properties();
properties.put(VaadinSession.UI_PARAMETER, MyUI.class.getName());
- return new DefaultApplicationConfiguration(CustomUIClassLoader.class,
+ return new DefaultDeploymentConfiguration(CustomUIClassLoader.class,
properties);
}
private VaadinSession createStubApplication() {
return new VaadinSession() {
@Override
- public ApplicationConfiguration getConfiguration() {
+ public DeploymentConfiguration getConfiguration() {
return createConfigurationMock();
}
};
import com.vaadin.Application;
import com.vaadin.server.AbstractUIProvider;
-import com.vaadin.server.ApplicationConfiguration;
+import com.vaadin.server.DeploymentConfiguration;
import com.vaadin.server.LegacyVaadinServlet;
import com.vaadin.server.UIProvider;
import com.vaadin.server.VaadinServletSession;
@Override
protected ServletService createServletService(
- ApplicationConfiguration applicationConfiguration) {
- return new ServletService(this, applicationConfiguration) {
+ DeploymentConfiguration deploymentConfiguration) {
+ return new ServletService(this, deploymentConfiguration) {
@Override
public String getStaticFileLocation(WrappedRequest request) {
URIS uris = getApplicationRunnerURIs(WrappedHttpServletRequest