/** * Get the web-fragment.xml from a jar * * @param jar * @param frags * @return the fragment if found, or null of not found * @throws Exception */ public FragmentDescriptor getFragmentFromJar(Resource jar, List<FragmentDescriptor> frags) throws Exception { // check if the jar has a web-fragment.xml FragmentDescriptor d = null; for (FragmentDescriptor frag : frags) { Resource fragResource = frag.getResource(); // eg jar:file:///a/b/c/foo.jar!/META-INF/web-fragment.xml if (Resource.isContainedIn(fragResource, jar)) { d = frag; break; } } return d; }
/* ------------------------------------------------------------ */ public static boolean isContainedIn(Resource r, Resource containingResource) throws MalformedURLException { return r.isContainedIn(containingResource); }