diff --git a/jetty-deploy/src/test/resources/context-binding-test-1.xml b/jetty-deploy/src/test/resources/context-binding-test-1.xml index 360955997e2..9e5215df02a 100644 --- a/jetty-deploy/src/test/resources/context-binding-test-1.xml +++ b/jetty-deploy/src/test/resources/context-binding-test-1.xml @@ -1,7 +1,9 @@ + + org.eclipse.foo. - ` + diff --git a/jetty-maven-plugin/src/it/jetty-start-gwt-it/beer-server/src/main/jettyconf/context.xml b/jetty-maven-plugin/src/it/jetty-start-gwt-it/beer-server/src/main/jettyconf/context.xml index eaea86d15cf..e1ab206a186 100644 --- a/jetty-maven-plugin/src/it/jetty-start-gwt-it/beer-server/src/main/jettyconf/context.xml +++ b/jetty-maven-plugin/src/it/jetty-start-gwt-it/beer-server/src/main/jettyconf/context.xml @@ -1,3 +1,5 @@ + + org.eclipse.jetty.servlet.Default.useFileMappedBuffer diff --git a/jetty-maven-plugin/src/main/resources/maven.xml b/jetty-maven-plugin/src/main/resources/maven.xml index 65262209397..36dec030c94 100644 --- a/jetty-maven-plugin/src/main/resources/maven.xml +++ b/jetty-maven-plugin/src/main/resources/maven.xml @@ -4,9 +4,13 @@ - + + + /etc/maven.props - + + + diff --git a/jetty-start/src/test/resources/bogus.xml b/jetty-start/src/test/resources/bogus.xml index 6660498d7f5..c1d3126ab22 100644 --- a/jetty-start/src/test/resources/bogus.xml +++ b/jetty-start/src/test/resources/bogus.xml @@ -1,2 +1,3 @@ + \ No newline at end of file diff --git a/jetty-websocket/websocket-javax-server/src/test/resources/jetty-websocket-httpclient.xml b/jetty-websocket/websocket-javax-server/src/test/resources/jetty-websocket-httpclient.xml index fe9e825c5a6..eef3def7410 100644 --- a/jetty-websocket/websocket-javax-server/src/test/resources/jetty-websocket-httpclient.xml +++ b/jetty-websocket/websocket-javax-server/src/test/resources/jetty-websocket-httpclient.xml @@ -1,5 +1,5 @@ - + diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java index 5ce72c1281f..52e1010e407 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java @@ -388,7 +388,7 @@ public class XmlConfiguration if (id != null) _configuration.getIdMap().put(id, obj); - AttrOrElementNode aoeNode = new AttrOrElementNode(obj, _root, "Arg"); + AttrOrElementNode aoeNode = new AttrOrElementNode(obj, _root, "Id", "Class", "Arg"); // The Object already existed, if it has nodes, warn about them not being used. aoeNode.getNodes("Arg") .forEach((node) -> LOG.warn("Ignored arg {} in {}", node, this._configuration._location)); @@ -399,19 +399,22 @@ public class XmlConfiguration @Override public Object configure() throws Exception { - Class oClass = nodeClass(_root); - - String id = _root.getAttribute("id"); + AttrOrElementNode aoeNode = new AttrOrElementNode(_root, "Id", "Class", "Arg"); + String id = aoeNode.getString("Id"); + String clazz = aoeNode.getString("Class"); Object obj = id == null ? null : _configuration.getIdMap().get(id); + Class oClass = clazz != null ? Loader.loadClass(clazz) : obj == null ? null : obj.getClass(); - AttrOrElementNode aoeNode; + if (LOG.isDebugEnabled()) + LOG.debug("Configure {} {}", oClass, obj); if (obj == null && oClass != null) { - aoeNode = new AttrOrElementNode(_root, "Arg"); try { obj = construct(oClass, new Args(null, oClass, aoeNode.getNodes("Arg"))); + if (id != null) + _configuration.getIdMap().put(id, obj); } catch (NoSuchMethodException x) { @@ -420,13 +423,10 @@ public class XmlConfiguration } else { - aoeNode = new AttrOrElementNode(obj, _root, "Arg"); // The Object already existed, if it has nodes, warn about them not being used. aoeNode.getNodes("Arg") .forEach((node) -> LOG.warn("Ignored arg {} in {}", node, this._configuration._location)); } - if (id != null) - _configuration.getIdMap().put(id, obj); _configuration.initializeDefaults(obj); configure(obj, _root, aoeNode.getNext()); @@ -1021,13 +1021,14 @@ public class XmlConfiguration */ private Object refObj(XmlParser.Node node) throws Exception { - String refid = node.getAttribute("refid"); + AttrOrElementNode aoeNode = new AttrOrElementNode(node, "Id"); + String refid = aoeNode.getString("Id"); if (refid == null) - refid = node.getAttribute("id"); + refid = node.getAttribute("refid"); Object obj = _configuration.getIdMap().get(refid); if (obj == null && node.size() > 0) throw new IllegalStateException("No object for refid=" + refid); - configure(obj, node, 0); + configure(obj, node, aoeNode.getNext()); return obj; } diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java index 9d30e84faf7..58f8da3c488 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java @@ -70,7 +70,7 @@ public class XmlParser public XmlParser() { SAXParserFactory factory = SAXParserFactory.newInstance(); - boolean validatingDefault = factory.getClass().toString().startsWith("org.apache.xerces."); + boolean validatingDefault = factory.getClass().toString().contains("org.apache.xerces."); String validatingProp = System.getProperty("org.eclipse.jetty.xml.XmlParser.Validating", validatingDefault ? "true" : "false"); boolean validating = Boolean.valueOf(validatingProp).booleanValue(); setValidating(validating); diff --git a/jetty-xml/src/main/resources/org/eclipse/jetty/xml/configure_10_0.dtd b/jetty-xml/src/main/resources/org/eclipse/jetty/xml/configure_10_0.dtd index bd0aa99d06d..123da7df8ca 100644 --- a/jetty-xml/src/main/resources/org/eclipse/jetty/xml/configure_10_0.dtd +++ b/jetty-xml/src/main/resources/org/eclipse/jetty/xml/configure_10_0.dtd @@ -19,21 +19,18 @@ my be specified if a match is not achieved. - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - + + - + - + - + - + - + - + - - + + - + - + @@ -280,7 +276,7 @@ If it contains multiple value elements they are added as strings before being converted to any specified type. --> - + - + - + - + diff --git a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java index cbf7f2ab28d..8838a0797dd 100644 --- a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java +++ b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java @@ -265,11 +265,19 @@ public class XmlConfigurationTest public XmlConfiguration asXmlConfiguration(String rawXml) throws IOException, SAXException { + if (rawXml.indexOf("!DOCTYPE") < 0) + rawXml = "\n" + + "\n" + + rawXml; return asXmlConfiguration("raw.xml", rawXml); } public XmlConfiguration asXmlConfiguration(String filename, String rawXml) throws IOException, SAXException { + if (rawXml.indexOf("!DOCTYPE") < 0) + rawXml = "\n" + + "\n" + + rawXml; Path testFile = workDir.getEmptyPathDir().resolve(filename); try (BufferedWriter writer = Files.newBufferedWriter(testFile, UTF_8)) { diff --git a/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithElements.xml b/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithElements.xml index 6f68825706a..4c134422add 100644 --- a/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithElements.xml +++ b/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithElements.xml @@ -1,7 +1,8 @@ - + + org.eclipse.jetty.xml.TestConfiguration name SetValue @@ -69,7 +70,6 @@ String - java.lang.Integer @@ -87,25 +87,33 @@ 2.3 + + testId + org.eclipse.jetty.xml.TestConfiguration + nested + + - - org.eclipse.jetty.xml.TestConfiguration - nested + + testId - + - + + call - + + call false - + + call true put Call1 diff --git a/tests/test-integration/src/test/resources/ssl.xml b/tests/test-integration/src/test/resources/ssl.xml index 98e6c18799e..df45814de18 100644 --- a/tests/test-integration/src/test/resources/ssl.xml +++ b/tests/test-integration/src/test/resources/ssl.xml @@ -1,3 +1,5 @@ + + /