/** * Add a web-fragment.xml * * @param jarResource the jar the fragment is contained in * @param xmlResource the resource representing the xml file * @throws Exception */ public void addFragment(Resource jarResource, Resource xmlResource) throws Exception { if (_metaDataComplete) return; // do not process anything else if web.xml/web-override.xml set metadata-complete // Metadata-complete is not set, or there is no web.xml FragmentDescriptor descriptor = new FragmentDescriptor(xmlResource); _webFragmentResourceMap.put(jarResource, descriptor); _webFragmentRoots.add(descriptor); descriptor.parse(); if (descriptor.getName() != null) { Descriptor existing = _webFragmentNameMap.get(descriptor.getName()); if (existing != null && !isAllowDuplicateFragmentNames()) { throw new IllegalStateException( "Duplicate fragment name: " + descriptor.getName() + " for " + existing.getResource() + " and " + descriptor.getResource()); } else _webFragmentNameMap.put(descriptor.getName(), descriptor); } // If web.xml has specified an absolute ordering, ignore any relative ordering in the fragment if (_ordering != null && _ordering.isAbsolute()) return; if (_ordering == null && descriptor.isOrdered()) _ordering = new Ordering.RelativeOrdering(this); }