diff --git a/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java b/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java index 593ac7dedfb..72b0c481153 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java @@ -340,12 +340,12 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol Set result = new LinkedHashSet(16); for (Resource rootDirResource : rootDirResources) { rootDirResource = resolveRootDirResource(rootDirResource); - if (isJarResource(rootDirResource)) { - result.addAll(doFindPathMatchingJarResources(rootDirResource, subPattern)); - } - else if (rootDirResource.getURL().getProtocol().startsWith(ResourceUtils.URL_PROTOCOL_VFS)) { + if (rootDirResource.getURL().getProtocol().startsWith(ResourceUtils.URL_PROTOCOL_VFS)) { result.addAll(VfsResourceMatchingDelegate.findMatchingResources(rootDirResource, subPattern, getPathMatcher())); } + else if (isJarResource(rootDirResource)) { + result.addAll(doFindPathMatchingJarResources(rootDirResource, subPattern)); + } else { result.addAll(doFindPathMatchingFileResources(rootDirResource, subPattern)); } diff --git a/spring-core/src/main/java/org/springframework/util/ResourceUtils.java b/spring-core/src/main/java/org/springframework/util/ResourceUtils.java index 3c2b320099f..ce552eb0bce 100644 --- a/spring-core/src/main/java/org/springframework/util/ResourceUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ResourceUtils.java @@ -72,7 +72,10 @@ public abstract class ResourceUtils { /** URL protocol for an entry from a JBoss jar file: "vfszip" */ public static final String URL_PROTOCOL_VFSZIP = "vfszip"; - /** URL protocol for a JBoss VFS resource: "vfs" */ + /** URL protocol for a JBoss file system resource: "vfsfile" */ + public static final String URL_PROTOCOL_VFSFILE = "vfsfile"; + + /** URL protocol for a general JBoss VFS resource: "vfs" */ public static final String URL_PROTOCOL_VFS = "vfs"; /** URL protocol for an entry from an OC4J jar file: "code-source" */ @@ -251,18 +254,19 @@ public abstract class ResourceUtils { /** * Determine whether the given URL points to a resource in the file system, - * that is, has protocol "file" or "vfs". + * that is, has protocol "file", "vfsfile" or "vfs". * @param url the URL to check * @return whether the URL has been identified as a file system URL */ public static boolean isFileURL(URL url) { String protocol = url.getProtocol(); - return (URL_PROTOCOL_FILE.equals(protocol) || URL_PROTOCOL_VFS.equals(protocol)); + return (URL_PROTOCOL_FILE.equals(protocol) || URL_PROTOCOL_VFSFILE.equals(protocol) || + URL_PROTOCOL_VFS.equals(protocol)); } /** * Determine whether the given URL points to a resource in a jar file, - * that is, has protocol "jar", "zip", "wsjar" or "code-source". + * that is, has protocol "jar", "zip", "vfszip", "wsjar" or "code-source". *

"zip" and "wsjar" are used by WebLogic Server and WebSphere, respectively, * but can be treated like jar files. The same applies to "code-source" URLs on * OC4J, provided that the path contains a jar separator. @@ -272,7 +276,7 @@ public abstract class ResourceUtils { public static boolean isJarURL(URL url) { String protocol = url.getProtocol(); return (URL_PROTOCOL_JAR.equals(protocol) || URL_PROTOCOL_ZIP.equals(protocol) || - URL_PROTOCOL_WSJAR.equals(protocol) || URL_PROTOCOL_VFSZIP.equals(protocol) || + URL_PROTOCOL_VFSZIP.equals(protocol) || URL_PROTOCOL_WSJAR.equals(protocol) || (URL_PROTOCOL_CODE_SOURCE.equals(protocol) && url.getPath().contains(JAR_URL_SEPARATOR))); }