MCPcopy Create free account
hub / github.com/apache/tomcat / warToJar

Method warToJar

java/org/apache/tomcat/util/buf/UriUtil.java:223–238  ·  view source on GitHub ↗

Convert a URL of the form war:file:... to jar:file:... . @param warUrl The WAR URL to convert @return The equivalent JAR URL @throws IOException If the conversion fails

(URL warUrl)

Source from the content-addressed store, hash-verified

221 * @throws IOException If the conversion fails
222 */
223 public static URL warToJar(URL warUrl) throws IOException {
224 // Assumes that the spec is absolute and starts war:file:/...
225 String file = warUrl.getFile();
226 if (file.contains("*/")) {
227 file = file.replaceFirst("\\*/", "!/");
228 } else if (PATTERN_CUSTOM != null) {
229 file = file.replaceFirst(PATTERN_CUSTOM.pattern(), "!/");
230 }
231 URI uri;
232 try {
233 uri = new URI("jar", file, null);
234 } catch (URISyntaxException e) {
235 throw new IOException(e);
236 }
237 return uri.toURL();
238 }
239
240
241 /**

Callers 4

doTestWarToJarMethod · 0.95
newInstanceMethod · 0.95
WarURLConnectionMethod · 0.95

Calls 2

containsMethod · 0.65
getFileMethod · 0.45

Tested by 1

doTestWarToJarMethod · 0.76