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 0f37194c05..b0a2b66e83 100644 --- a/spring-core/src/main/java/org/springframework/util/ResourceUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ResourceUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,6 +63,9 @@ public abstract class ResourceUtils { /** URL protocol for an entry from a jar file: "jar" */ public static final String URL_PROTOCOL_JAR = "jar"; + /** URL protocol for an entry from a war file: "war" */ + public static final String URL_PROTOCOL_WAR = "war"; + /** URL protocol for an entry from a zip file: "zip" */ public static final String URL_PROTOCOL_ZIP = "zip"; @@ -258,7 +261,7 @@ public abstract class ResourceUtils { /** * Determine whether the given URL points to a resource in the file system, - * that is, has protocol "file", "vfsfile" or "vfs". + * i.e. has protocol "file", "vfsfile" or "vfs". * @param url the URL to check * @return whether the URL has been identified as a file system URL */ @@ -269,15 +272,16 @@ public abstract class ResourceUtils { } /** - * Determine whether the given URL points to a resource in a jar file, - * that is, has protocol "jar", "zip", "vfszip" or "wsjar". + * Determine whether the given URL points to a resource in a jar file. + * i.e. has protocol "jar", "war, ""zip", "vfszip" or "wsjar". * @param url the URL to check * @return whether the URL has been identified as a JAR URL */ public static boolean isJarURL(URL url) { String protocol = url.getProtocol(); - return (URL_PROTOCOL_JAR.equals(protocol) || URL_PROTOCOL_ZIP.equals(protocol) || - URL_PROTOCOL_VFSZIP.equals(protocol) || URL_PROTOCOL_WSJAR.equals(protocol)); + return (URL_PROTOCOL_JAR.equals(protocol) || URL_PROTOCOL_WAR.equals(protocol) || + URL_PROTOCOL_ZIP.equals(protocol) || URL_PROTOCOL_VFSZIP.equals(protocol) || + URL_PROTOCOL_WSJAR.equals(protocol)); } /**