diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-10-05 12:02:51 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2012-10-09 07:30:12 +0000 |
commit | a6adae7e6b154010a34b36a8ddae068a0967d7b8 (patch) | |
tree | 941011fb3baefcdd978a75794a93be1db6208c75 /server | |
parent | b497019a356105abc6fee9552d1b1b2ebacf78c0 (diff) | |
download | vaadin-framework-a6adae7e6b154010a34b36a8ddae068a0967d7b8.tar.gz vaadin-framework-a6adae7e6b154010a34b36a8ddae068a0967d7b8.zip |
Rename connector resource -> dependency resource (#9691)
Change-Id: If263c3e9eb3d2221ae7a7ca39c5bc05f2c8c14d9
Diffstat (limited to 'server')
4 files changed, 38 insertions, 38 deletions
diff --git a/server/src/com/vaadin/server/AbstractCommunicationManager.java b/server/src/com/vaadin/server/AbstractCommunicationManager.java index 5852ff2a93..cb41f9338b 100644 --- a/server/src/com/vaadin/server/AbstractCommunicationManager.java +++ b/server/src/com/vaadin/server/AbstractCommunicationManager.java @@ -164,7 +164,7 @@ public abstract class AbstractCommunicationManager implements Serializable { private Connector highlightedConnector; - private Map<String, Class<?>> connectorResourceContexts = new HashMap<String, Class<?>>(); + private Map<String, Class<?>> dependencyResourceContexts = new HashMap<String, Class<?>>(); private Map<String, Map<String, StreamVariable>> pidToNameToStreamVariable; @@ -1205,7 +1205,7 @@ public abstract class AbstractCommunicationManager implements Serializable { .getAnnotation(JavaScript.class); if (jsAnnotation != null) { for (String resource : jsAnnotation.value()) { - scriptDependencies.add(registerResource(resource, + scriptDependencies.add(registerDependency(resource, class1)); } } @@ -1214,8 +1214,8 @@ public abstract class AbstractCommunicationManager implements Serializable { .getAnnotation(StyleSheet.class); if (styleAnnotation != null) { for (String resource : styleAnnotation.value()) { - styleDependencies - .add(registerResource(resource, class1)); + styleDependencies.add(registerDependency(resource, + class1)); } } } @@ -1285,27 +1285,27 @@ public abstract class AbstractCommunicationManager implements Serializable { } /** - * Resolves a resource URI, registering the URI with this + * Resolves a dependency URI, registering the URI with this * {@code AbstractCommunicationManager} if needed and returns a fully * qualified URI. */ - private String registerResource(String resourceUri, Class<?> context) { + private String registerDependency(String resourceUri, Class<?> context) { try { URI uri = new URI(resourceUri); String protocol = uri.getScheme(); - if ("connector".equals(protocol)) { + if (ApplicationConstants.DEPENDENCY_PROTOCOL_NAME.equals(protocol)) { // Strip initial slash String resourceName = uri.getPath().substring(1); - return registerConnectorResource(resourceName, context); + return registerDependencyResource(resourceName, context); } if (protocol != null || uri.getHost() != null) { return resourceUri; } - // Bare path interpreted as connector resource - return registerConnectorResource(resourceUri, context); + // Bare path interpreted as dependency resource + return registerDependencyResource(resourceUri, context); } catch (URISyntaxException e) { getLogger().log(Level.WARNING, "Could not parse resource url " + resourceUri, e); @@ -1313,23 +1313,23 @@ public abstract class AbstractCommunicationManager implements Serializable { } } - private String registerConnectorResource(String name, Class<?> context) { - synchronized (connectorResourceContexts) { - // Add to map of names accepted by serveConnectorResource - if (connectorResourceContexts.containsKey(name)) { - Class<?> oldContext = connectorResourceContexts.get(name); + private String registerDependencyResource(String name, Class<?> context) { + synchronized (dependencyResourceContexts) { + // Add to map of names accepted by serveDependencyResource + if (dependencyResourceContexts.containsKey(name)) { + Class<?> oldContext = dependencyResourceContexts.get(name); if (oldContext != context) { getLogger().warning( - "Resource " + name + " defined by both " + context - + " and " + oldContext + ". Resource from " + "Dependency " + name + " defined by both " + context + + " and " + oldContext + ". Dependency from " + oldContext + " will be used."); } } else { - connectorResourceContexts.put(name, context); + dependencyResourceContexts.put(name, context); } } - return ApplicationConstants.CONNECTOR_PROTOCOL_PREFIX + "/" + name; + return ApplicationConstants.DEPENDENCY_PROTOCOL_PREFIX + "/" + name; } /** @@ -2588,7 +2588,7 @@ public abstract class AbstractCommunicationManager implements Serializable { /** * Serve a connector resource from the classpath if the resource has * previously been registered by calling - * {@link #registerResource(String, Class)}. Sending arbitrary files from + * {@link #registerDependency(String, Class)}. Sending arbitrary files from * the classpath is prevented by only accepting resource names that have * explicitly been registered. Resources can currently only be registered by * including a {@link JavaScript} or {@link StyleSheet} annotation on a @@ -2599,13 +2599,13 @@ public abstract class AbstractCommunicationManager implements Serializable { * * @throws IOException */ - public void serveConnectorResource(VaadinRequest request, + public void serveDependencyResource(VaadinRequest request, VaadinResponse response) throws IOException { String pathInfo = request.getRequestPathInfo(); // + 2 to also remove beginning and ending slashes String resourceName = pathInfo - .substring(ApplicationConstants.CONNECTOR_RESOURCE_PREFIX + .substring(ApplicationConstants.DEPENDENCY_RESOURCE_PREFIX .length() + 2); final String mimetype = response.getService().getMimeType(resourceName); @@ -2614,7 +2614,7 @@ public abstract class AbstractCommunicationManager implements Serializable { // classpath instead of relative to the context class if (resourceName.startsWith("/")) { getLogger().warning( - "Connector resource request starting with / rejected: " + "Dependency resource request starting with / rejected: " + resourceName); response.sendError(HttpServletResponse.SC_NOT_FOUND, resourceName); return; @@ -2622,15 +2622,15 @@ public abstract class AbstractCommunicationManager implements Serializable { // Check that the resource name has been registered Class<?> context; - synchronized (connectorResourceContexts) { - context = connectorResourceContexts.get(resourceName); + synchronized (dependencyResourceContexts) { + context = dependencyResourceContexts.get(resourceName); } // Security check: don't serve resource if the name hasn't been // registered in the map if (context == null) { getLogger().warning( - "Connector resource request for unknown resource rejected: " + "Dependency resource request for unknown resource rejected: " + resourceName); response.sendError(HttpServletResponse.SC_NOT_FOUND, resourceName); return; diff --git a/server/src/com/vaadin/server/ServletPortletHelper.java b/server/src/com/vaadin/server/ServletPortletHelper.java index ab03e0cc06..59c0b382c9 100644 --- a/server/src/com/vaadin/server/ServletPortletHelper.java +++ b/server/src/com/vaadin/server/ServletPortletHelper.java @@ -101,9 +101,9 @@ class ServletPortletHelper implements Serializable { return hasPathPrefix(request, UPLOAD_URL_PREFIX); } - public static boolean isConnectorResourceRequest(VaadinRequest request) { + public static boolean isDependencyResourceRequest(VaadinRequest request) { return hasPathPrefix(request, - ApplicationConstants.CONNECTOR_RESOURCE_PREFIX + "/"); + ApplicationConstants.DEPENDENCY_RESOURCE_PREFIX + "/"); } public static boolean isUIDLRequest(VaadinRequest request) { diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index db1425ba12..b18eff2f09 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -284,7 +284,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { */ @Deprecated protected enum RequestType { - FILE_UPLOAD, UIDL, RENDER, STATIC_FILE, APP, DUMMY, EVENT, ACTION, UNKNOWN, BROWSER_DETAILS, CONNECTOR_RESOURCE, HEARTBEAT; + FILE_UPLOAD, UIDL, RENDER, STATIC_FILE, APP, DUMMY, EVENT, ACTION, UNKNOWN, BROWSER_DETAILS, DEPENDENCY_RESOURCE, HEARTBEAT; } /** @@ -307,8 +307,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants { } else if (ServletPortletHelper.isFileUploadRequest(vaadinRequest)) { return RequestType.FILE_UPLOAD; } else if (ServletPortletHelper - .isConnectorResourceRequest(vaadinRequest)) { - return RequestType.CONNECTOR_RESOURCE; + .isDependencyResourceRequest(vaadinRequest)) { + return RequestType.DEPENDENCY_RESOURCE; } else if (ServletPortletHelper.isAppRequest(vaadinRequest)) { return RequestType.APP; } else if (ServletPortletHelper.isHeartbeatRequest(vaadinRequest)) { @@ -400,8 +400,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants { PortletCommunicationManager communicationManager = (PortletCommunicationManager) vaadinSession .getCommunicationManager(); - if (requestType == RequestType.CONNECTOR_RESOURCE) { - communicationManager.serveConnectorResource( + if (requestType == RequestType.DEPENDENCY_RESOURCE) { + communicationManager.serveDependencyResource( vaadinRequest, vaadinResponse); return; } else if (requestType == RequestType.HEARTBEAT) { diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index c4483b5f79..7673c2d2f7 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -262,8 +262,8 @@ public class VaadinServlet extends HttpServlet implements Constants { CommunicationManager communicationManager = (CommunicationManager) vaadinSession .getCommunicationManager(); - if (requestType == RequestType.CONNECTOR_RESOURCE) { - communicationManager.serveConnectorResource(request, response); + if (requestType == RequestType.DEPENDENCY_RESOURCE) { + communicationManager.serveDependencyResource(request, response); return; } else if (requestType == RequestType.HEARTBEAT) { communicationManager.handleHeartbeatRequest(request, response, @@ -1033,7 +1033,7 @@ public class VaadinServlet extends HttpServlet implements Constants { */ @Deprecated protected enum RequestType { - FILE_UPLOAD, BROWSER_DETAILS, UIDL, OTHER, STATIC_FILE, APP, CONNECTOR_RESOURCE, HEARTBEAT; + FILE_UPLOAD, BROWSER_DETAILS, UIDL, OTHER, STATIC_FILE, APP, DEPENDENCY_RESOURCE, HEARTBEAT; } /** @@ -1046,8 +1046,8 @@ public class VaadinServlet extends HttpServlet implements Constants { protected RequestType getRequestType(VaadinServletRequest request) { if (ServletPortletHelper.isFileUploadRequest(request)) { return RequestType.FILE_UPLOAD; - } else if (ServletPortletHelper.isConnectorResourceRequest(request)) { - return RequestType.CONNECTOR_RESOURCE; + } else if (ServletPortletHelper.isDependencyResourceRequest(request)) { + return RequestType.DEPENDENCY_RESOURCE; } else if (isBrowserDetailsRequest(request)) { return RequestType.BROWSER_DETAILS; } else if (ServletPortletHelper.isUIDLRequest(request)) { |