diff options
30 files changed, 158 insertions, 186 deletions
diff --git a/server/src/com/vaadin/server/AbstractCommunicationManager.java b/server/src/com/vaadin/server/AbstractCommunicationManager.java index 4f408d6fe9..9feab9277d 100644 --- a/server/src/com/vaadin/server/AbstractCommunicationManager.java +++ b/server/src/com/vaadin/server/AbstractCommunicationManager.java @@ -571,7 +571,7 @@ public abstract class AbstractCommunicationManager implements Serializable { if (!handleVariables(request, response, callback, application, uI)) { // var inconsistency; the client is probably out-of-sync - SystemMessages ci = response.getDeploymentConfiguration() + SystemMessages ci = response.getVaadinService() .getSystemMessages(); String msg = ci.getOutOfSyncMessage(); String cap = ci.getOutOfSyncCaption(); @@ -1023,8 +1023,7 @@ public abstract class AbstractCommunicationManager implements Serializable { } } - SystemMessages ci = request.getDeploymentConfiguration() - .getSystemMessages(); + SystemMessages ci = request.getVaadinService().getSystemMessages(); // meta instruction for client to enable auto-forward to // sessionExpiredURL after timer expires. @@ -2483,8 +2482,8 @@ public abstract class AbstractCommunicationManager implements Serializable { .substring(ApplicationConstants.CONNECTOR_RESOURCE_PREFIX .length() + 2); - final String mimetype = response.getDeploymentConfiguration() - .getMimeType(resourceName); + final String mimetype = response.getVaadinService().getMimeType( + resourceName); // Security check: avoid accidentally serving from the UI of the // classpath instead of relative to the context class diff --git a/server/src/com/vaadin/server/AbstractDeploymentConfiguration.java b/server/src/com/vaadin/server/AbstractVaadinService.java index 3d7efa6711..516ce23333 100644 --- a/server/src/com/vaadin/server/AbstractDeploymentConfiguration.java +++ b/server/src/com/vaadin/server/AbstractVaadinService.java @@ -20,13 +20,12 @@ import java.lang.reflect.Constructor; import java.util.Iterator; import java.util.ServiceLoader; -public abstract class AbstractDeploymentConfiguration implements - DeploymentConfiguration { +public abstract class AbstractVaadinService implements VaadinService { private AddonContext addonContext; private final ApplicationConfiguration applicationConfiguration; - public AbstractDeploymentConfiguration( + public AbstractVaadinService( ApplicationConfiguration applicationConfiguration) { this.applicationConfiguration = applicationConfiguration; } diff --git a/server/src/com/vaadin/server/AddonContext.java b/server/src/com/vaadin/server/AddonContext.java index 2b1cedc162..2cf9b23c75 100644 --- a/server/src/com/vaadin/server/AddonContext.java +++ b/server/src/com/vaadin/server/AddonContext.java @@ -36,8 +36,7 @@ import com.vaadin.util.ReflectTools; * META-INF/services/com.vaadin.server.AddonContextListener will be checked for * lines containing fully qualified names of classes to use. This behavior can * however be overridden for custom deployment situations (e.g. to use CDI or - * OSGi) by overriding - * {@link DeploymentConfiguration#getAddonContextListeners()}. + * OSGi) by overriding {@link VaadinService#getAddonContextListeners()}. * * @author Vaadin Ltd * @since 7.0.0 @@ -47,7 +46,7 @@ public class AddonContext { .findMethod(ApplicationStartedListener.class, "applicationStarted", ApplicationStartedEvent.class); - private final DeploymentConfiguration deploymentConfiguration; + private final VaadinService vaadinService; private final EventRouter eventRouter = new EventRouter(); @@ -59,13 +58,12 @@ public class AddonContext { * Creates a new context using a given deployment configuration. Only the * framework itself should typically create AddonContext methods. * - * @param deploymentConfiguration - * the deployment configuration for the associated servlet or - * portlet. + * @param vaadinService + * the vaadin service for the associated servlet or portlet. */ - public AddonContext(DeploymentConfiguration deploymentConfiguration) { - this.deploymentConfiguration = deploymentConfiguration; - deploymentConfiguration.setAddonContext(this); + public AddonContext(VaadinService vaadinService) { + this.vaadinService = vaadinService; + vaadinService.setAddonContext(this); } /** @@ -73,22 +71,21 @@ public class AddonContext { * * @return the deployment configuration */ - public DeploymentConfiguration getDeploymentConfiguration() { - return deploymentConfiguration; + public VaadinService getVaadinService() { + return vaadinService; } /** * Initializes this context, causing all found listeners to be notified. * Listeners are by default found using {@link ServiceLoader}, but the - * {@link DeploymentConfiguration} can provide an alternative - * implementation. + * {@link VaadinService} can provide an alternative implementation. * <p> * This method is not intended to be used by add-ons, but instead by the * part of the framework that created this context object. */ public void init() { AddonContextEvent event = new AddonContextEvent(this); - Iterator<AddonContextListener> listeners = deploymentConfiguration + Iterator<AddonContextListener> listeners = vaadinService .getAddonContextListeners(); while (listeners.hasNext()) { AddonContextListener listener = listeners.next(); diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java index 6b8fb1952a..37b9649e55 100644 --- a/server/src/com/vaadin/server/BootstrapHandler.java +++ b/server/src/com/vaadin/server/BootstrapHandler.java @@ -131,13 +131,12 @@ public abstract class BootstrapHandler implements RequestHandler { private String getBootstrapHtml(BootstrapContext context) { WrappedRequest request = context.getRequest(); WrappedResponse response = context.getResponse(); - DeploymentConfiguration deploymentConfiguration = request - .getDeploymentConfiguration(); + VaadinService vaadinService = request.getVaadinService(); BootstrapFragmentResponse fragmentResponse = context .getBootstrapResponse(); - if (deploymentConfiguration.isStandalone(request)) { + if (vaadinService.isStandalone(request)) { Map<String, Object> headers = new LinkedHashMap<String, Object>(); Document document = Document.createShell(""); BootstrapPageResponse pageResponse = new BootstrapPageResponse( @@ -274,8 +273,8 @@ public abstract class BootstrapHandler implements RequestHandler { .getUiProvider(context.getRequest(), context.getUIClass()) .getWidgetsetForUI(context.getRequest(), context.getUIClass()); if (widgetset == null) { - widgetset = request.getDeploymentConfiguration() - .getConfiguredWidgetset(request); + widgetset = request.getVaadinService().getConfiguredWidgetset( + request); } widgetset = VaadinServlet.stripSpecialChars(widgetset); @@ -327,9 +326,8 @@ public abstract class BootstrapHandler implements RequestHandler { WrappedRequest request = context.getRequest(); - DeploymentConfiguration deploymentConfiguration = request - .getDeploymentConfiguration(); - String staticFileLocation = deploymentConfiguration + VaadinService vaadinService = request.getVaadinService(); + String staticFileLocation = vaadinService .getStaticFileLocation(request); fragmentNodes @@ -421,12 +419,10 @@ public abstract class BootstrapHandler implements RequestHandler { WrappedRequest request = context.getRequest(); VaadinSession application = context.getApplication(); - DeploymentConfiguration deploymentConfiguration = request - .getDeploymentConfiguration(); + VaadinService vaadinService = request.getVaadinService(); // Get system messages - SystemMessages systemMessages = deploymentConfiguration - .getSystemMessages(); + SystemMessages systemMessages = vaadinService.getSystemMessages(); if (systemMessages != null) { // Write the CommunicationError -message to client JSONObject comErrMsg = new JSONObject(); @@ -448,7 +444,7 @@ public abstract class BootstrapHandler implements RequestHandler { defaults.put("authErrMsg", authErrMsg); } - String staticFileLocation = deploymentConfiguration + String staticFileLocation = vaadinService .getStaticFileLocation(request); String widgetsetBase = staticFileLocation + "/" + VaadinServlet.WIDGETSET_DIRECTORY_PATH; @@ -458,11 +454,11 @@ public abstract class BootstrapHandler implements RequestHandler { defaults.put("debug", true); } - if (deploymentConfiguration.isStandalone(request)) { + if (vaadinService.isStandalone(request)) { defaults.put("standalone", true); } - defaults.put("heartbeatInterval", deploymentConfiguration + defaults.put("heartbeatInterval", vaadinService .getApplicationConfiguration().getHeartbeatInterval()); defaults.put("appUri", getAppUri(context)); @@ -485,7 +481,7 @@ public abstract class BootstrapHandler implements RequestHandler { */ public String getThemeUri(BootstrapContext context, String themeName) { WrappedRequest request = context.getRequest(); - final String staticFilePath = request.getDeploymentConfiguration() + final String staticFilePath = request.getVaadinService() .getStaticFileLocation(request); return staticFilePath + "/" + VaadinServlet.THEME_DIRECTORY_PATH + themeName; @@ -513,8 +509,7 @@ public abstract class BootstrapHandler implements RequestHandler { String themeName = getThemeName(context); if (themeName == null) { WrappedRequest request = context.getRequest(); - themeName = request.getDeploymentConfiguration() - .getConfiguredTheme(request); + themeName = request.getVaadinService().getConfiguredTheme(request); } // XSS preventation, theme names shouldn't contain special chars anyway. diff --git a/server/src/com/vaadin/server/CombinedRequest.java b/server/src/com/vaadin/server/CombinedRequest.java index cc336ffa73..3de5067a20 100644 --- a/server/src/com/vaadin/server/CombinedRequest.java +++ b/server/src/com/vaadin/server/CombinedRequest.java @@ -178,7 +178,7 @@ public class CombinedRequest implements WrappedRequest { } @Override - public DeploymentConfiguration getDeploymentConfiguration() { - return secondRequest.getDeploymentConfiguration(); + public VaadinService getVaadinService() { + return secondRequest.getVaadinService(); } } diff --git a/server/src/com/vaadin/server/DefaultUIProvider.java b/server/src/com/vaadin/server/DefaultUIProvider.java index 9babf4704e..0a5613a588 100644 --- a/server/src/com/vaadin/server/DefaultUIProvider.java +++ b/server/src/com/vaadin/server/DefaultUIProvider.java @@ -29,7 +29,7 @@ public class DefaultUIProvider extends AbstractUIProvider { if (uiClassNameObj instanceof String) { String uiClassName = uiClassNameObj.toString(); - ClassLoader classLoader = request.getDeploymentConfiguration() + ClassLoader classLoader = request.getVaadinService() .getClassLoader(); if (classLoader == null) { classLoader = getClass().getClassLoader(); diff --git a/server/src/com/vaadin/server/GAEVaadinServlet.java b/server/src/com/vaadin/server/GAEVaadinServlet.java index 957c0a9fe1..98b5f94c6a 100644 --- a/server/src/com/vaadin/server/GAEVaadinServlet.java +++ b/server/src/com/vaadin/server/GAEVaadinServlet.java @@ -172,9 +172,9 @@ public class GAEVaadinServlet extends VaadinServlet { HttpServletResponse unwrappedResponse) throws ServletException, IOException { WrappedHttpServletRequest request = new WrappedHttpServletRequest( - unwrappedRequest, getDeploymentConfiguration()); + unwrappedRequest, getVaadinService()); WrappedHttpServletResponse response = new WrappedHttpServletResponse( - unwrappedResponse, getDeploymentConfiguration()); + unwrappedResponse, getVaadinService()); if (isCleanupRequest(request)) { cleanDatastore(); diff --git a/server/src/com/vaadin/server/LegacyVaadinPortlet.java b/server/src/com/vaadin/server/LegacyVaadinPortlet.java index e62bf5f4d4..0f71f102c7 100644 --- a/server/src/com/vaadin/server/LegacyVaadinPortlet.java +++ b/server/src/com/vaadin/server/LegacyVaadinPortlet.java @@ -28,7 +28,7 @@ public class LegacyVaadinPortlet extends VaadinPortlet { throws ClassNotFoundException { try { return ServletPortletHelper - .getLegacyApplicationClass(getDeploymentConfiguration()); + .getLegacyApplicationClass(getVaadinService()); } catch (ApplicationClassException e) { throw new RuntimeException(e); } diff --git a/server/src/com/vaadin/server/LegacyVaadinServlet.java b/server/src/com/vaadin/server/LegacyVaadinServlet.java index 183d4389d6..a631ae8319 100644 --- a/server/src/com/vaadin/server/LegacyVaadinServlet.java +++ b/server/src/com/vaadin/server/LegacyVaadinServlet.java @@ -28,7 +28,7 @@ public class LegacyVaadinServlet extends VaadinServlet { throws ClassNotFoundException { try { return ServletPortletHelper - .getLegacyApplicationClass(getDeploymentConfiguration()); + .getLegacyApplicationClass(getVaadinService()); } catch (ApplicationClassException e) { throw new RuntimeException(e); } diff --git a/server/src/com/vaadin/server/PortletCommunicationManager.java b/server/src/com/vaadin/server/PortletCommunicationManager.java index fcb0ae228e..5b6948e2e3 100644 --- a/server/src/com/vaadin/server/PortletCommunicationManager.java +++ b/server/src/com/vaadin/server/PortletCommunicationManager.java @@ -127,9 +127,9 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { @Override protected String getMainDivStyle(BootstrapContext context) { - DeploymentConfiguration deploymentConfiguration = context - .getRequest().getDeploymentConfiguration(); - return deploymentConfiguration.getApplicationConfiguration() + VaadinService vaadinService = context.getRequest() + .getVaadinService(); + return vaadinService.getApplicationConfiguration() .getApplicationOrSystemProperty( VaadinPortlet.PORTLET_PARAMETER_STYLE, null); } diff --git a/server/src/com/vaadin/server/ServletPortletHelper.java b/server/src/com/vaadin/server/ServletPortletHelper.java index 609168ee96..f964415fdc 100644 --- a/server/src/com/vaadin/server/ServletPortletHelper.java +++ b/server/src/com/vaadin/server/ServletPortletHelper.java @@ -42,12 +42,11 @@ class ServletPortletHelper implements Serializable { } static Class<? extends Application> getLegacyApplicationClass( - DeploymentConfiguration deploymentConfiguration) - throws ApplicationClassException { - Properties initParameters = deploymentConfiguration - .getApplicationConfiguration().getInitParameters(); + VaadinService vaadinService) throws ApplicationClassException { + Properties initParameters = vaadinService.getApplicationConfiguration() + .getInitParameters(); String applicationParameter = initParameters.getProperty("application"); - ClassLoader classLoader = deploymentConfiguration.getClassLoader(); + ClassLoader classLoader = vaadinService.getClassLoader(); if (applicationParameter == null) { throw new ApplicationClassException( @@ -133,13 +132,11 @@ class ServletPortletHelper implements Serializable { } public static void initDefaultUIProvider(VaadinSession application, - DeploymentConfiguration deploymentConfiguration) - throws ApplicationClassException { - String uiProperty = deploymentConfiguration - .getApplicationConfiguration().getInitParameters() - .getProperty(VaadinSession.UI_PARAMETER); + VaadinService vaadinService) throws ApplicationClassException { + String uiProperty = vaadinService.getApplicationConfiguration() + .getInitParameters().getProperty(VaadinSession.UI_PARAMETER); if (uiProperty != null) { - verifyUIClass(uiProperty, deploymentConfiguration.getClassLoader()); + verifyUIClass(uiProperty, vaadinService.getClassLoader()); application.addUIProvider(new DefaultUIProvider()); } } diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index 236b38b27c..be571fbf60 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -74,11 +74,10 @@ public class VaadinPortlet extends GenericPortlet implements Constants { public static final String RESOURCE_URL_ID = "APP"; - public static class PortletDeploymentConfiguration extends - AbstractDeploymentConfiguration { + public static class PortletService extends AbstractVaadinService { private final VaadinPortlet portlet; - public PortletDeploymentConfiguration(VaadinPortlet portlet, + public PortletService(VaadinPortlet portlet, ApplicationConfiguration applicationConfiguration) { super(applicationConfiguration); this.portlet = portlet; @@ -185,9 +184,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants { WrappedPortletRequest { public WrappedHttpAndPortletRequest(PortletRequest request, - HttpServletRequest originalRequest, - DeploymentConfiguration deploymentConfiguration) { - super(request, deploymentConfiguration); + HttpServletRequest originalRequest, PortletService vaadinService) { + super(request, vaadinService); this.originalRequest = originalRequest; } @@ -229,8 +227,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants { public static class WrappedGateinRequest extends WrappedHttpAndPortletRequest { public WrappedGateinRequest(PortletRequest request, - DeploymentConfiguration deploymentConfiguration) { - super(request, getOriginalRequest(request), deploymentConfiguration); + PortletService vaadinService) { + super(request, getOriginalRequest(request), vaadinService); } private static final HttpServletRequest getOriginalRequest( @@ -252,8 +250,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants { WrappedHttpAndPortletRequest { public WrappedLiferayRequest(PortletRequest request, - DeploymentConfiguration deploymentConfiguration) { - super(request, getOriginalRequest(request), deploymentConfiguration); + PortletService vaadinService) { + super(request, getOriginalRequest(request), vaadinService); } @Override @@ -320,7 +318,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { // TODO Can we close the application when the portlet is removed? Do we know // when the portlet is removed? - private PortletDeploymentConfiguration deploymentConfiguration; + private PortletService vaadinService; private AddonContext addonContext; @Override @@ -346,9 +344,9 @@ public class VaadinPortlet extends GenericPortlet implements Constants { } ApplicationConfiguration applicationConfiguration = createApplicationConfiguration(applicationProperties); - deploymentConfiguration = createDeploymentConfiguration(applicationConfiguration); + vaadinService = createPortletService(applicationConfiguration); - addonContext = new AddonContext(deploymentConfiguration); + addonContext = new AddonContext(vaadinService); addonContext.init(); } @@ -358,10 +356,9 @@ public class VaadinPortlet extends GenericPortlet implements Constants { applicationProperties); } - protected PortletDeploymentConfiguration createDeploymentConfiguration( + protected PortletService createPortletService( ApplicationConfiguration applicationConfiguration) { - return new PortletDeploymentConfiguration(this, - applicationConfiguration); + return new PortletService(this, applicationConfiguration); } @Override @@ -429,7 +426,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { WrappedPortletRequest wrappedRequest = createWrappedRequest(request); WrappedPortletResponse wrappedResponse = new WrappedPortletResponse( - response, getDeploymentConfiguration()); + response, getVaadinService()); CurrentInstance.set(WrappedRequest.class, wrappedRequest); CurrentInstance.set(WrappedResponse.class, wrappedResponse); @@ -611,20 +608,17 @@ public class VaadinPortlet extends GenericPortlet implements Constants { String portalInfo = request.getPortalContext().getPortalInfo() .toLowerCase(); if (portalInfo.contains("liferay")) { - return new WrappedLiferayRequest(request, - getDeploymentConfiguration()); + return new WrappedLiferayRequest(request, getVaadinService()); } else if (portalInfo.contains("gatein")) { - return new WrappedGateinRequest(request, - getDeploymentConfiguration()); + return new WrappedGateinRequest(request, getVaadinService()); } else { - return new WrappedPortletRequest(request, - getDeploymentConfiguration()); + return new WrappedPortletRequest(request, getVaadinService()); } } - protected PortletDeploymentConfiguration getDeploymentConfiguration() { - return deploymentConfiguration; + protected PortletService getVaadinService() { + return vaadinService; } private void handleUnknownRequest(PortletRequest request, @@ -835,8 +829,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants { Locale locale = request.getLocale(); newApplication.setLocale(locale); // No application URL when running inside a portlet - newApplication.start(new ApplicationStartEvent(null, - getDeploymentConfiguration().getApplicationConfiguration(), + newApplication.start(new ApplicationStartEvent(null, getVaadinService() + .getApplicationConfiguration(), new PortletCommunicationManager(newApplication))); addonContext.fireApplicationStarted(newApplication); @@ -849,7 +843,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { try { ServletPortletHelper.initDefaultUIProvider(application, - getDeploymentConfiguration()); + getVaadinService()); } catch (ApplicationClassException e) { throw new PortletException(e); } @@ -889,8 +883,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { // if this was an UIDL request, response UIDL back to client if (getRequestType(request) == RequestType.UIDL) { - SystemMessages ci = getDeploymentConfiguration() - .getSystemMessages(); + SystemMessages ci = getVaadinService().getSystemMessages(); criticalNotification(request, response, ci.getInternalErrorCaption(), ci.getInternalErrorMessage(), null, ci.getInternalErrorURL()); diff --git a/server/src/com/vaadin/server/VaadinPortletSession.java b/server/src/com/vaadin/server/VaadinPortletSession.java index 8d1ae84fca..40c88ac8fe 100644 --- a/server/src/com/vaadin/server/VaadinPortletSession.java +++ b/server/src/com/vaadin/server/VaadinPortletSession.java @@ -84,8 +84,7 @@ public class VaadinPortletSession extends VaadinSession { public PortletConfig getPortletConfig() { WrappedPortletResponse response = (WrappedPortletResponse) CurrentInstance .get(WrappedResponse.class); - return response.getDeploymentConfiguration().getPortlet() - .getPortletConfig(); + return response.getVaadinService().getPortlet().getPortletConfig(); } public void addPortletListener(PortletListener listener) { diff --git a/server/src/com/vaadin/server/DeploymentConfiguration.java b/server/src/com/vaadin/server/VaadinService.java index 0a70ef09b3..41c864fcd9 100644 --- a/server/src/com/vaadin/server/DeploymentConfiguration.java +++ b/server/src/com/vaadin/server/VaadinService.java @@ -31,7 +31,7 @@ import javax.servlet.ServletContext; * * @since 7.0 */ -public interface DeploymentConfiguration extends Serializable { +public interface VaadinService extends Serializable { /** * Return the URL from where static files, e.g. the widgetset and the theme, * are served. In a standard configuration the VAADIN folder inside the diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index 3a60cf5009..cd62e292fb 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -55,11 +55,10 @@ import com.vaadin.util.CurrentInstance; @SuppressWarnings("serial") public class VaadinServlet extends HttpServlet implements Constants { - public static class ServletDeploymentConfiguration extends - AbstractDeploymentConfiguration { + public static class ServletService extends AbstractVaadinService { private final VaadinServlet servlet; - public ServletDeploymentConfiguration(VaadinServlet servlet, + public ServletService(VaadinServlet servlet, ApplicationConfiguration applicationProperties) { super(applicationProperties); this.servlet = servlet; @@ -175,7 +174,7 @@ public class VaadinServlet extends HttpServlet implements Constants { private final String resourcePath = null; - private DeploymentConfiguration deploymentConfiguration; + private ServletService servletService; private AddonContext addonContext; @@ -214,9 +213,9 @@ public class VaadinServlet extends HttpServlet implements Constants { } ApplicationConfiguration applicationConfiguration = createApplicationConfiguration(applicationProperties); - deploymentConfiguration = createDeploymentConfiguration(applicationConfiguration); + servletService = createServletService(applicationConfiguration); - addonContext = new AddonContext(deploymentConfiguration); + addonContext = new AddonContext(servletService); addonContext.init(); } @@ -226,10 +225,9 @@ public class VaadinServlet extends HttpServlet implements Constants { applicationProperties); } - protected ServletDeploymentConfiguration createDeploymentConfiguration( + protected ServletService createServletService( ApplicationConfiguration applicationConfiguration) { - return new ServletDeploymentConfiguration(this, - applicationConfiguration); + return new ServletService(this, applicationConfiguration); } @Override @@ -393,7 +391,7 @@ public class VaadinServlet extends HttpServlet implements Constants { private WrappedHttpServletResponse createWrappedResponse( HttpServletResponse response) { WrappedHttpServletResponse wrappedResponse = new WrappedHttpServletResponse( - response, getDeploymentConfiguration()); + response, getVaadinService()); return wrappedResponse; } @@ -407,8 +405,7 @@ public class VaadinServlet extends HttpServlet implements Constants { */ protected WrappedHttpServletRequest createWrappedRequest( HttpServletRequest request) { - return new WrappedHttpServletRequest(request, - getDeploymentConfiguration()); + return new WrappedHttpServletRequest(request, getVaadinService()); } /** @@ -416,8 +413,8 @@ public class VaadinServlet extends HttpServlet implements Constants { * * @return the deployment configuration */ - protected DeploymentConfiguration getDeploymentConfiguration() { - return deploymentConfiguration; + protected ServletService getVaadinService() { + return servletService; } /** @@ -443,7 +440,7 @@ public class VaadinServlet extends HttpServlet implements Constants { // This can be removed if cookieless mode (#3228) is supported if (request.getRequestedSessionId() == null) { // User has cookies disabled - SystemMessages systemMessages = getDeploymentConfiguration() + SystemMessages systemMessages = getVaadinService() .getSystemMessages(); criticalNotification(request, response, systemMessages.getCookiesDisabledCaption(), @@ -645,7 +642,7 @@ public class VaadinServlet extends HttpServlet implements Constants { Locale locale = request.getLocale(); newApplication.setLocale(locale); newApplication.start(new ApplicationStartEvent(applicationUrl, - getDeploymentConfiguration().getApplicationConfiguration(), + getVaadinService().getApplicationConfiguration(), createCommunicationManager(newApplication))); addonContext.fireApplicationStarted(newApplication); @@ -728,7 +725,7 @@ public class VaadinServlet extends HttpServlet implements Constants { try { ServletPortletHelper.initDefaultUIProvider(newApplication, - getDeploymentConfiguration()); + getVaadinService()); } catch (ApplicationClassException e) { throw new ServletException(e); } @@ -741,8 +738,7 @@ public class VaadinServlet extends HttpServlet implements Constants { Throwable e) throws IOException, ServletException { // if this was an UIDL request, response UIDL back to client if (getRequestType(request) == RequestType.UIDL) { - SystemMessages ci = getDeploymentConfiguration() - .getSystemMessages(); + SystemMessages ci = getVaadinService().getSystemMessages(); criticalNotification(request, response, ci.getInternalErrorCaption(), ci.getInternalErrorMessage(), null, ci.getInternalErrorURL()); @@ -805,8 +801,7 @@ public class VaadinServlet extends HttpServlet implements Constants { } try { - SystemMessages ci = getDeploymentConfiguration() - .getSystemMessages(); + SystemMessages ci = getVaadinService().getSystemMessages(); if (getRequestType(request) != RequestType.UIDL) { // 'plain' http req - e.g. browser reload; // just go ahead redirect the browser @@ -848,8 +843,7 @@ public class VaadinServlet extends HttpServlet implements Constants { } try { - SystemMessages ci = getDeploymentConfiguration() - .getSystemMessages(); + SystemMessages ci = getVaadinService().getSystemMessages(); if (getRequestType(request) != RequestType.UIDL) { // 'plain' http req - e.g. browser reload; // just go ahead redirect the browser @@ -931,8 +925,8 @@ public class VaadinServlet extends HttpServlet implements Constants { // strip leading "/" otherwise stream from JAR wont work filename = filename.substring(1); - resourceUrl = getDeploymentConfiguration().getClassLoader() - .getResource(filename); + resourceUrl = getVaadinService().getClassLoader().getResource( + filename); if (resourceUrl == null) { // cannot serve requested file @@ -1013,7 +1007,7 @@ public class VaadinServlet extends HttpServlet implements Constants { * cache timeout can be configured by setting the resourceCacheTime * parameter in web.xml */ - int resourceCacheTime = getDeploymentConfiguration() + int resourceCacheTime = getVaadinService() .getApplicationConfiguration().getResourceCacheTime(); response.setHeader("Cache-Control", "max-age= " + String.valueOf(resourceCacheTime)); diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java index 440fc02ee6..c4b0680c47 100644 --- a/server/src/com/vaadin/server/VaadinSession.java +++ b/server/src/com/vaadin/server/VaadinSession.java @@ -1343,10 +1343,10 @@ public class VaadinSession implements Terminal.ErrorListener, * <p> * The default implementation in {@link VaadinSession} uses the * {@value #UI_PARAMETER} parameter from web.xml for finding the name of the - * UI class. If {@link DeploymentConfiguration#getClassLoader()} does not - * return <code>null</code>, the returned {@link ClassLoader} is used for - * loading the UI class. Otherwise the {@link ClassLoader} used to load this - * class is used. + * UI class. If {@link VaadinService#getClassLoader()} does not return + * <code>null</code>, the returned {@link ClassLoader} is used for loading + * the UI class. Otherwise the {@link ClassLoader} used to load this class + * is used. * * </p> * @@ -1885,7 +1885,7 @@ public class VaadinSession implements Terminal.ErrorListener, * * @see #getUidlRequestTimeout() * @see #closeInactiveUIs() - * @see DeploymentConfiguration#getHeartbeatInterval() + * @see ApplicationConfiguration#getHeartbeatInterval() * * @since 7.0.0 * @@ -1907,7 +1907,7 @@ public class VaadinSession implements Terminal.ErrorListener, * otherwise heartbeat requests are enough to extend UI lifetime * indefinitely. * - * @see DeploymentConfiguration#isIdleUICleanupEnabled() + * @see ApplicationConfiguration#isIdleUICleanupEnabled() * @see #getHeartbeatTimeout() * @see #closeInactiveUIs() * diff --git a/server/src/com/vaadin/server/WrappedHttpServletRequest.java b/server/src/com/vaadin/server/WrappedHttpServletRequest.java index e86166545a..7b458dd3d4 100644 --- a/server/src/com/vaadin/server/WrappedHttpServletRequest.java +++ b/server/src/com/vaadin/server/WrappedHttpServletRequest.java @@ -19,6 +19,8 @@ package com.vaadin.server; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; +import com.vaadin.server.VaadinServlet.ServletService; + /** * Wrapper for {@link HttpServletRequest}. * @@ -31,7 +33,7 @@ import javax.servlet.http.HttpServletRequestWrapper; public class WrappedHttpServletRequest extends HttpServletRequestWrapper implements WrappedRequest { - private final DeploymentConfiguration deploymentConfiguration; + private final ServletService vaadinService; /** * Wraps a http servlet request and associates with a deployment @@ -39,13 +41,13 @@ public class WrappedHttpServletRequest extends HttpServletRequestWrapper * * @param request * the http servlet request to wrap - * @param deploymentConfiguration - * the associated deployment configuration + * @param vaadinService + * the associated vaadin service */ public WrappedHttpServletRequest(HttpServletRequest request, - DeploymentConfiguration deploymentConfiguration) { + ServletService vaadinService) { super(request); - this.deploymentConfiguration = deploymentConfiguration; + this.vaadinService = vaadinService; } @Override @@ -68,8 +70,8 @@ public class WrappedHttpServletRequest extends HttpServletRequestWrapper } @Override - public DeploymentConfiguration getDeploymentConfiguration() { - return deploymentConfiguration; + public ServletService getVaadinService() { + return vaadinService; } @Override diff --git a/server/src/com/vaadin/server/WrappedHttpServletResponse.java b/server/src/com/vaadin/server/WrappedHttpServletResponse.java index f2916ac0eb..5fbfa451d8 100644 --- a/server/src/com/vaadin/server/WrappedHttpServletResponse.java +++ b/server/src/com/vaadin/server/WrappedHttpServletResponse.java @@ -19,6 +19,8 @@ package com.vaadin.server; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; +import com.vaadin.server.VaadinServlet.ServletService; + /** * Wrapper for {@link HttpServletResponse}. * @@ -31,20 +33,20 @@ import javax.servlet.http.HttpServletResponseWrapper; public class WrappedHttpServletResponse extends HttpServletResponseWrapper implements WrappedResponse { - private DeploymentConfiguration deploymentConfiguration; + private ServletService vaadinService; /** * Wraps a http servlet response and an associated deployment configuration * * @param response * the http servlet response to wrap - * @param deploymentConfiguration - * the associated deployment configuration + * @param vaadinService + * the associated vaadin service */ public WrappedHttpServletResponse(HttpServletResponse response, - DeploymentConfiguration deploymentConfiguration) { + ServletService vaadinService) { super(response); - this.deploymentConfiguration = deploymentConfiguration; + this.vaadinService = vaadinService; } /** @@ -78,7 +80,7 @@ public class WrappedHttpServletResponse extends HttpServletResponseWrapper } @Override - public DeploymentConfiguration getDeploymentConfiguration() { - return deploymentConfiguration; + public ServletService getVaadinService() { + return vaadinService; } }
\ No newline at end of file diff --git a/server/src/com/vaadin/server/WrappedPortletRequest.java b/server/src/com/vaadin/server/WrappedPortletRequest.java index 65099add76..bea002181b 100644 --- a/server/src/com/vaadin/server/WrappedPortletRequest.java +++ b/server/src/com/vaadin/server/WrappedPortletRequest.java @@ -25,6 +25,7 @@ import javax.portlet.ClientDataRequest; import javax.portlet.PortletRequest; import javax.portlet.ResourceRequest; +import com.vaadin.server.VaadinPortlet.PortletService; import com.vaadin.shared.ApplicationConstants; /** @@ -39,20 +40,20 @@ import com.vaadin.shared.ApplicationConstants; public class WrappedPortletRequest implements WrappedRequest { private final PortletRequest request; - private final DeploymentConfiguration deploymentConfiguration; + private final PortletService vaadinService; /** * Wraps a portlet request and an associated deployment configuration * * @param request * the portlet request to wrap - * @param deploymentConfiguration - * the associated deployment configuration + * @param vaadinService + * the associated vaadin service */ public WrappedPortletRequest(PortletRequest request, - DeploymentConfiguration deploymentConfiguration) { + PortletService vaadinService) { this.request = request; - this.deploymentConfiguration = deploymentConfiguration; + this.vaadinService = vaadinService; } @Override @@ -190,8 +191,8 @@ public class WrappedPortletRequest implements WrappedRequest { } @Override - public DeploymentConfiguration getDeploymentConfiguration() { - return deploymentConfiguration; + public PortletService getVaadinService() { + return vaadinService; } /** diff --git a/server/src/com/vaadin/server/WrappedPortletResponse.java b/server/src/com/vaadin/server/WrappedPortletResponse.java index e3010501b6..af4288fbef 100644 --- a/server/src/com/vaadin/server/WrappedPortletResponse.java +++ b/server/src/com/vaadin/server/WrappedPortletResponse.java @@ -29,7 +29,7 @@ import javax.portlet.MimeResponse; import javax.portlet.PortletResponse; import javax.portlet.ResourceResponse; -import com.vaadin.server.VaadinPortlet.PortletDeploymentConfiguration; +import com.vaadin.server.VaadinPortlet.PortletService; /** * Wrapper for {@link PortletResponse} and its subclasses. @@ -48,20 +48,20 @@ public class WrappedPortletResponse implements WrappedResponse { } private final PortletResponse response; - private PortletDeploymentConfiguration deploymentConfiguration; + private PortletService vaadinService; /** * Wraps a portlet response and an associated deployment configuration * * @param response * the portlet response to wrap - * @param deploymentConfiguration - * the associated deployment configuration + * @param vaadinService + * the associated vaadin service */ public WrappedPortletResponse(PortletResponse response, - PortletDeploymentConfiguration deploymentConfiguration) { + PortletService vaadinService) { this.response = response; - this.deploymentConfiguration = deploymentConfiguration; + this.vaadinService = vaadinService; } @Override @@ -116,7 +116,7 @@ public class WrappedPortletResponse implements WrappedResponse { } @Override - public PortletDeploymentConfiguration getDeploymentConfiguration() { - return deploymentConfiguration; + public PortletService getVaadinService() { + return vaadinService; } }
\ No newline at end of file diff --git a/server/src/com/vaadin/server/WrappedRequest.java b/server/src/com/vaadin/server/WrappedRequest.java index 5d7ece9ef1..9bd296130f 100644 --- a/server/src/com/vaadin/server/WrappedRequest.java +++ b/server/src/com/vaadin/server/WrappedRequest.java @@ -246,12 +246,12 @@ public interface WrappedRequest extends Serializable { public String getHeader(String headerName); /** - * Gets the deployment configuration for the context of this request. + * Gets the vaadin service for the context of this request. * - * @return the deployment configuration + * @return the vaadin service * - * @see DeploymentConfiguration + * @see VaadinService */ - public DeploymentConfiguration getDeploymentConfiguration(); + public VaadinService getVaadinService(); } diff --git a/server/src/com/vaadin/server/WrappedResponse.java b/server/src/com/vaadin/server/WrappedResponse.java index c8d9342418..90c9a356e1 100644 --- a/server/src/com/vaadin/server/WrappedResponse.java +++ b/server/src/com/vaadin/server/WrappedResponse.java @@ -149,11 +149,11 @@ public interface WrappedResponse extends Serializable { public void sendError(int errorCode, String message) throws IOException; /** - * Gets the deployment configuration for the context of this response. + * Gets the vaadin service for the context of this response. * - * @return the deployment configuration + * @return the vaadin service * - * @see DeploymentConfiguration + * @see VaadinService */ - public DeploymentConfiguration getDeploymentConfiguration(); + public VaadinService getVaadinService(); } diff --git a/server/tests/src/com/vaadin/data/util/AbstractBeanContainerTest.java b/server/tests/src/com/vaadin/data/util/AbstractBeanContainerTest.java index d393f1c9b2..1e663afdd2 100644 --- a/server/tests/src/com/vaadin/data/util/AbstractBeanContainerTest.java +++ b/server/tests/src/com/vaadin/data/util/AbstractBeanContainerTest.java @@ -1,6 +1,5 @@ package com.vaadin.data.util; - /** * Automated test for {@link AbstractBeanContainer}. * diff --git a/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java b/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java index 2aa8d04364..e6d84a2b83 100644 --- a/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java +++ b/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java @@ -14,7 +14,7 @@ import javax.servlet.http.HttpServletRequest; import junit.framework.TestCase; import com.vaadin.DefaultApplicationConfiguration; -import com.vaadin.server.VaadinServlet.ServletDeploymentConfiguration; +import com.vaadin.server.VaadinServlet.ServletService; public class TestAbstractApplicationServletStaticFilesLocation extends TestCase { @@ -32,7 +32,7 @@ public class TestAbstractApplicationServletStaticFilesLocation extends TestCase Field f = VaadinServlet.class .getDeclaredField("deploymentConfiguration"); f.setAccessible(true); - f.set(servlet, new ServletDeploymentConfiguration(servlet, + f.set(servlet, new ServletService(servlet, new DefaultApplicationConfiguration(servlet.getClass(), new Properties()))); @@ -80,8 +80,8 @@ public class TestAbstractApplicationServletStaticFilesLocation extends TestCase // Set request into replay mode replay(request); - String location = servlet.getDeploymentConfiguration() - .getStaticFileLocation(servlet.createWrappedRequest(request)); + String location = servlet.getVaadinService().getStaticFileLocation( + servlet.createWrappedRequest(request)); return location; } @@ -93,8 +93,8 @@ public class TestAbstractApplicationServletStaticFilesLocation extends TestCase // Set request into replay mode replay(request); - String location = servlet.getDeploymentConfiguration() - .getStaticFileLocation(servlet.createWrappedRequest(request)); + String location = servlet.getVaadinService().getStaticFileLocation( + servlet.createWrappedRequest(request)); return location; } diff --git a/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java b/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java index c41183daf3..2b4676bc42 100644 --- a/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java +++ b/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java @@ -11,7 +11,7 @@ import org.easymock.EasyMock; import com.vaadin.DefaultApplicationConfiguration; import com.vaadin.server.ApplicationConfiguration; import com.vaadin.server.DefaultUIProvider; -import com.vaadin.server.DeploymentConfiguration; +import com.vaadin.server.VaadinService; import com.vaadin.server.VaadinSession; import com.vaadin.server.VaadinSession.ApplicationStartEvent; import com.vaadin.server.WrappedRequest; @@ -73,14 +73,14 @@ public class CustomUIClassLoader extends TestCase { private static WrappedRequest createRequestMock(ClassLoader classloader) { // Mock a DeploymentConfiguration to give the passed classloader - DeploymentConfiguration configurationMock = EasyMock - .createMock(DeploymentConfiguration.class); + VaadinService configurationMock = EasyMock + .createMock(VaadinService.class); EasyMock.expect(configurationMock.getClassLoader()).andReturn( classloader); // Mock a WrappedRequest to give the mocked deployment configuration WrappedRequest requestMock = EasyMock.createMock(WrappedRequest.class); - EasyMock.expect(requestMock.getDeploymentConfiguration()).andReturn( + EasyMock.expect(requestMock.getVaadinService()).andReturn( configurationMock); EasyMock.replay(configurationMock, requestMock); diff --git a/shared/src/com/vaadin/shared/ui/link/LinkConstants.java b/shared/src/com/vaadin/shared/ui/link/LinkConstants.java index 80768a073b..4752cb0d51 100644 --- a/shared/src/com/vaadin/shared/ui/link/LinkConstants.java +++ b/shared/src/com/vaadin/shared/ui/link/LinkConstants.java @@ -16,7 +16,6 @@ package com.vaadin.shared.ui.link; - public class LinkConstants { public static String HREF_RESOURCE = "href"; } diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java index 675fa4e319..230a7b9230 100644 --- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java +++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java @@ -61,8 +61,7 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { Collections.addAll(defaultPackages, initParameter.split(",")); } String str = TestBase.class.getName().replace('.', '/') + ".class"; - URL url = getDeploymentConfiguration().getClassLoader() - .getResource(str); + URL url = getVaadinService().getClassLoader().getResource(str); if ("file".equals(url.getProtocol())) { File comVaadinTests = new File(url.getPath()).getParentFile() .getParentFile(); @@ -270,10 +269,9 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { } @Override - protected ServletDeploymentConfiguration createDeploymentConfiguration( + protected ServletService createServletService( ApplicationConfiguration applicationConfiguration) { - return new ServletDeploymentConfiguration(this, - applicationConfiguration) { + return new ServletService(this, applicationConfiguration) { @Override public String getStaticFileLocation(WrappedRequest request) { URIS uris = getApplicationRunnerURIs(WrappedHttpServletRequest @@ -291,8 +289,7 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { @Override protected WrappedHttpServletRequest createWrappedRequest( HttpServletRequest request) { - return new WrappedHttpServletRequest(request, - getDeploymentConfiguration()) { + return new WrappedHttpServletRequest(request, getVaadinService()) { @Override public String getRequestPathInfo() { return ApplicationRunnerServlet.this.getRequestPathInfo(this); diff --git a/uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java b/uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java index 45552df39c..c102291b50 100644 --- a/uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java +++ b/uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java @@ -27,7 +27,7 @@ public class NonExistingFileResource extends TestBase { @Override public void buttonClick(ClickEvent event) { FileResource res = new FileResource(new File(CurrentInstance - .get(WrappedRequest.class).getDeploymentConfiguration() + .get(WrappedRequest.class).getVaadinService() .getBaseDirectory() + "/" + filename)); getMainWindow().open(res); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1975.java b/uitest/src/com/vaadin/tests/tickets/Ticket1975.java index 93ecf4b6eb..e2804e9c3c 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1975.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1975.java @@ -48,8 +48,7 @@ public class Ticket1975 extends Application { })); File baseDir = CurrentInstance.get(WrappedRequest.class) - .getDeploymentConfiguration().getBaseDirectory() - .getAbsoluteFile(); + .getVaadinService().getBaseDirectory().getAbsoluteFile(); File f = new File(baseDir + "/VAADIN/themes/" + getTheme() + "/layouts/Ticket1975.html"); diff --git a/uitest/src/com/vaadin/tests/util/SampleDirectory.java b/uitest/src/com/vaadin/tests/util/SampleDirectory.java index be98de67cc..609606b501 100644 --- a/uitest/src/com/vaadin/tests/util/SampleDirectory.java +++ b/uitest/src/com/vaadin/tests/util/SampleDirectory.java @@ -49,7 +49,7 @@ public class SampleDirectory { + "possible security constraint with Application " + "Server or Servlet Container.<br />"; File file = CurrentInstance.get(WrappedRequest.class) - .getDeploymentConfiguration().getBaseDirectory(); + .getVaadinService().getBaseDirectory(); if ((file == null) || (!file.canRead()) || (file.getAbsolutePath() == null)) { // cannot access example directory, possible security issue with |