Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2014-08-27 06:34:24 +0000
committerGreg Wilkins2014-08-27 06:38:49 +0000
commit4c8e2a6635d6a13a783a567aa890237a88a62e56 (patch)
tree642ef716062d947d43b69d85b8d7bfdc5f08b405 /examples
parent8ce96cdd2ea5af38300b8147457e84c3eee2f48d (diff)
downloadorg.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 'examples')
-rw-r--r--examples/quickstart/pom.xml12
-rw-r--r--examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureJNDIWar.java49
-rw-r--r--examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureSpecWar.java58
-rw-r--r--examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureStandardTestWar.java61
-rw-r--r--examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartJNDIWar.java31
-rw-r--r--examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartSpecWar.java30
-rw-r--r--examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartStandardTestWar.java30
-rw-r--r--examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartTest.java179
-rw-r--r--examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/Quickstart.java73
-rw-r--r--examples/quickstart/src/test/resources/realm.properties21
-rw-r--r--examples/quickstart/src/test/resources/test-jndi.xml60
-rw-r--r--examples/quickstart/src/test/resources/test-spec.xml39
-rw-r--r--examples/quickstart/src/test/resources/test.xml45
13 files changed, 688 insertions, 0 deletions
diff --git a/examples/quickstart/pom.xml b/examples/quickstart/pom.xml
index 812b8e7b5c..08e46952d5 100644
--- a/examples/quickstart/pom.xml
+++ b/examples/quickstart/pom.xml
@@ -14,6 +14,12 @@
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-quickstart</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${project.version}</version>
</dependency>
@@ -101,6 +107,12 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty.toolchain</groupId>
+ <artifactId>jetty-test-helper</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<build>
<plugins>
diff --git a/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureJNDIWar.java b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureJNDIWar.java
new file mode 100644
index 0000000000..a8f636945a
--- /dev/null
+++ b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureJNDIWar.java
@@ -0,0 +1,49 @@
+//
+// ========================================================================
+// 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/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureSpecWar.java b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureSpecWar.java
new file mode 100644
index 0000000000..7dd62d83ed
--- /dev/null
+++ b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureSpecWar.java
@@ -0,0 +1,58 @@
+//
+// ========================================================================
+// 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/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureStandardTestWar.java b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureStandardTestWar.java
new file mode 100644
index 0000000000..2dcfeb7eab
--- /dev/null
+++ b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/PreconfigureStandardTestWar.java
@@ -0,0 +1,61 @@
+//
+// ========================================================================
+// 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/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartJNDIWar.java b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartJNDIWar.java
new file mode 100644
index 0000000000..07bc1b6648
--- /dev/null
+++ b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartJNDIWar.java
@@ -0,0 +1,31 @@
+//
+// ========================================================================
+// 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/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartSpecWar.java b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartSpecWar.java
new file mode 100644
index 0000000000..b84a12f298
--- /dev/null
+++ b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartSpecWar.java
@@ -0,0 +1,30 @@
+//
+// ========================================================================
+// 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/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartStandardTestWar.java b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartStandardTestWar.java
new file mode 100644
index 0000000000..7da8b23465
--- /dev/null
+++ b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartStandardTestWar.java
@@ -0,0 +1,30 @@
+//
+// ========================================================================
+// 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/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 0000000000..4ff5fff00f
--- /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/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/Quickstart.java b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/Quickstart.java
new file mode 100644
index 0000000000..75dc114e10
--- /dev/null
+++ b/examples/quickstart/src/test/java/org/eclipse/jetty/quickstart/Quickstart.java
@@ -0,0 +1,73 @@
+//
+// ========================================================================
+// 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/examples/quickstart/src/test/resources/realm.properties b/examples/quickstart/src/test/resources/realm.properties
new file mode 100644
index 0000000000..9d88b852b7
--- /dev/null
+++ b/examples/quickstart/src/test/resources/realm.properties
@@ -0,0 +1,21 @@
+#
+# 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/examples/quickstart/src/test/resources/test-jndi.xml b/examples/quickstart/src/test/resources/test-jndi.xml
new file mode 100644
index 0000000000..14c0934845
--- /dev/null
+++ b/examples/quickstart/src/test/resources/test-jndi.xml
@@ -0,0 +1,60 @@
+<?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/examples/quickstart/src/test/resources/test-spec.xml b/examples/quickstart/src/test/resources/test-spec.xml
new file mode 100644
index 0000000000..99fc577205
--- /dev/null
+++ b/examples/quickstart/src/test/resources/test-spec.xml
@@ -0,0 +1,39 @@
+<?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/examples/quickstart/src/test/resources/test.xml b/examples/quickstart/src/test/resources/test.xml
new file mode 100644
index 0000000000..bbdf08a23a
--- /dev/null
+++ b/examples/quickstart/src/test/resources/test.xml
@@ -0,0 +1,45 @@
+<?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>

Back to the top