jetty-start / fixing build + work towards demo-base

This commit is contained in:
Joakim Erdfelt 2013-08-29 11:48:56 -07:00
parent ddca8bc327
commit 8a1f12ae81
21 changed files with 155 additions and 71 deletions

View File

@ -0,0 +1,107 @@
//
// ========================================================================
// Copyright (c) 1995-2013 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.start;
public class DownloadArg
{
public String uri;
public String location;
public DownloadArg(String uriLocation)
{
String parts[] = uriLocation.split(":",3);
if (parts.length != 3)
{
throw new IllegalArgumentException("Not <http uri>:<location>");
}
if (!"http".equalsIgnoreCase(parts[0]))
{
throw new IllegalArgumentException("Download only supports http protocol");
}
if (!parts[1].startsWith("//"))
{
throw new IllegalArgumentException("Download URI invalid: " + uriLocation);
}
this.uri = String.format("%s:%s",parts[0],parts[1]);
this.location = parts[2];
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
DownloadArg other = (DownloadArg)obj;
if (uri == null)
{
if (other.uri != null)
{
return false;
}
}
else if (!uri.equals(other.uri))
{
return false;
}
if (location == null)
{
if (other.location != null)
{
return false;
}
}
else if (!location.equals(other.location))
{
return false;
}
return true;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = (prime * result) + ((uri == null)?0:uri.hashCode());
result = (prime * result) + ((location == null)?0:location.hashCode());
return result;
}
@Override
public String toString()
{
StringBuilder builder = new StringBuilder();
builder.append("DownloadArg [uri=");
builder.append(uri);
builder.append(", location=");
builder.append(location);
builder.append("]");
return builder.toString();
}
}

View File

@ -42,7 +42,7 @@ public class ModulesTest
Modules modules = new Modules();
modules.registerAll(basehome);
Assert.assertThat("Module count",modules.count(),is(29));
Assert.assertThat("Module count",modules.count(),is(28));
}
@Test

View File

@ -1,16 +0,0 @@
#
# Jetty Demo Module
#
DEPEND=jndi
DEPEND=jaas
DEPEND=rewrite
DEPEND=client
DEPEND=annotations
DEPEND=websocket
DEPEND=webapp
LIB=demo/lib/*.jar
demo/test-realm.xml
demo/jetty-demo.xml

View File

@ -34,7 +34,7 @@
<!-- Mandatory. This system property tells JAAS where to find the login module configuration file -->
<systemProperty>
<name>java.security.auth.login.config</name>
<value>${basedir}/src/main/config/demo/login.conf</value>
<value>${basedir}/src/main/config/demo-base/etc/login.conf</value>
</systemProperty>
</systemProperties>
<webAppConfig>

View File

@ -1,5 +1,5 @@
xyz {
org.eclipse.jetty.jaas.spi.PropertyFileLoginModule required
debug="true"
file="${jetty.home}/demo/login.properties";
file="${jetty.base}/etc/login.properties";
};

View File

@ -24,7 +24,7 @@
etc/jetty-jaas.xml
</pre>
</p>
<p>For the jetty distribution demos, jaas is already enabled in the start.d/900-demo.ini file and sets the jaas.login.conf property to demo/login.conf for use with the demo/webapps/test-jaas.war web application. </p>
<p>For the jetty distribution demos, jaas is already enabled in the demo-base/start.ini file and sets the jaas.login.conf property to ${jetty.base}/etc/login.conf for use with the demo-base/webapps/test-jaas.war web application. </p>
<p>The full source of this demonstration is available <a
href="http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/tests/test-webapps/test-jaas-webapp">here</a>.</p>

View File

@ -147,7 +147,7 @@
<loginServices>
<loginService implementation="org.eclipse.jetty.security.HashLoginService">
<name>Test Realm</name>
<config>src/main/config/demo/realm.properties</config>
<config>src/main/config/demo-base/etc/realm.properties</config>
</loginService>
</loginServices>
</configuration>

View File

@ -28,7 +28,7 @@ detected.
<Set name="extractWAR">true</Set>
<Set name="copyWebDir">false</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Set name="overrideDescriptor"><SystemProperty name="jetty.base" default="."/>/demo/override-web.xml</Set>
<Set name="overrideDescriptor"><SystemProperty name="jetty.base" default="."/>/etc/override-web.xml</Set>
<!-- virtual hosts
<Set name="virtualHosts">

View File

@ -27,7 +27,7 @@
<destName>jetty-web.xml</destName>
</file>
<file>
<source>src/main/config/demo/realm.properties</source>
<source>src/main/config/demo-base/etc/realm.properties</source>
<outputDirectory>WEB-INF</outputDirectory>
<destName>realm.properties</destName>
</file>

View File

@ -6,26 +6,6 @@
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- ============================================================= -->
<!-- Add demo/webapps to deployment manager scans -->
<!-- ============================================================= -->
<Ref refid="DeploymentManager">
<Call id="webappprovider" name="addAppProvider">
<Arg>
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
<Set name="monitoredDirName"><Property name="jetty.base" default="." />/demo/webapps</Set>
<Set name="defaultsDescriptor"><Property name="jetty.home" default="." />/etc/webdefault.xml</Set>
<Set name="scanInterval">1</Set>
<Set name="extractWars">true</Set>
<Set name="configurationManager">
<New class="org.eclipse.jetty.deploy.PropertiesConfigurationManager"/>
</Set>
</New>
</Arg>
</Call>
</Ref>
<!-- ============================================================= -->
<!-- Add rewrite rules -->
<!-- ============================================================= -->

View File

@ -12,7 +12,7 @@
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Test Realm</Set>
<Set name="config"><Property name="demo.realm" default="demo/realm.properties"/></Set>
<Set name="config"><Property name="demo.realm" default="etc/realm.properties"/></Set>
<Set name="refreshInterval">0</Set>
</New>
</Arg>

View File

@ -0,0 +1,33 @@
#
# Example of providing a demo configuration, using a ${jetty.base}
#
# We want to serve content over http
--module=http
# Have webapps be deployed normally from webapps directory
--module=deploy
# We are using annotations + jndi
--module=annotations
--module=jndi
# Enable security via jaas, and configure it
--module=jaas
jaas.login.conf=demo/login.conf
# Enable rewrite examples
--module=rewrite
etc/demo-rewrite-rules.xml
# The async behavior examples use http client to access remote systems
--module=client
# Websocket chat examples needs websocket enabled
--module=websocket
# Create and configure the test realm
etc/test-realm.xml
demo.realm=demo/realm.properties

View File

@ -27,7 +27,7 @@ detected.
<Set name="extractWAR">true</Set>
<Set name="copyWebDir">false</Set>
<Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Set name="overrideDescriptor"><Property name="jetty.base" default="."/>/demo/override-web.xml</Set>
<Set name="overrideDescriptor"><Property name="jetty.base" default="."/>/etc/override-web.xml</Set>
<!-- virtual hosts
@ -55,7 +55,7 @@ detected.
<Set name="loginService">
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Test Realm</Set>
<Set name="config"><SystemProperty name="jetty.base" default="."/>/demo/realm.properties</Set>
<Set name="config"><SystemProperty name="jetty.base" default="."/>/etc/realm.properties</Set>
<!-- To enable reload of realm when properties change, uncomment the following lines -->
<!-- changing refreshInterval (in seconds) as desired -->
<!--

View File

@ -1,20 +0,0 @@
#
# Jetty Demo Module
#
DEPEND=jaas
DEPEND=jndi
DEPEND=rewrite
DEPEND=client
DEPEND=annotations
DEPEND=websocket
DEPEND=deploy
LIB=demo/lib/*.jar
demo/test-realm.xml
demo/jetty-demo.xml
INI=--module=jaas
INI=demo.realm=demo/realm.properties
INI=jaas.login.conf=demo/login.conf

View File

@ -154,7 +154,7 @@ public class TestServer
// Setup context
HashLoginService login = new HashLoginService();
login.setName("Test Realm");
login.setConfig(jetty_root + "/tests/test-webapps/test-jetty-webapp/src/main/config/demo/realm.properties");
login.setConfig(jetty_root + "/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/realm.properties");
server.addBean(login);
File log=File.createTempFile("jetty-yyyy_mm_dd", "log");

View File

@ -18,14 +18,14 @@
</fileSet>
<fileSet>
<directory>target</directory>
<outputDirectory>demo/webapps</outputDirectory>
<outputDirectory>demo-base/webapps</outputDirectory>
<includes>
<include>test-jndi.xml</include>
</includes>
</fileSet>
<fileSet>
<directory>target/lib/jndi</directory>
<outputDirectory>demo/lib</outputDirectory>
<outputDirectory>demo-base/lib/ext</outputDirectory>
<includes>
<include>*.jar</include>
</includes>

View File

@ -18,14 +18,14 @@
</fileSet>
<fileSet>
<directory>target</directory>
<outputDirectory>demo/webapps</outputDirectory>
<outputDirectory>demo-base/webapps</outputDirectory>
<includes>
<include>test-spec.xml</include>
</includes>
</fileSet>
<fileSet>
<directory>target/lib/jndi</directory>
<outputDirectory>demo/lib</outputDirectory>
<outputDirectory>demo-base/lib/ext</outputDirectory>
<includes>
<include>*.jar</include>
</includes>