1
1
/*
2
- * Copyright 2002-2016 the original author or authors.
2
+ * Copyright 2002-2017 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
35
35
* object, which in turn allows one to obtain a {@code java.io.File} in the
36
36
* file system through its {@code getFile()} method.
37
37
*
38
- * <p>The main reason for these utility methods for resource location handling
39
- * is to support {@link Log4jConfigurer}, which must be able to resolve
40
- * resource locations <i>before the logging system has been initialized</i>.
41
- * Spring's {@code Resource} abstraction in the core package, on the other hand,
42
- * already expects the logging system to be available.
43
- *
44
38
* @author Juergen Hoeller
45
39
* @since 1.1.5
46
40
* @see org.springframework.core.io.Resource
@@ -69,6 +63,9 @@ public abstract class ResourceUtils {
69
63
/** URL protocol for an entry from a jar file: "jar" */
70
64
public static final String URL_PROTOCOL_JAR = "jar" ;
71
65
66
+ /** URL protocol for an entry from a war file: "war" */
67
+ public static final String URL_PROTOCOL_WAR = "war" ;
68
+
72
69
/** URL protocol for an entry from a zip file: "zip" */
73
70
public static final String URL_PROTOCOL_ZIP = "zip" ;
74
71
@@ -264,7 +261,7 @@ public static File getFile(URI resourceUri, String description) throws FileNotFo
264
261
265
262
/**
266
263
* Determine whether the given URL points to a resource in the file system,
267
- * that is, has protocol "file", "vfsfile" or "vfs".
264
+ * i.e. has protocol "file", "vfsfile" or "vfs".
268
265
* @param url the URL to check
269
266
* @return whether the URL has been identified as a file system URL
270
267
*/
@@ -275,15 +272,16 @@ public static boolean isFileURL(URL url) {
275
272
}
276
273
277
274
/**
278
- * Determine whether the given URL points to a resource in a jar file,
279
- * that is, has protocol "jar", "zip", "vfszip" or "wsjar".
275
+ * Determine whether the given URL points to a resource in a jar file.
276
+ * i.e. has protocol "jar", "war, " "zip", "vfszip" or "wsjar".
280
277
* @param url the URL to check
281
278
* @return whether the URL has been identified as a JAR URL
282
279
*/
283
280
public static boolean isJarURL (URL url ) {
284
281
String protocol = url .getProtocol ();
285
- return (URL_PROTOCOL_JAR .equals (protocol ) || URL_PROTOCOL_ZIP .equals (protocol ) ||
286
- URL_PROTOCOL_VFSZIP .equals (protocol ) || URL_PROTOCOL_WSJAR .equals (protocol ));
282
+ return (URL_PROTOCOL_JAR .equals (protocol ) || URL_PROTOCOL_WAR .equals (protocol ) ||
283
+ URL_PROTOCOL_ZIP .equals (protocol ) || URL_PROTOCOL_VFSZIP .equals (protocol ) ||
284
+ URL_PROTOCOL_WSJAR .equals (protocol ));
287
285
}
288
286
289
287
/**
0 commit comments