@Test void testParseWebXml4() throws Exception { DefaultWebApplication webApplication = new DefaultWebApplication(); webApplication.addResource(new DirectoryResource(new File("src/test/webxml/parse4"))); InputStream inputStream = webApplication.getResourceAsStream("WEB-INF/web.xml"); WebXmlParser parser = new WebXmlParser(); WebXml webXml = parser.parse(inputStream); assertEquals(1, webXml.getServlets().size()); String servletName = webXml.getServlets().get(0).getServletName(); assertEquals("Test Servlet", servletName); List<WebXmlServletMapping> servletMappings = webXml.getServletMappings(); assertEquals(2, servletMappings.size()); assertEquals(servletName, servletMappings.get(0).getServletName()); assertEquals("/foo", servletMappings.get(0).getUrlPattern()); assertEquals(servletName, servletMappings.get(1).getServletName()); assertEquals("/bar", servletMappings.get(1).getUrlPattern()); }
public WebXml parse(InputStream inputStream) { WebXml webXml = new WebXml(); try { DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = documentBuilder.parse(inputStream); XPath xPath = XPathFactory.newInstance().newXPath(); parseAbsoluteOrdering(webXml, xPath, document); parseOrdering(webXml, xPath, document); parseContextParameters(webXml, xPath, document); parseDefaultContextPath(webXml, xPath, document); parseDenyUncoveredHttpMethods(webXml, xPath, document); parseDisplayName(webXml, xPath, document); parseFragmentName(webXml, xPath, document); parseDistributable(webXml, xPath, document); parseErrorPages(webXml, xPath, document); parseFilterMappings(webXml, xPath, document); parseFilters(webXml, xPath, document); parseListeners(webXml, xPath, document); parseLoginConfig(webXml, xPath, document); parseMimeMappings(webXml, xPath, document); parseRequestCharacterEncoding(webXml, xPath, document); parseResponseCharacterEncoding(webXml, xPath, document); parseLocaleEncodingMapping(webXml, xPath, document); processSecurityConstraints(webXml, xPath, document); processSecurityRoles(webXml, xPath, document); parseServletMappings(webXml, xPath, document); parseServlets(webXml, xPath, document); parseSessionConfig(webXml, xPath, document); parseWebApp(webXml, xPath, document); parseWelcomeFiles(webXml, xPath, document); } catch (Throwable t) { LOGGER.log(WARNING, "Unable to parse web.xml", t); } return webXml; }
WebXmlParser { public WebXml parse(InputStream inputStream) { WebXml webXml = new WebXml(); try { DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = documentBuilder.parse(inputStream); XPath xPath = XPathFactory.newInstance().newXPath(); parseAbsoluteOrdering(webXml, xPath, document); parseOrdering(webXml, xPath, document); parseContextParameters(webXml, xPath, document); parseDefaultContextPath(webXml, xPath, document); parseDenyUncoveredHttpMethods(webXml, xPath, document); parseDisplayName(webXml, xPath, document); parseFragmentName(webXml, xPath, document); parseDistributable(webXml, xPath, document); parseErrorPages(webXml, xPath, document); parseFilterMappings(webXml, xPath, document); parseFilters(webXml, xPath, document); parseListeners(webXml, xPath, document); parseLoginConfig(webXml, xPath, document); parseMimeMappings(webXml, xPath, document); parseRequestCharacterEncoding(webXml, xPath, document); parseResponseCharacterEncoding(webXml, xPath, document); parseLocaleEncodingMapping(webXml, xPath, document); processSecurityConstraints(webXml, xPath, document); processSecurityRoles(webXml, xPath, document); parseServletMappings(webXml, xPath, document); parseServlets(webXml, xPath, document); parseSessionConfig(webXml, xPath, document); parseWebApp(webXml, xPath, document); parseWelcomeFiles(webXml, xPath, document); } catch (Throwable t) { LOGGER.log(WARNING, "Unable to parse web.xml", t); } return webXml; } }
WebXmlParser { public WebXml parse(InputStream inputStream) { WebXml webXml = new WebXml(); try { DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = documentBuilder.parse(inputStream); XPath xPath = XPathFactory.newInstance().newXPath(); parseAbsoluteOrdering(webXml, xPath, document); parseOrdering(webXml, xPath, document); parseContextParameters(webXml, xPath, document); parseDefaultContextPath(webXml, xPath, document); parseDenyUncoveredHttpMethods(webXml, xPath, document); parseDisplayName(webXml, xPath, document); parseFragmentName(webXml, xPath, document); parseDistributable(webXml, xPath, document); parseErrorPages(webXml, xPath, document); parseFilterMappings(webXml, xPath, document); parseFilters(webXml, xPath, document); parseListeners(webXml, xPath, document); parseLoginConfig(webXml, xPath, document); parseMimeMappings(webXml, xPath, document); parseRequestCharacterEncoding(webXml, xPath, document); parseResponseCharacterEncoding(webXml, xPath, document); parseLocaleEncodingMapping(webXml, xPath, document); processSecurityConstraints(webXml, xPath, document); processSecurityRoles(webXml, xPath, document); parseServletMappings(webXml, xPath, document); parseServlets(webXml, xPath, document); parseSessionConfig(webXml, xPath, document); parseWebApp(webXml, xPath, document); parseWelcomeFiles(webXml, xPath, document); } catch (Throwable t) { LOGGER.log(WARNING, "Unable to parse web.xml", t); } return webXml; }  }
WebXmlParser { public WebXml parse(InputStream inputStream) { WebXml webXml = new WebXml(); try { DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = documentBuilder.parse(inputStream); XPath xPath = XPathFactory.newInstance().newXPath(); parseAbsoluteOrdering(webXml, xPath, document); parseOrdering(webXml, xPath, document); parseContextParameters(webXml, xPath, document); parseDefaultContextPath(webXml, xPath, document); parseDenyUncoveredHttpMethods(webXml, xPath, document); parseDisplayName(webXml, xPath, document); parseFragmentName(webXml, xPath, document); parseDistributable(webXml, xPath, document); parseErrorPages(webXml, xPath, document); parseFilterMappings(webXml, xPath, document); parseFilters(webXml, xPath, document); parseListeners(webXml, xPath, document); parseLoginConfig(webXml, xPath, document); parseMimeMappings(webXml, xPath, document); parseRequestCharacterEncoding(webXml, xPath, document); parseResponseCharacterEncoding(webXml, xPath, document); parseLocaleEncodingMapping(webXml, xPath, document); processSecurityConstraints(webXml, xPath, document); processSecurityRoles(webXml, xPath, document); parseServletMappings(webXml, xPath, document); parseServlets(webXml, xPath, document); parseSessionConfig(webXml, xPath, document); parseWebApp(webXml, xPath, document); parseWelcomeFiles(webXml, xPath, document); } catch (Throwable t) { LOGGER.log(WARNING, "Unable to parse web.xml", t); } return webXml; }  WebXml parse(InputStream inputStream); static Iterable<Node> toIterable(NodeList nodes); }
WebXmlParser { public WebXml parse(InputStream inputStream) { WebXml webXml = new WebXml(); try { DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = documentBuilder.parse(inputStream); XPath xPath = XPathFactory.newInstance().newXPath(); parseAbsoluteOrdering(webXml, xPath, document); parseOrdering(webXml, xPath, document); parseContextParameters(webXml, xPath, document); parseDefaultContextPath(webXml, xPath, document); parseDenyUncoveredHttpMethods(webXml, xPath, document); parseDisplayName(webXml, xPath, document); parseFragmentName(webXml, xPath, document); parseDistributable(webXml, xPath, document); parseErrorPages(webXml, xPath, document); parseFilterMappings(webXml, xPath, document); parseFilters(webXml, xPath, document); parseListeners(webXml, xPath, document); parseLoginConfig(webXml, xPath, document); parseMimeMappings(webXml, xPath, document); parseRequestCharacterEncoding(webXml, xPath, document); parseResponseCharacterEncoding(webXml, xPath, document); parseLocaleEncodingMapping(webXml, xPath, document); processSecurityConstraints(webXml, xPath, document); processSecurityRoles(webXml, xPath, document); parseServletMappings(webXml, xPath, document); parseServlets(webXml, xPath, document); parseSessionConfig(webXml, xPath, document); parseWebApp(webXml, xPath, document); parseWelcomeFiles(webXml, xPath, document); } catch (Throwable t) { LOGGER.log(WARNING, "Unable to parse web.xml", t); } return webXml; }  WebXml parse(InputStream inputStream); static Iterable<Node> toIterable(NodeList nodes);  }