WebXMLDefinitionLoader extends DefaultHandler { public WebXMLDefinition loadWebXML() throws Exception { WebXMLDefinition webXMLDefinition = loadWebXMLDefinition( _bundle.getEntry("WEB-INF/web.xml")); if (webXMLDefinition.isMetadataComplete()) { return webXMLDefinition; } Enumeration<URL> enumeration = _bundle.getResources( "META-INF/web-fragment.xml"); List<WebXMLDefinition> webXMLDefinitions = new ArrayList<>(); if (enumeration != null) { while (enumeration.hasMoreElements()) { URL url = enumeration.nextElement(); WebXMLDefinitionLoader webXMLDefinitionLoader = new WebXMLDefinitionLoader( _bundle, _jspServletFactory, _saxParserFactory, _classes, _annotatedClasses); webXMLDefinitions.add( webXMLDefinitionLoader.loadWebXMLDefinition(url)); } } WebXMLDefinition annotationWebXMLDefinition = new WebXMLDefinition(); _collectAnnotatedClasses(annotationWebXMLDefinition); webXMLDefinitions.add(annotationWebXMLDefinition); List<WebXMLDefinition> orderedWebXMLDefinitions = new ArrayList<>(); if (ListUtil.isNotEmpty(webXMLDefinitions)) { orderedWebXMLDefinitions = OrderUtil.getOrderedWebXMLDefinitions( webXMLDefinitions, webXMLDefinition.getAbsoluteOrderingNames()); } return _assembleWebXMLDefinition( webXMLDefinition, orderedWebXMLDefinitions); } WebXMLDefinitionLoader(
		Bundle bundle, JSPServletFactory jspServletFactory,
		SAXParserFactory saxParserFactory, Set<Class<?>> classes,
		Set<Class<?>> annotatedClasses); @Override void characters(char[] c, int start, int length); @Override void endElement(String uri, String localName, String qName); @Override void error(SAXParseException saxParseException); WebXMLDefinition loadWebXML(); WebXMLDefinition loadWebXMLDefinition(URL url); @Override void startElement(
		String uri, String localName, String qName, Attributes attributes);  }
@Test public void testLoadWebXML() throws Exception { Bundle bundle = new MockBundle(); Set<Class<?>> classes = Collections.emptySet(); WebXMLDefinitionLoader webXMLDefinitionLoader = new WebXMLDefinitionLoader( bundle, null, SAXParserFactory.newInstance(), classes, classes); WebXMLDefinition webXMLDefinition = webXMLDefinitionLoader.loadWebXMLDefinition( bundle.getEntry("WEB-INF/web.xml")); testWebXMLDefinition(webXMLDefinition, 0, 0, 0); }