diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaInfConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaInfConfiguration.java index 6e77a6d2813..ff0f95411c8 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaInfConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaInfConfiguration.java @@ -401,8 +401,9 @@ public class MetaInfConfiguration extends AbstractConfiguration public Collection getTlds (URI uri) throws IOException { HashSet tlds = new HashSet(); - - URL url = new URL("jar:"+uri+"!/"); + + String jarUri = uriJarPrefix(uri); + URL url = new URL(jarUri); JarURLConnection jarConn = (JarURLConnection) url.openConnection(); jarConn.setUseCaches(Resource.getDefaultUseCaches()); JarFile jarFile = jarConn.getJarFile(); @@ -413,11 +414,21 @@ public class MetaInfConfiguration extends AbstractConfiguration String name = e.getName(); if (name.startsWith("META-INF") && name.endsWith(".tld")) { - tlds.add(new URL("jar:"+uri+"!/"+name)); + tlds.add(new URL(jarUri + name)); } } if (!Resource.getDefaultUseCaches()) jarFile.close(); return tlds; } + + private String uriJarPrefix(URI uri) { + + String uriString = uri.toString(); + if (uriString.startsWith("jar:")) { + return uriString + "!/"; + } else { + return "jar:"+uriString+"!/"; + } + } }