diff options
author | Greg Wilkins | 2014-08-27 06:34:24 +0000 |
---|---|---|
committer | Greg Wilkins | 2014-08-27 06:38:49 +0000 |
commit | 4c8e2a6635d6a13a783a567aa890237a88a62e56 (patch) | |
tree | 642ef716062d947d43b69d85b8d7bfdc5f08b405 /jetty-quickstart | |
parent | 8ce96cdd2ea5af38300b8147457e84c3eee2f48d (diff) | |
download | org.eclipse.jetty.project-4c8e2a6635d6a13a783a567aa890237a88a62e56.tar.gz org.eclipse.jetty.project-4c8e2a6635d6a13a783a567aa890237a88a62e56.tar.xz org.eclipse.jetty.project-4c8e2a6635d6a13a783a567aa890237a88a62e56.zip |
442642 Quickstart generates valid XML
Fixed issues with XmlParser and WebDescriptor that were stopping validation.
Diffstat (limited to 'jetty-quickstart')
12 files changed, 110 insertions, 579 deletions
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 5a56625fb0..b881a85606 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<SessionTrackingMode> 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<SessionTrackingMode> 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) - { - ServletHolder s = (ServletHolder)holder; - if (s.getInitOrder() >= 0) - out.tag("load-on-startup",Integer.toString(s.getInitOrder())); + 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()) - .closeTag(); + if (!s.isEnabled()) + out.tag("enabled",origin(md,ot + "enabled"),"false"); - Map<String,String> roles = s.getRoleRefMap(); - if (roles!=null) - { - for (Map.Entry<String, String> 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"); + 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) + if (s.getRunAsRole() != null) + out.openTag("run-as",origin(md,ot + "run-as")) + .tag("role-name",s.getRunAsRole()) + .closeTag(); + + Map<String,String> roles = s.getRoleRefMap(); + if (roles!=null) + { + for (Map.Entry<String, String> e : roles.entrySet()) { - 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.openTag("security-role-ref",origin(md,ot+"role-name."+e.getKey())) + .tag("role-name",e.getKey()) + .tag("role-link",e.getValue()) + .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-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureJNDIWar.java b/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureJNDIWar.java deleted file mode 100644 index 570b724cae..0000000000 --- a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureJNDIWar.java +++ /dev/null @@ -1,49 +0,0 @@ -// -// ======================================================================== -// 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 java.io.File; -import java.io.FileInputStream; -import java.util.concurrent.TimeUnit; - -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.util.IO; -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; - -public class PreconfigureJNDIWar -{ - private static final long __start=System.nanoTime(); - private static final Logger LOG = Log.getLogger(Server.class); - - public static void main(String[] args) throws Exception - { - String target="target/test-jndi-preconfigured"; - File file = new File(target); - if (file.exists()) - IO.delete(file); - - PreconfigureQuickStartWar.main("target/test-jndi.war",target, "src/test/resources/test-jndi.xml"); - - 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); - } - -} diff --git a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureSpecWar.java b/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureSpecWar.java deleted file mode 100644 index f8b49c77c2..0000000000 --- a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureSpecWar.java +++ /dev/null @@ -1,58 +0,0 @@ -// -// ======================================================================== -// 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 java.io.File; -import java.io.FileInputStream; -import java.util.concurrent.TimeUnit; - -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.util.IO; -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.util.resource.Resource; - -public class PreconfigureSpecWar -{ - private static final long __start=System.nanoTime(); - private static final Logger LOG = Log.getLogger(Server.class); - - public static void main(String[] args) throws Exception - { - String target="target/test-spec-preconfigured"; - File file = new File(target); - if (file.exists()) - IO.delete(file); - - File realmPropertiesDest = new File ("target/test-spec-realm.properties"); - if (realmPropertiesDest.exists()) - IO.delete(realmPropertiesDest); - - Resource realmPropertiesSrc = Resource.newResource("src/test/resources/realm.properties"); - realmPropertiesSrc.copyTo(realmPropertiesDest); - System.setProperty("jetty.home", "target"); - - PreconfigureQuickStartWar.main("target/test-spec.war",target, "src/test/resources/test-spec.xml"); - - 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); - } - -} diff --git a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureStandardTestWar.java b/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureStandardTestWar.java deleted file mode 100644 index 91e424165e..0000000000 --- a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureStandardTestWar.java +++ /dev/null @@ -1,62 +0,0 @@ -// -// ======================================================================== -// 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 java.io.File; -import java.io.FileInputStream; -import java.util.concurrent.TimeUnit; - -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.util.IO; -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.util.resource.Resource; - -/** - * PreconfigureStandardTestWar - * - */ -public class PreconfigureStandardTestWar -{ - - private static final long __start=System.nanoTime(); - private static final Logger LOG = Log.getLogger(Server.class); - - public static void main(String[] args) throws Exception - { - String target="target/test-standard-preconfigured"; - File file = new File(target); - if (file.exists()) - IO.delete(file); - - File realmPropertiesDest = new File ("target/test-standard-realm.properties"); - if (realmPropertiesDest.exists()) - IO.delete(realmPropertiesDest); - - Resource realmPropertiesSrc = Resource.newResource("src/test/resources/realm.properties"); - realmPropertiesSrc.copyTo(realmPropertiesDest); - System.setProperty("jetty.home", "target"); - - PreconfigureQuickStartWar.main("target/test-standard.war",target, "src/test/resources/test.xml"); - - 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); - } -} diff --git a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartJNDIWar.java b/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartJNDIWar.java deleted file mode 100644 index 07bc1b6648..0000000000 --- a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartJNDIWar.java +++ /dev/null @@ -1,31 +0,0 @@ -// -// ======================================================================== -// 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; - -public class QuickStartJNDIWar -{ - - public static void main(String... args) throws Exception - { - // Log.getRootLogger().setDebugEnabled(true); - Quickstart.main("target/test-jndi-preconfigured", "src/test/resources/test-jndi.xml"); - } - - -} diff --git a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartSpecWar.java b/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartSpecWar.java deleted file mode 100644 index b84a12f298..0000000000 --- a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartSpecWar.java +++ /dev/null @@ -1,30 +0,0 @@ -// -// ======================================================================== -// 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; - - -public class QuickStartSpecWar -{ - public static void main(String... args) throws Exception - { - // Log.getRootLogger().setDebugEnabled(true); - System.setProperty("jetty.home", "target"); - Quickstart.main("target/test-spec-preconfigured", "src/test/resources/test-spec.xml"); - } -} diff --git a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartStandardTestWar.java b/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartStandardTestWar.java deleted file mode 100644 index 7da8b23465..0000000000 --- a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartStandardTestWar.java +++ /dev/null @@ -1,30 +0,0 @@ -// -// ======================================================================== -// 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; - -public class QuickStartStandardTestWar -{ - - public static void main(String... args) throws Exception - { - // Log.getRootLogger().setDebugEnabled(true); - System.setProperty("jetty.home", "target"); - Quickstart.main("target/test-standard-preconfigured", "src/test/resources/test.xml"); - } -} diff --git a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/Quickstart.java b/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/Quickstart.java deleted file mode 100644 index 75dc114e10..0000000000 --- a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/Quickstart.java +++ /dev/null @@ -1,73 +0,0 @@ -// -// ======================================================================== -// 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 org.eclipse.jetty.server.Server; -import org.eclipse.jetty.util.resource.Resource; -import org.eclipse.jetty.xml.XmlConfiguration; - -public class Quickstart -{ - - public static void main(String... args) throws Exception - { - if (args.length<1) - error("No WAR file or directory given"); - - //war file or dir to start - String war = args[0]; - - //optional jetty context xml file to configure the webapp - Resource contextXml = null; - if (args.length > 1) - contextXml = Resource.newResource(args[1]); - - Server server = new Server(8080); - - 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(); - - - - server.join(); - } - - - private static void error(String message) - { - System.err.println("ERROR: "+message); - System.err.println("Usage: java -jar QuickStartWar.jar <war-directory> <context-xml>"); - System.err.println(" java -jar QuickStartWar.jar <war-file> <context-xml>"); - System.exit(1); - } -} diff --git a/jetty-quickstart/src/test/resources/realm.properties b/jetty-quickstart/src/test/resources/realm.properties deleted file mode 100644 index 9d88b852b7..0000000000 --- a/jetty-quickstart/src/test/resources/realm.properties +++ /dev/null @@ -1,21 +0,0 @@ -# -# This file defines users passwords and roles for a HashUserRealm -# -# The format is -# <username>: <password>[,<rolename> ...] -# -# Passwords may be clear text, obfuscated or checksummed. The class -# org.eclipse.util.Password should be used to generate obfuscated -# passwords or password checksums -# -# If DIGEST Authentication is used, the password must be in a recoverable -# format, either plain text or OBF:. -# -jetty: MD5:164c88b302622e17050af52c89945d44,user -admin: CRYPT:adpexzg3FUZAk,server-administrator,content-administrator,admin,user -other: OBF:1xmk1w261u9r1w1c1xmq,user -plain: plain,user -user: password,user - -# This entry is for digest auth. The credential is a MD5 hash of username:realmname:password -digest: MD5:6e120743ad67abfbc385bc2bb754e297,user diff --git a/jetty-quickstart/src/test/resources/test-jndi.xml b/jetty-quickstart/src/test/resources/test-jndi.xml deleted file mode 100644 index 14c0934845..0000000000 --- a/jetty-quickstart/src/test/resources/test-jndi.xml +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> - -<!-- =============================================================== --> -<!-- Configure the test-jndi webapp --> -<!-- =============================================================== --> -<Configure id='wac' class="org.eclipse.jetty.webapp.WebAppContext"> - - <New id="tx" class="org.eclipse.jetty.plus.jndi.Transaction"> - <Arg> - <New class="com.acme.MockUserTransaction"/> - </Arg> - </New> - - <!-- Define an env entry with Server scope for java:comp/env --> - <New id="woggle" class="org.eclipse.jetty.plus.jndi.EnvEntry"> - <Arg><Property name='server'/></Arg> - <Arg>woggle</Arg> - <Arg type="java.lang.Integer">4000</Arg> - <Arg type="boolean">false</Arg> - </New> - - <!-- Define an env entry with webapp scope for java:comp/env --> - <New id="wiggle" class="org.eclipse.jetty.plus.jndi.EnvEntry"> - <Arg><Ref refid='wac'/></Arg> - <Arg>wiggle</Arg> - <Arg type="java.lang.Double">100</Arg> - <Arg type="boolean">true</Arg> - </New> - - <!-- Mail Session setup --> - <New id="xxxmail" class="org.eclipse.jetty.plus.jndi.Resource"> - <Arg><Ref refid='wac'/></Arg> - <Arg>mail/Session</Arg> - <Arg> - <New class="org.eclipse.jetty.jndi.factories.MailSessionReference"> - <Set name="user">CHANGE-ME</Set> - <Set name="password">CHANGE-ME</Set> - <Set name="properties"> - <New class="java.util.Properties"> - <Put name="mail.smtp.auth">false</Put> <!-- change to true if you want to authenticate --> - <Put name="mail.smtp.host">CHANGE-ME</Put> - <Put name="mail.from">CHANGE-ME</Put> - <Put name="mail.debug">false</Put> - </New> - </Set> - </New> - </Arg> - </New> - - <!-- A mock DataSource --> - <New id="mydatasource" class="org.eclipse.jetty.plus.jndi.Resource"> - <Arg><Ref refid='wac'/></Arg> - <Arg>jdbc/mydatasource</Arg> - <Arg> - <New class="com.acme.MockDataSource"/> - </Arg> - </New> - -</Configure> diff --git a/jetty-quickstart/src/test/resources/test-spec.xml b/jetty-quickstart/src/test/resources/test-spec.xml deleted file mode 100644 index 99fc577205..0000000000 --- a/jetty-quickstart/src/test/resources/test-spec.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> - -<Configure id='wac' class="org.eclipse.jetty.webapp.WebAppContext"> - - <New id="tx" class="org.eclipse.jetty.plus.jndi.Transaction"> - <Arg> - <New class="com.acme.MockUserTransaction"/> - </Arg> - </New> - - <Get name="securityHandler"> - <Set name="loginService"> - <New class="org.eclipse.jetty.security.HashLoginService"> - <Set name="name">Test Realm</Set> - <Set name="config"><SystemProperty name="jetty.home" default="."/>/test-spec-realm.properties</Set> - </New> - </Set> - </Get> - - - <New id="maxAmount" class="org.eclipse.jetty.plus.jndi.EnvEntry"> - <Arg><Ref refid='wac'/></Arg> - <Arg>maxAmount</Arg> - <Arg type="java.lang.Double">100</Arg> - <Arg type="boolean">true</Arg> - </New> - - - <New id="mydatasource" class="org.eclipse.jetty.plus.jndi.Resource"> - <Arg><Ref refid='wac'/></Arg> - <Arg>jdbc/mydatasource</Arg> - <Arg> - <New class="com.acme.MockDataSource"> - </New> - </Arg> - </New> - -</Configure> diff --git a/jetty-quickstart/src/test/resources/test.xml b/jetty-quickstart/src/test/resources/test.xml deleted file mode 100644 index bbdf08a23a..0000000000 --- a/jetty-quickstart/src/test/resources/test.xml +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> - -<!-- ================================================================== -Configure and deploy the test web application in $(jetty.home)/webapps/test - -Note. If this file did not exist or used a context path other that /test -then the default configuration of jetty.xml would discover the test -webapplication with a WebAppDeployer. By specifying a context in this -directory, additional configuration may be specified and hot deployments -detected. -===================================================================== --> - -<Configure class="org.eclipse.jetty.webapp.WebAppContext"> - - <Set name="contextPath">/test</Set> - - <Get name="securityHandler"> - <Set name="loginService"> - <New class="org.eclipse.jetty.security.HashLoginService"> - <Set name="name">Test Realm</Set> - <Set name="config"><SystemProperty name="jetty.home" default="."/>/test-standard-realm.properties</Set> - </New> - </Set> - <Set name="authenticator"> - <New class="org.eclipse.jetty.security.authentication.FormAuthenticator"> - <Set name="alwaysSaveUri">true</Set> - </New> - </Set> - <Set name="checkWelcomeFiles">true</Set> - </Get> - - <!-- Non standard error page mapping --> - <!-- - <Get name="errorHandler"> - <Call name="addErrorPage"> - <Arg type="int">500</Arg> - <Arg type="int">599</Arg> - <Arg type="String">/dump/errorCodeRangeMapping</Arg> - </Call> - </Get> - --> - - -</Configure> |