Merge remote-tracking branch 'origin/jetty-9.4.x'

This commit is contained in:
Jan Bartel 2016-06-10 12:32:08 +10:00
commit 11b85446e7
1 changed files with 16 additions and 5 deletions

View File

@ -291,7 +291,7 @@ public class MetaInfConfiguration extends AbstractConfiguration
{
//Resource represents a packed jar
URI uri = target.getURI();
resourcesDir = Resource.newResource("jar:"+uri+"!/META-INF/resources");
resourcesDir = Resource.newResource(uriJarPrefix(uri,"!/META-INF/resources"));
}
if (!resourcesDir.exists() || !resourcesDir.isDirectory())
@ -362,7 +362,7 @@ public class MetaInfConfiguration extends AbstractConfiguration
else
{
URI uri = jar.getURI();
webFrag = Resource.newResource("jar:"+uri+"!/META-INF/web-fragment.xml");
webFrag = Resource.newResource(uriJarPrefix(uri,"!/META-INF/web-fragment.xml"));
}
if (!webFrag.exists() || webFrag.isDirectory())
{
@ -512,7 +512,8 @@ public class MetaInfConfiguration extends AbstractConfiguration
{
HashSet<URL> tlds = new HashSet<URL>();
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();
@ -523,7 +524,7 @@ 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())
@ -696,4 +697,14 @@ public class MetaInfConfiguration extends AbstractConfiguration
return dirResources;
}
private String uriJarPrefix(URI uri, String suffix)
{
String uriString = uri.toString();
if (uriString.startsWith("jar:")) {
return uriString + suffix;
} else {
return "jar:" + uriString + suffix;
}
}
}