From: Leif Åstrand Date: Wed, 21 Nov 2012 12:22:44 +0000 (+0200) Subject: Remove slashes from beginning or end of constants (#10140) X-Git-Tag: 7.0.0.beta10~68 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fchanges%2F20%2F320%2F1;p=vaadin-framework.git Remove slashes from beginning or end of constants (#10140) * Also rename the constants to cause compile errors in 3rd party code Change-Id: If96c9956de7737345ec9372be28292b3490387a2 --- diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index ede16b8125..0dbc0984a7 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -681,7 +681,7 @@ public class ApplicationConnection { + requestData; VConsole.log("Making UIDL Request with params: " + payload); String uri = translateVaadinUri(ApplicationConstants.APP_PROTOCOL_PREFIX - + ApplicationConstants.UIDL_REQUEST_PATH); + + ApplicationConstants.UIDL_PATH + '/'); if (extraParams != null && extraParams.length() > 0) { uri = addGetParameters(uri, extraParams); @@ -3068,7 +3068,7 @@ public class ApplicationConnection { protected void sendHeartbeat() { final String uri = addGetParameters( translateVaadinUri(ApplicationConstants.APP_PROTOCOL_PREFIX - + ApplicationConstants.HEARTBEAT_REQUEST_PATH), + + ApplicationConstants.HEARTBEAT_PATH + '/'), UIConstants.UI_ID_PARAMETER + "=" + getConfiguration().getUIId()); diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java index 43fc6a5c70..13268c596c 100644 --- a/server/src/com/vaadin/server/BootstrapHandler.java +++ b/server/src/com/vaadin/server/BootstrapHandler.java @@ -487,7 +487,7 @@ public abstract class BootstrapHandler implements RequestHandler { VaadinRequest request = context.getRequest(); final String staticFilePath = request.getService() .getStaticFileLocation(request); - return staticFilePath + "/" + VaadinServlet.THEME_DIRECTORY_PATH + return staticFilePath + "/" + VaadinServlet.THEME_DIR_PATH + '/' + themeName; } diff --git a/server/src/com/vaadin/server/CommunicationManager.java b/server/src/com/vaadin/server/CommunicationManager.java index acc0e46c0c..1d8ef2d0e7 100644 --- a/server/src/com/vaadin/server/CommunicationManager.java +++ b/server/src/com/vaadin/server/CommunicationManager.java @@ -87,7 +87,7 @@ public class CommunicationManager extends AbstractCommunicationManager { ServletContext servletContext = service.getServlet() .getServletContext(); return servletContext.getResourceAsStream("/" - + VaadinServlet.THEME_DIRECTORY_PATH + themeName + "/" + + VaadinServlet.THEME_DIR_PATH + '/' + themeName + "/" + resource); } } diff --git a/server/src/com/vaadin/server/ConnectorResource.java b/server/src/com/vaadin/server/ConnectorResource.java index e696c35c0d..2cbc18bf58 100644 --- a/server/src/com/vaadin/server/ConnectorResource.java +++ b/server/src/com/vaadin/server/ConnectorResource.java @@ -26,7 +26,7 @@ package com.vaadin.server; * @since 7.0.0 */ public interface ConnectorResource extends Resource { - public static final String CONNECTOR_REQUEST_PATH = "connector/"; + public static final String CONNECTOR_PATH = "connector"; /** * Gets resource as stream. diff --git a/server/src/com/vaadin/server/ConnectorResourceHandler.java b/server/src/com/vaadin/server/ConnectorResourceHandler.java index 5cd218471c..b82c0e2ff8 100644 --- a/server/src/com/vaadin/server/ConnectorResourceHandler.java +++ b/server/src/com/vaadin/server/ConnectorResourceHandler.java @@ -14,8 +14,8 @@ import com.vaadin.ui.UI; public class ConnectorResourceHandler implements RequestHandler { // APP/connector/[uiid]/[cid]/[filename.xyz] private static final Pattern CONNECTOR_RESOURCE_PATTERN = Pattern - .compile("^/?" + ApplicationConstants.APP_REQUEST_PATH + '/' - + ConnectorResource.CONNECTOR_REQUEST_PATH + .compile("^/?" + ApplicationConstants.APP_PATH + '/' + + ConnectorResource.CONNECTOR_PATH + '/' + "(\\d+)/(\\d+)/(.*)"); private static Logger getLogger() { @@ -63,7 +63,7 @@ public class ConnectorResourceHandler implements RequestHandler { return true; } else if (requestPath.matches('/' - + ApplicationConstants.APP_REQUEST_PATH + "(/.*)?")) { + + ApplicationConstants.APP_PATH + "(/.*)?")) { /* * This should be the last request handler before we get to * bootstrap logic. Prevent /APP requests from reaching bootstrap diff --git a/server/src/com/vaadin/server/Constants.java b/server/src/com/vaadin/server/Constants.java index faf24b4bce..e63d7e7111 100644 --- a/server/src/com/vaadin/server/Constants.java +++ b/server/src/com/vaadin/server/Constants.java @@ -72,11 +72,11 @@ public interface Constants { static final int MAX_BUFFER_SIZE = 64 * 1024; - final String THEME_DIRECTORY_PATH = "VAADIN/themes/"; + final String THEME_DIR_PATH = "VAADIN/themes"; static final int DEFAULT_THEME_CACHETIME = 1000 * 60 * 60 * 24; - static final String WIDGETSET_DIRECTORY_PATH = "VAADIN/widgetsets/"; + static final String WIDGETSET_DIR_PATH = "VAADIN/widgetsets"; // Name of the default widget set, used if not specified in web.xml static final String DEFAULT_WIDGETSET = "com.vaadin.DefaultWidgetSet"; diff --git a/server/src/com/vaadin/server/GlobalResourceHandler.java b/server/src/com/vaadin/server/GlobalResourceHandler.java index 119f9cdae0..94505658c3 100644 --- a/server/src/com/vaadin/server/GlobalResourceHandler.java +++ b/server/src/com/vaadin/server/GlobalResourceHandler.java @@ -61,7 +61,7 @@ public class GlobalResourceHandler implements RequestHandler { // APP/global/[uiid]/[type]/[id] private static final Matcher matcher = Pattern.compile( - "^/?" + ApplicationConstants.APP_REQUEST_PATH + '/' + "^/?" + ApplicationConstants.APP_PATH + '/' + RESOURCE_REQUEST_PATH + "(\\d+)/(([^/]+)(/.*))").matcher( ""); @@ -189,7 +189,7 @@ public class GlobalResourceHandler implements RequestHandler { String uri = legacyResourceKeys.get(resource); if (uri != null && !uri.isEmpty()) { return ApplicationConstants.APP_PROTOCOL_PREFIX - + ApplicationConstants.APP_REQUEST_PATH + '/' + + ApplicationConstants.APP_PATH + '/' + RESOURCE_REQUEST_PATH + connector.getUI().getUIId() + '/' + uri; } else { diff --git a/server/src/com/vaadin/server/PortletCommunicationManager.java b/server/src/com/vaadin/server/PortletCommunicationManager.java index 0d63c4b8dc..ce67aedcb3 100644 --- a/server/src/com/vaadin/server/PortletCommunicationManager.java +++ b/server/src/com/vaadin/server/PortletCommunicationManager.java @@ -140,7 +140,7 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { PortletContext portletContext = session.getPortletSession() .getPortletContext(); return portletContext.getResourceAsStream("/" - + VaadinPortlet.THEME_DIRECTORY_PATH + themeName + "/" + + VaadinPortlet.THEME_DIR_PATH + '/' + themeName + "/" + resource); } diff --git a/server/src/com/vaadin/server/ResourceReference.java b/server/src/com/vaadin/server/ResourceReference.java index fbb8af89c1..94b9f1ac9a 100644 --- a/server/src/com/vaadin/server/ResourceReference.java +++ b/server/src/com/vaadin/server/ResourceReference.java @@ -78,8 +78,8 @@ public class ResourceReference extends URLReference { private static String getConnectorResourceBase(String filename, ClientConnector connector) { String uri = ApplicationConstants.APP_PROTOCOL_PREFIX - + ApplicationConstants.APP_REQUEST_PATH + '/' - + ConnectorResource.CONNECTOR_REQUEST_PATH + + ApplicationConstants.APP_PATH + '/' + + ConnectorResource.CONNECTOR_PATH + '/' + connector.getUI().getUIId() + '/' + connector.getConnectorId() + '/' + encodeFileName(filename); return uri; diff --git a/server/src/com/vaadin/server/ServletPortletHelper.java b/server/src/com/vaadin/server/ServletPortletHelper.java index be5fd1c287..cbedeabf51 100644 --- a/server/src/com/vaadin/server/ServletPortletHelper.java +++ b/server/src/com/vaadin/server/ServletPortletHelper.java @@ -106,17 +106,18 @@ class ServletPortletHelper implements Serializable { } public static boolean isUIDLRequest(VaadinRequest request) { - return hasPathPrefix(request, ApplicationConstants.UIDL_REQUEST_PATH); + return hasPathPrefix(request, + ApplicationConstants.UIDL_PATH + '/'); } public static boolean isAppRequest(VaadinRequest request) { return hasPathPrefix(request, - ApplicationConstants.APP_REQUEST_PATH + '/'); + ApplicationConstants.APP_PATH + '/'); } public static boolean isHeartbeatRequest(VaadinRequest request) { return hasPathPrefix(request, - ApplicationConstants.HEARTBEAT_REQUEST_PATH); + ApplicationConstants.HEARTBEAT_PATH + '/'); } public static void initDefaultUIProvider(VaadinSession session, diff --git a/server/src/com/vaadin/ui/LoginForm.java b/server/src/com/vaadin/ui/LoginForm.java index 9c131b9700..8e35b0b2ac 100644 --- a/server/src/com/vaadin/ui/LoginForm.java +++ b/server/src/com/vaadin/ui/LoginForm.java @@ -119,8 +119,8 @@ public class LoginForm extends CustomComponent { // Generate magic URL now when UI id and connectorId are known iframe.setSource(new ExternalResource( ApplicationConstants.APP_PROTOCOL_PREFIX - + ApplicationConstants.APP_REQUEST_PATH + '/' - + ConnectorResource.CONNECTOR_REQUEST_PATH + + ApplicationConstants.APP_PATH + '/' + + ConnectorResource.CONNECTOR_PATH + '/' + getUI().getUIId() + '/' + getConnectorId() + "/login")); super.beforeClientResponse(initial); } diff --git a/shared/src/com/vaadin/shared/ApplicationConstants.java b/shared/src/com/vaadin/shared/ApplicationConstants.java index a21a0d0b35..7b24ef732c 100644 --- a/shared/src/com/vaadin/shared/ApplicationConstants.java +++ b/shared/src/com/vaadin/shared/ApplicationConstants.java @@ -20,13 +20,13 @@ public class ApplicationConstants { // This indicates the whole page is generated by us (not embedded) public static final String GENERATED_BODY_CLASSNAME = "v-generated-body"; - public static final String APP_REQUEST_PATH = "APP"; + public static final String APP_PATH = "APP"; - public static final String UIDL_REQUEST_PATH = "UIDL/"; + public static final String UIDL_PATH = "UIDL"; - public static final String HEARTBEAT_REQUEST_PATH = "HEARTBEAT/"; + public static final String HEARTBEAT_PATH = "HEARTBEAT"; - public static final String PUBLISHED_FILE_PATH = APP_REQUEST_PATH + '/' + public static final String PUBLISHED_FILE_PATH = APP_PATH + '/' + "PUBLISHED"; public static final String APP_PROTOCOL_PREFIX = "app://";