diff --git a/examples/quickstart/pom.xml b/examples/quickstart/pom.xml
index 812b8e7b5ce..08e46952d52 100644
--- a/examples/quickstart/pom.xml
+++ b/examples/quickstart/pom.xml
@@ -12,6 +12,12 @@
Jetty Quick Start Example
http://www.eclipse.org/jetty
+
+ org.eclipse.jetty
+ jetty-quickstart
+ ${project.version}
+ test
+
org.eclipse.jetty
jetty-webapp
@@ -101,6 +107,12 @@
${project.version}
test
+
+ org.eclipse.jetty.toolchain
+ jetty-test-helper
+ test
+
+
diff --git a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureJNDIWar.java b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureJNDIWar.java
similarity index 93%
rename from jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureJNDIWar.java
rename to examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureJNDIWar.java
index 570b724cae9..a8f636945ad 100644
--- a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureJNDIWar.java
+++ b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureJNDIWar.java
@@ -43,7 +43,7 @@ public class PreconfigureJNDIWar
LOG.info("Preconfigured in {}ms",TimeUnit.NANOSECONDS.toMillis(System.nanoTime()-__start));
- IO.copy(new FileInputStream("target/test-jndi-preconfigured/WEB-INF/quickstart-web.xml"),System.out);
+ // IO.copy(new FileInputStream("target/test-jndi-preconfigured/WEB-INF/quickstart-web.xml"),System.out);
}
}
diff --git a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureSpecWar.java b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureSpecWar.java
similarity index 94%
rename from jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureSpecWar.java
rename to examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureSpecWar.java
index f8b49c77c2a..7dd62d83ed4 100644
--- a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureSpecWar.java
+++ b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureSpecWar.java
@@ -52,7 +52,7 @@ public class PreconfigureSpecWar
LOG.info("Preconfigured in {}ms",TimeUnit.NANOSECONDS.toMillis(System.nanoTime()-__start));
- IO.copy(new FileInputStream("target/test-spec-preconfigured/WEB-INF/quickstart-web.xml"),System.out);
+ // IO.copy(new FileInputStream("target/test-spec-preconfigured/WEB-INF/quickstart-web.xml"),System.out);
}
}
diff --git a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureStandardTestWar.java b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureStandardTestWar.java
similarity index 94%
rename from jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureStandardTestWar.java
rename to examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureStandardTestWar.java
index 91e424165e1..2dcfeb7eabc 100644
--- a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureStandardTestWar.java
+++ b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureStandardTestWar.java
@@ -34,7 +34,6 @@ import org.eclipse.jetty.util.resource.Resource;
*/
public class PreconfigureStandardTestWar
{
-
private static final long __start=System.nanoTime();
private static final Logger LOG = Log.getLogger(Server.class);
@@ -57,6 +56,6 @@ public class PreconfigureStandardTestWar
LOG.info("Preconfigured in {}ms",TimeUnit.NANOSECONDS.toMillis(System.nanoTime()-__start));
- IO.copy(new FileInputStream("target/test-standard-preconfigured/WEB-INF/quickstart-web.xml"),System.out);
+ // IO.copy(new FileInputStream("target/test-standard-preconfigured/WEB-INF/quickstart-web.xml"),System.out);
}
}
diff --git a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartJNDIWar.java b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartJNDIWar.java
similarity index 100%
rename from jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartJNDIWar.java
rename to examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartJNDIWar.java
diff --git a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartSpecWar.java b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartSpecWar.java
similarity index 100%
rename from jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartSpecWar.java
rename to examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartSpecWar.java
diff --git a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartStandardTestWar.java b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartStandardTestWar.java
similarity index 100%
rename from jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartStandardTestWar.java
rename to examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartStandardTestWar.java
diff --git a/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartTest.java b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartTest.java
new file mode 100644
index 00000000000..4ff5fff00fc
--- /dev/null
+++ b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartTest.java
@@ -0,0 +1,179 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.quickstart;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import org.eclipse.jetty.server.NetworkConnector;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.util.IO;
+import org.eclipse.jetty.util.resource.Resource;
+import org.eclipse.jetty.webapp.WebDescriptor;
+import org.eclipse.jetty.xml.XmlConfiguration;
+import org.eclipse.jetty.xml.XmlParser.Node;
+import org.hamcrest.Matchers;
+import org.junit.Test;
+
+public class QuickStartTest
+{
+
+ @Test
+ public void testStandardTestWar() throws Exception
+ {
+ PreconfigureStandardTestWar.main(new String[]{});
+
+ WebDescriptor descriptor = new WebDescriptor(Resource.newResource("./target/test-standard-preconfigured/WEB-INF/quickstart-web.xml"));
+ descriptor.setValidating(true);
+ descriptor.parse();
+ Node node = descriptor.getRoot();
+ assertThat(node,Matchers.notNullValue());
+
+ System.setProperty("jetty.home", "target");
+
+ //war file or dir to start
+ String war = "target/test-standard-preconfigured";
+
+ //optional jetty context xml file to configure the webapp
+ Resource contextXml = Resource.newResource("src/test/resources/test.xml");
+
+ Server server = new Server(0);
+
+ QuickStartWebApp webapp = new QuickStartWebApp();
+ webapp.setAutoPreconfigure(true);
+ webapp.setWar(war);
+ webapp.setContextPath("/");
+
+ //apply context xml file
+ if (contextXml != null)
+ {
+ // System.err.println("Applying "+contextXml);
+ XmlConfiguration xmlConfiguration = new XmlConfiguration(contextXml.getURL());
+ xmlConfiguration.configure(webapp);
+ }
+
+ server.setHandler(webapp);
+
+ server.start();
+
+ URL url = new URL("http://127.0.0.1:"+server.getBean(NetworkConnector.class).getLocalPort()+"/test/dump/info");
+ HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+ assertEquals(200,connection.getResponseCode());
+ assertThat(IO.toString((InputStream)connection.getContent()),Matchers.containsString("Dump Servlet"));
+
+ server.stop();
+ }
+
+ @Test
+ public void testSpecWar() throws Exception
+ {
+ PreconfigureSpecWar.main(new String[]{});
+
+ WebDescriptor descriptor = new WebDescriptor(Resource.newResource("./target/test-spec-preconfigured/WEB-INF/quickstart-web.xml"));
+ descriptor.setValidating(true);
+ descriptor.parse();
+ Node node = descriptor.getRoot();
+ assertThat(node,Matchers.notNullValue());
+
+ System.setProperty("jetty.home", "target");
+
+ //war file or dir to start
+ String war = "target/test-spec-preconfigured";
+
+ //optional jetty context xml file to configure the webapp
+ Resource contextXml = Resource.newResource("src/test/resources/test-spec.xml");
+
+ Server server = new Server(0);
+
+ QuickStartWebApp webapp = new QuickStartWebApp();
+ webapp.setAutoPreconfigure(true);
+ webapp.setWar(war);
+ webapp.setContextPath("/");
+
+ //apply context xml file
+ if (contextXml != null)
+ {
+ // System.err.println("Applying "+contextXml);
+ XmlConfiguration xmlConfiguration = new XmlConfiguration(contextXml.getURL());
+ xmlConfiguration.configure(webapp);
+ }
+
+ server.setHandler(webapp);
+
+ server.start();
+
+ URL url = new URL("http://127.0.0.1:"+server.getBean(NetworkConnector.class).getLocalPort()+"/");
+ HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+ assertEquals(200,connection.getResponseCode());
+ assertThat(IO.toString((InputStream)connection.getContent()),Matchers.containsString("Test Specification WebApp"));
+
+ server.stop();
+ }
+
+ @Test
+ public void testJNDIWar() throws Exception
+ {
+ PreconfigureJNDIWar.main(new String[]{});
+
+ WebDescriptor descriptor = new WebDescriptor(Resource.newResource("./target/test-jndi-preconfigured/WEB-INF/quickstart-web.xml"));
+ descriptor.setValidating(true);
+ descriptor.parse();
+ Node node = descriptor.getRoot();
+ assertThat(node,Matchers.notNullValue());
+
+ System.setProperty("jetty.home", "target");
+
+ //war file or dir to start
+ String war = "target/test-jndi-preconfigured";
+
+ //optional jetty context xml file to configure the webapp
+ Resource contextXml = Resource.newResource("src/test/resources/test-jndi.xml");
+
+ Server server = new Server(0);
+
+ QuickStartWebApp webapp = new QuickStartWebApp();
+ webapp.setAutoPreconfigure(true);
+ webapp.setWar(war);
+ webapp.setContextPath("/");
+
+ //apply context xml file
+ if (contextXml != null)
+ {
+ // System.err.println("Applying "+contextXml);
+ XmlConfiguration xmlConfiguration = new XmlConfiguration(contextXml.getURL());
+ xmlConfiguration.configure(webapp);
+ }
+
+ server.setHandler(webapp);
+
+ server.start();
+
+ URL url = new URL("http://127.0.0.1:"+server.getBean(NetworkConnector.class).getLocalPort()+"/");
+ HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+ assertEquals(200,connection.getResponseCode());
+ String content=IO.toString((InputStream)connection.getContent());
+ assertThat(content,Matchers.containsString("JNDI Test WebApp"));
+
+ server.stop();
+ }
+}
diff --git a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/Quickstart.java b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/Quickstart.java
similarity index 100%
rename from jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/Quickstart.java
rename to examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/Quickstart.java
diff --git a/jetty-quickstart/src/test/resources/realm.properties b/examples/quickstart/src/test/resources/realm.properties
similarity index 100%
rename from jetty-quickstart/src/test/resources/realm.properties
rename to examples/quickstart/src/test/resources/realm.properties
diff --git a/jetty-quickstart/src/test/resources/test-jndi.xml b/examples/quickstart/src/test/resources/test-jndi.xml
similarity index 100%
rename from jetty-quickstart/src/test/resources/test-jndi.xml
rename to examples/quickstart/src/test/resources/test-jndi.xml
diff --git a/jetty-quickstart/src/test/resources/test-spec.xml b/examples/quickstart/src/test/resources/test-spec.xml
similarity index 100%
rename from jetty-quickstart/src/test/resources/test-spec.xml
rename to examples/quickstart/src/test/resources/test-spec.xml
diff --git a/jetty-quickstart/src/test/resources/test.xml b/examples/quickstart/src/test/resources/test.xml
similarity index 100%
rename from jetty-quickstart/src/test/resources/test.xml
rename to examples/quickstart/src/test/resources/test.xml
diff --git a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/QuickStartDescriptorGenerator.java b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/QuickStartDescriptorGenerator.java
index 5a56625fb00..b881a856068 100644
--- a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/QuickStartDescriptorGenerator.java
+++ b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/QuickStartDescriptorGenerator.java
@@ -19,9 +19,7 @@
package org.eclipse.jetty.quickstart;
-import java.io.File;
import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Collection;
@@ -50,7 +48,6 @@ import org.eclipse.jetty.security.authentication.FormAuthenticator;
import org.eclipse.jetty.servlet.ErrorPageErrorHandler;
import org.eclipse.jetty.servlet.FilterHolder;
import org.eclipse.jetty.servlet.FilterMapping;
-import org.eclipse.jetty.servlet.Holder;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.servlet.ServletMapping;
@@ -129,7 +126,7 @@ public class QuickStartDescriptorGenerator
out.openTag("web-app",webappAttr);
if (_webApp.getDisplayName() != null)
out.tag("display-name",_webApp.getDisplayName());
-
+
// Set some special context parameters
// The location of the war file on disk
@@ -163,7 +160,7 @@ public class QuickStartDescriptorGenerator
if (servlets.getFilters() != null)
{
for (FilterHolder holder : servlets.getFilters())
- outholder(out,md,"filter",holder);
+ outholder(out,md,holder);
}
if (servlets.getFilterMappings() != null)
@@ -199,7 +196,7 @@ public class QuickStartDescriptorGenerator
if (servlets.getServlets() != null)
{
for (ServletHolder holder : servlets.getServlets())
- outholder(out,md,"servlet",holder);
+ outholder(out,md,holder);
}
if (servlets.getServletMappings() != null)
@@ -250,16 +247,37 @@ public class QuickStartDescriptorGenerator
{
out.openTag("security-constraint");
- if (m.getConstraint().getAuthenticate())
+ out.openTag("web-resource-collection");
{
- out.openTag("auth-constraint");
- if (m.getConstraint().getRoles()!=null)
- for (String r : m.getConstraint().getRoles())
- out.tag("role-name",r);
+ if (m.getConstraint().getName()!=null)
+ out.tag("web-resource-name",m.getConstraint().getName());
+ if (m.getPathSpec()!=null)
+ out.tag("url-pattern",origin(md,"constraint.url."+m.getPathSpec()),m.getPathSpec());
+ if (m.getMethod()!=null)
+ out.tag("http-method",m.getMethod());
+
+ if (m.getMethodOmissions()!=null)
+ for (String o:m.getMethodOmissions())
+ out.tag("http-method-omission",o);
out.closeTag();
}
+ if (m.getConstraint().getAuthenticate())
+ {
+ String[] roles = m.getConstraint().getRoles();
+ if (roles!=null && roles.length>0)
+ {
+ out.openTag("auth-constraint");
+ if (m.getConstraint().getRoles()!=null)
+ for (String r : m.getConstraint().getRoles())
+ out.tag("role-name",r);
+ out.closeTag();
+ }
+ else
+ out.tag("auth-constraint");
+ }
+
switch (m.getConstraint().getDataConstraint())
{
case Constraint.DC_NONE:
@@ -279,22 +297,6 @@ public class QuickStartDescriptorGenerator
}
- out.openTag("web-resource-collection");
- {
- if (m.getConstraint().getName()!=null)
- out.tag("web-resource-name",m.getConstraint().getName());
- if (m.getPathSpec()!=null)
- out.tag("url-pattern",origin(md,"constraint.url."+m.getPathSpec()),m.getPathSpec());
- if (m.getMethod()!=null)
- out.tag("http-method",m.getMethod());
-
- if (m.getMethodOmissions()!=null)
- for (String o:m.getMethodOmissions())
- out.tag("http-method-omission",o);
-
- out.closeTag();
- }
-
out.closeTag();
}
@@ -331,12 +333,6 @@ public class QuickStartDescriptorGenerator
int maxInactiveSec = _webApp.getSessionHandler().getSessionManager().getMaxInactiveInterval();
out.tag("session-timeout", (maxInactiveSec==0?"0":Integer.toString(maxInactiveSec/60)));
- Set modes =_webApp. getSessionHandler().getSessionManager().getEffectiveSessionTrackingModes();
- if (modes != null)
- {
- for (SessionTrackingMode mode:modes)
- out.tag("tracking-mode", mode.toString());
- }
//cookie-config
SessionCookieConfig cookieConfig = _webApp.getSessionHandler().getSessionManager().getSessionCookieConfig();
@@ -360,6 +356,15 @@ public class QuickStartDescriptorGenerator
out.tag("max-age", origin(md, "cookie-config.max-age"), Integer.toString(cookieConfig.getMaxAge()));
out.closeTag();
}
+
+ // tracking-modes
+ Set modes =_webApp. getSessionHandler().getSessionManager().getEffectiveSessionTrackingModes();
+ if (modes != null)
+ {
+ for (SessionTrackingMode mode:modes)
+ out.tag("tracking-mode", mode.toString());
+ }
+
out.closeTag();
}
@@ -560,29 +565,57 @@ public class QuickStartDescriptorGenerator
* @param holder
* @throws IOException
*/
- private void outholder(XmlAppendable out, MetaData md, String tag, Holder> holder) throws IOException
+ private void outholder(XmlAppendable out, MetaData md, FilterHolder holder) throws IOException
{
- out.openTag(tag,Collections.singletonMap("source",holder.getSource().toString()));
+ if (LOG.isDebugEnabled())
+ out.openTag("filter",Collections.singletonMap("source",holder.getSource().toString()));
+ else
+ out.openTag("filter");
+
String n = holder.getName();
- out.tag(tag + "-name",n);
+ out.tag("filter-name",n);
- String ot = n + "." + tag + ".";
+ String ot = n + ".filter.";
if (holder instanceof FilterHolder)
- out.tag(tag + "-class",origin(md,ot + tag + "-class"),holder.getClassName());
- else if (holder instanceof ServletHolder)
{
- ServletHolder s = (ServletHolder)holder;
- if (s.getForcedPath() != null && s.getClassName() == null)
- out.tag("jsp-file",s.getForcedPath());
- else
- out.tag(tag + "-class",origin(md,ot + tag + "-class"),s.getClassName());
-
+ out.tag("filter-class",origin(md,ot + "filter-class"),holder.getClassName());
+ out.tag("async-supported",origin(md,ot + "async-supported"),holder.isAsyncSupported()?"true":"false");
}
+
+ for (String p : holder.getInitParameters().keySet())
+ {
+ out.openTag("init-param",origin(md,ot + "init-param." + p))
+ .tag("param-name",p)
+ .tag("param-value",holder.getInitParameter(p))
+ .closeTag();
+ }
+
+ out.closeTag();
+ }
+
+ private void outholder(XmlAppendable out, MetaData md, ServletHolder holder) throws IOException
+ {
+
+ if (LOG.isDebugEnabled())
+ out.openTag("servlet",Collections.singletonMap("source",holder.getSource().toString()));
+ else
+ out.openTag("servlet");
+
+ String n = holder.getName();
+ out.tag("servlet-name",n);
+
+ String ot = n + ".servlet.";
+
+ ServletHolder s = (ServletHolder)holder;
+ if (s.getForcedPath() != null && s.getClassName() == null)
+ out.tag("jsp-file",s.getForcedPath());
+ else
+ out.tag("servlet-class",origin(md,ot + "servlet-class"),s.getClassName());
for (String p : holder.getInitParameters().keySet())
{
- if ("scratchdir".equalsIgnoreCase(p)) //don't preconfigure the temp dir for jsp output
+ if ("jsp".equalsIgnoreCase(n) && "scratchdir".equalsIgnoreCase(p)) //don't preconfigure the temp dir for jsp output
continue;
out.openTag("init-param",origin(md,ot + "init-param." + p))
.tag("param-name",p)
@@ -590,50 +623,46 @@ public class QuickStartDescriptorGenerator
.closeTag();
}
- if (holder instanceof ServletHolder)
+ if (s.getInitOrder() >= 0)
+ out.tag("load-on-startup",Integer.toString(s.getInitOrder()));
+
+ if (!s.isEnabled())
+ out.tag("enabled",origin(md,ot + "enabled"),"false");
+
+ out.tag("async-supported",origin(md,ot + "async-supported"),holder.isAsyncSupported()?"true":"false");
+
+ if (s.getRunAsRole() != null)
+ out.openTag("run-as",origin(md,ot + "run-as"))
+ .tag("role-name",s.getRunAsRole())
+ .closeTag();
+
+ Map roles = s.getRoleRefMap();
+ if (roles!=null)
{
- ServletHolder s = (ServletHolder)holder;
- if (s.getInitOrder() >= 0)
- out.tag("load-on-startup",Integer.toString(s.getInitOrder()));
-
- if (s.getRunAsRole() != null)
- out.openTag("run-as",origin(md,ot + "run-as"))
- .tag("role-name",s.getRunAsRole())
+ for (Map.Entry e : roles.entrySet())
+ {
+ out.openTag("security-role-ref",origin(md,ot+"role-name."+e.getKey()))
+ .tag("role-name",e.getKey())
+ .tag("role-link",e.getValue())
.closeTag();
-
- Map roles = s.getRoleRefMap();
- if (roles!=null)
- {
- for (Map.Entry e : roles.entrySet())
- {
- out.openTag("security-role-ref",origin(md,ot+"role-name."+e.getKey()))
- .tag("role-name",e.getKey())
- .tag("role-link",e.getValue())
- .closeTag();
- }
- }
-
- if (!s.isEnabled())
- out.tag("enabled",origin(md,ot + "enabled"),"false");
-
- //multipart-config
- MultipartConfigElement multipartConfig = ((ServletHolder.Registration)s.getRegistration()).getMultipartConfig();
- if (multipartConfig != null)
- {
- out.openTag("multipart-config", origin(md, s.getName()+".servlet.multipart-config"));
- if (multipartConfig.getLocation() != null)
- out.tag("location", multipartConfig.getLocation());
- out.tag("max-file-size", Long.toString(multipartConfig.getMaxFileSize()));
- out.tag("max-request-size", Long.toString(multipartConfig.getMaxRequestSize()));
- out.tag("file-size-threshold", Long.toString(multipartConfig.getFileSizeThreshold()));
- out.closeTag();
}
}
- out.tag("async-supported",origin(md,ot + "async-supported"),holder.isAsyncSupported()?"true":"false");
+ //multipart-config
+ MultipartConfigElement multipartConfig = ((ServletHolder.Registration)s.getRegistration()).getMultipartConfig();
+ if (multipartConfig != null)
+ {
+ out.openTag("multipart-config", origin(md, s.getName()+".servlet.multipart-config"));
+ if (multipartConfig.getLocation() != null)
+ out.tag("location", multipartConfig.getLocation());
+ out.tag("max-file-size", Long.toString(multipartConfig.getMaxFileSize()));
+ out.tag("max-request-size", Long.toString(multipartConfig.getMaxRequestSize()));
+ out.tag("file-size-threshold", Long.toString(multipartConfig.getFileSizeThreshold()));
+ out.closeTag();
+ }
+
out.closeTag();
}
-
/**
diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Descriptor.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Descriptor.java
index cec0e58840a..a228fa90f15 100644
--- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Descriptor.java
+++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Descriptor.java
@@ -18,8 +18,6 @@
package org.eclipse.jetty.webapp;
-import java.net.URL;
-
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.xml.XmlParser;
@@ -35,19 +33,9 @@ public abstract class Descriptor
_xml = xml;
}
- public abstract XmlParser newParser()
- throws ClassNotFoundException;
-
public abstract void ensureParser()
throws ClassNotFoundException;
- protected void redirect(XmlParser parser, String resource, URL source)
- {
- if (source != null)
- parser.redirectEntity(resource, source);
- }
-
-
public void setValidating (boolean validating)
{
_validating = validating;
diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebDescriptor.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebDescriptor.java
index cef576a7716..487002f1454 100644
--- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebDescriptor.java
+++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebDescriptor.java
@@ -54,20 +54,23 @@ public class WebDescriptor extends Descriptor
protected List _ordering = new ArrayList();
@Override
- public void ensureParser()
- throws ClassNotFoundException
+ public void ensureParser() throws ClassNotFoundException
{
- if (_parserSingleton == null)
+ synchronized (WebDescriptor.class)
{
- _parserSingleton = newParser();
+ if (_parserSingleton == null)
+ _parserSingleton = newParser(isValidating());
}
- _parser = _parserSingleton;
+
+ if (_parserSingleton.isValidating()==isValidating())
+ _parser = _parserSingleton;
+ else
+ _parser = newParser(isValidating());
}
- public XmlParser newParser()
- throws ClassNotFoundException
+ public static XmlParser newParser(boolean validating) throws ClassNotFoundException
{
- XmlParser xmlParser=new XmlParser()
+ XmlParser xmlParser=new XmlParser(validating)
{
boolean mapped=false;
@@ -136,56 +139,56 @@ public class WebDescriptor extends Descriptor
if (jsp22xsd == null) jsp22xsd = Loader.getResource(Servlet.class, "javax/servlet/jsp/resources/jsp_2_2.xsd");
if (jsp23xsd == null) jsp23xsd = Loader.getResource(Servlet.class, "javax/servlet/jsp/resources/jsp_2_3.xsd");
}
-
- redirect(this,"web-app_2_2.dtd",dtd22);
- redirect(this,"-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN",dtd22);
- redirect(this,"web.dtd",dtd23);
- redirect(this,"web-app_2_3.dtd",dtd23);
- redirect(this,"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN",dtd23);
- redirect(this,"XMLSchema.dtd",schemadtd);
- redirect(this,"http://www.w3.org/2001/XMLSchema.dtd",schemadtd);
- redirect(this,"-//W3C//DTD XMLSCHEMA 200102//EN",schemadtd);
- redirect(this,"jsp_2_0.xsd",jsp20xsd);
- redirect(this,"http://java.sun.com/xml/ns/j2ee/jsp_2_0.xsd",jsp20xsd);
- redirect(this,"http://java.sun.com/xml/ns/javaee/jsp_2_1.xsd",jsp21xsd);
- redirect(this,"jsp_2_2.xsd",jsp22xsd);
- redirect(this,"http://java.sun.com/xml/ns/javaee/jsp_2_2.xsd",jsp22xsd);
- redirect(this,"jsp_2_3.xsd",jsp23xsd);
- redirect(this,"http://xmlns.jcp.org/xml/ns/javaee/jsp_2_3.xsd",jsp23xsd);
- redirect(this,"j2ee_1_4.xsd",j2ee14xsd);
- redirect(this,"http://java.sun.com/xml/ns/j2ee/j2ee_1_4.xsd",j2ee14xsd);
- redirect(this, "http://java.sun.com/xml/ns/javaee/javaee_5.xsd",javaee5);
- redirect(this, "http://java.sun.com/xml/ns/javaee/javaee_6.xsd",javaee6);
- redirect(this, "http://xmlns.jcp.org/xml/ns/javaee/javaee_7.xsd",javaee7);
- redirect(this,"web-app_2_4.xsd",webapp24xsd);
- redirect(this,"http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd",webapp24xsd);
- redirect(this,"web-app_2_5.xsd",webapp25xsd);
- redirect(this,"http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd",webapp25xsd);
- redirect(this,"web-app_3_0.xsd",webapp30xsd);
- redirect(this,"http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd",webapp30xsd);
- redirect(this,"web-common_3_0.xsd",webcommon30xsd);
- redirect(this,"http://java.sun.com/xml/ns/javaee/web-common_3_0.xsd",webcommon30xsd);
- redirect(this,"web-fragment_3_0.xsd",webfragment30xsd);
- redirect(this,"http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd",webfragment30xsd);
- redirect(this,"web-app_3_1.xsd",webapp31xsd);
- redirect(this,"http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd",webapp31xsd);
- redirect(this,"web-common_3_1.xsd",webcommon30xsd);
- redirect(this,"http://xmlns.jcp.org/xml/ns/javaee/web-common_3_1.xsd",webcommon31xsd);
- redirect(this,"web-fragment_3_1.xsd",webfragment30xsd);
- redirect(this,"http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd",webfragment31xsd);
- redirect(this,"xml.xsd",xmlxsd);
- redirect(this,"http://www.w3.org/2001/xml.xsd",xmlxsd);
- redirect(this,"datatypes.dtd",datatypesdtd);
- redirect(this,"http://www.w3.org/2001/datatypes.dtd",datatypesdtd);
- redirect(this,"j2ee_web_services_client_1_1.xsd",webservice11xsd);
- redirect(this,"http://www.ibm.com/webservices/xsd/j2ee_web_services_client_1_1.xsd",webservice11xsd);
- redirect(this,"javaee_web_services_client_1_2.xsd",webservice12xsd);
- redirect(this,"http://www.ibm.com/webservices/xsd/javaee_web_services_client_1_2.xsd",webservice12xsd);
- redirect(this,"javaee_web_services_client_1_3.xsd",webservice13xsd);
- redirect(this,"http://java.sun.com/xml/ns/javaee/javaee_web_services_client_1_3.xsd",webservice13xsd);
- redirect(this,"javaee_web_services_client_1_4.xsd",webservice14xsd);
- redirect(this,"http://xmlns.jcp.org/xml/ns/javaee/javaee_web_services_client_1_4.xsd",webservice14xsd);
+ redirectEntity("web-app_2_2.dtd",dtd22);
+ redirectEntity("-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN",dtd22);
+ redirectEntity("web.dtd",dtd23);
+ redirectEntity("web-app_2_3.dtd",dtd23);
+ redirectEntity("-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN",dtd23);
+ redirectEntity("XMLSchema.dtd",schemadtd);
+ redirectEntity("http://www.w3.org/2001/XMLSchema.dtd",schemadtd);
+ redirectEntity("-//W3C//DTD XMLSCHEMA 200102//EN",schemadtd);
+ redirectEntity("jsp_2_0.xsd",jsp20xsd);
+ redirectEntity("http://java.sun.com/xml/ns/j2ee/jsp_2_0.xsd",jsp20xsd);
+ redirectEntity("http://java.sun.com/xml/ns/javaee/jsp_2_1.xsd",jsp21xsd);
+ redirectEntity("jsp_2_2.xsd",jsp22xsd);
+ redirectEntity("http://java.sun.com/xml/ns/javaee/jsp_2_2.xsd",jsp22xsd);
+ redirectEntity("jsp_2_3.xsd",jsp23xsd);
+ redirectEntity("http://xmlns.jcp.org/xml/ns/javaee/jsp_2_3.xsd",jsp23xsd);
+ redirectEntity("j2ee_1_4.xsd",j2ee14xsd);
+ redirectEntity("http://java.sun.com/xml/ns/j2ee/j2ee_1_4.xsd",j2ee14xsd);
+ redirectEntity( "http://java.sun.com/xml/ns/javaee/javaee_5.xsd",javaee5);
+ redirectEntity( "http://java.sun.com/xml/ns/javaee/javaee_6.xsd",javaee6);
+ redirectEntity( "http://xmlns.jcp.org/xml/ns/javaee/javaee_7.xsd",javaee7);
+ redirectEntity("web-app_2_4.xsd",webapp24xsd);
+ redirectEntity("http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd",webapp24xsd);
+ redirectEntity("web-app_2_5.xsd",webapp25xsd);
+ redirectEntity("http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd",webapp25xsd);
+ redirectEntity("web-app_3_0.xsd",webapp30xsd);
+ redirectEntity("http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd",webapp30xsd);
+ redirectEntity("web-common_3_0.xsd",webcommon30xsd);
+ redirectEntity("http://java.sun.com/xml/ns/javaee/web-common_3_0.xsd",webcommon30xsd);
+ redirectEntity("web-fragment_3_0.xsd",webfragment30xsd);
+ redirectEntity("http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd",webfragment30xsd);
+ redirectEntity("web-app_3_1.xsd",webapp31xsd);
+ redirectEntity("http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd",webapp31xsd);
+
+ redirectEntity("web-common_3_1.xsd",webcommon30xsd);
+ redirectEntity("http://xmlns.jcp.org/xml/ns/javaee/web-common_3_1.xsd",webcommon31xsd);
+ redirectEntity("web-fragment_3_1.xsd",webfragment30xsd);
+ redirectEntity("http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd",webfragment31xsd);
+ redirectEntity("xml.xsd",xmlxsd);
+ redirectEntity("http://www.w3.org/2001/xml.xsd",xmlxsd);
+ redirectEntity("datatypes.dtd",datatypesdtd);
+ redirectEntity("http://www.w3.org/2001/datatypes.dtd",datatypesdtd);
+ redirectEntity("j2ee_web_services_client_1_1.xsd",webservice11xsd);
+ redirectEntity("http://www.ibm.com/webservices/xsd/j2ee_web_services_client_1_1.xsd",webservice11xsd);
+ redirectEntity("javaee_web_services_client_1_2.xsd",webservice12xsd);
+ redirectEntity("http://www.ibm.com/webservices/xsd/javaee_web_services_client_1_2.xsd",webservice12xsd);
+ redirectEntity("javaee_web_services_client_1_3.xsd",webservice13xsd);
+ redirectEntity("http://java.sun.com/xml/ns/javaee/javaee_web_services_client_1_3.xsd",webservice13xsd);
+ redirectEntity("javaee_web_services_client_1_4.xsd",webservice14xsd);
+ redirectEntity("http://xmlns.jcp.org/xml/ns/javaee/javaee_web_services_client_1_4.xsd",webservice14xsd);
}
};
@@ -316,7 +319,11 @@ public class WebDescriptor extends Descriptor
{
_validating = validating;
}
-
+
+ public boolean isValidating ()
+ {
+ return _validating;
+ }
public boolean isOrdered()
{
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 31ef0afc39e..a5e91615a3a 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
@@ -132,6 +132,12 @@ public class XmlParser
}
}
+ /* ------------------------------------------------------------ */
+ public boolean isValidating()
+ {
+ return _parser.isValidating();
+ }
+
/* ------------------------------------------------------------ */
/**
* @param name