You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wadi-commits@incubator.apache.org by bd...@apache.org on 2005/12/14 23:36:16 UTC

svn commit: r356933 [22/35] - in /incubator/wadi/trunk: ./ etc/ modules/ modules/assembly/ modules/assembly/src/ modules/assembly/src/bin/ modules/assembly/src/conf/ modules/assembly/src/main/ modules/assembly/src/main/assembly/ modules/core/ modules/c...

Added: incubator/wadi/trunk/modules/itest/src/test/java/org/codehaus/wadi/itest/MultiNodeMultiContinerTest.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/itest/src/test/java/org/codehaus/wadi/itest/MultiNodeMultiContinerTest.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/itest/src/test/java/org/codehaus/wadi/itest/MultiNodeMultiContinerTest.java (added)
+++ incubator/wadi/trunk/modules/itest/src/test/java/org/codehaus/wadi/itest/MultiNodeMultiContinerTest.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,99 @@
+package org.codehaus.wadi.itest;
+
+import java.io.IOException;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class MultiNodeMultiContinerTest extends TestCase {
+  protected Log _log = LogFactory.getLog(getClass());
+  private static ContainerTestDecorator decorator;
+  private static String nodesProp = "red,green,blue,yellow";
+  private static String nodes[] = nodesProp.split(",");
+  private static String containersProp = "tomcat50,tomcat55,tomcat50,tomcat55";
+
+  public static Test suite() {
+    TestSuite suite = new TestSuite("tests");
+    suite.addTestSuite(MultiNodeMultiContinerTest.class);
+    try {
+      System.setProperty("nodes", nodesProp);
+      System.setProperty("containers", containersProp);
+      decorator = new ContainerTestDecorator(suite);
+    } catch (Throwable t) {
+      t.printStackTrace();
+    }
+    return decorator;
+  }
+
+  public static void main(String[] args) {
+    junit.textui.TestRunner.run(MultiNodeMultiContinerTest.class);
+  }
+
+  public MultiNodeMultiContinerTest(String name) {
+    super(name);
+  }
+
+  protected void setUp() throws Exception {
+    super.setUp();
+  }
+
+  public void testSimpleReplication() throws Exception {
+    HttpClient client = new HttpClient();
+    client.setState(new HttpState());
+    HttpMethod methods[] = new HttpMethod[nodes.length];
+    for (int i = 0; i < nodes.length; i++) {
+      methods[i] = new GetMethod("http://localhost:"
+          + decorator.getPortForNode(nodes[i]));
+    }
+    // there are no sessions so these should not return 200
+    for (int i = 0; i < methods.length; i++) {
+      assertNotSame(new Integer(200), new Integer(get(client, methods[i],
+          "/wadi-test;jsessionid=foo")));
+      methods[i] = null;
+    }
+    // create a session on each node
+    for (int i = 0; i < nodes.length; i++) {
+      methods[i] = new GetMethod("http://localhost:"
+          + decorator.getPortForNode(nodes[i]));
+    }
+    for (int i = 0; i < methods.length; i++) {
+      assertEquals("Should find the web app "
+          + methods[i].getURI().getEscapedURI() + "/wadi-test",
+          new Integer(200), new Integer(get(client, methods[i], "/wadi-test")));
+      methods[i] = null;
+    }
+    // have the methods[0] set a value the rest check the value
+    for (int i = 0; i < nodes.length; i++) {
+      methods[i] = new GetMethod("http://localhost:"
+          + decorator.getPortForNode(nodes[i]));
+    }
+    assertEquals(new Integer(200), new Integer(get(client, methods[0],
+        "/wadi-test/set.jsp")));
+    for (int i = 1; i < methods.length; i++) {
+      assertEquals(new Integer(200), new Integer(get(client, methods[i],
+          "/wadi-test/check.jsp")));
+      assertNotSame(new Integer(-1), new Integer(methods[i]
+          .getResponseBodyAsString().indexOf("foo = bar")));
+      methods[i] = null;
+    }
+  }
+
+  public int get(HttpClient client, HttpMethod method, String path)
+      throws IOException, HttpException {
+    method.setPath(path);
+    _log.debug("getting " + method.getURI().getEscapedURI());
+    client.executeMethod(method);
+    return method.getStatusCode();
+  }
+
+  protected void tearDown() throws Exception {
+    super.tearDown();
+  }
+}

Added: incubator/wadi/trunk/modules/itest/src/test/java/org/codehaus/wadi/itest/tomcat/ExtendedTomcatPropertySet.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/itest/src/test/java/org/codehaus/wadi/itest/tomcat/ExtendedTomcatPropertySet.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/itest/src/test/java/org/codehaus/wadi/itest/tomcat/ExtendedTomcatPropertySet.java (added)
+++ incubator/wadi/trunk/modules/itest/src/test/java/org/codehaus/wadi/itest/tomcat/ExtendedTomcatPropertySet.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,10 @@
+package org.codehaus.wadi.itest.tomcat;
+
+import org.codehaus.cargo.container.tomcat.TomcatPropertySet;
+
+public interface ExtendedTomcatPropertySet extends TomcatPropertySet {
+  /**
+   * The manager class name to put into the web app context.
+   */
+  String MANAGER_CLASS_NAME = "cargo.tomcat.manager.classname";
+}

Added: incubator/wadi/trunk/modules/itest/src/test/java/org/codehaus/wadi/itest/tomcat/Tomcat5xExtendedStandaloneLocalConfiguration.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/itest/src/test/java/org/codehaus/wadi/itest/tomcat/Tomcat5xExtendedStandaloneLocalConfiguration.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/itest/src/test/java/org/codehaus/wadi/itest/tomcat/Tomcat5xExtendedStandaloneLocalConfiguration.java (added)
+++ incubator/wadi/trunk/modules/itest/src/test/java/org/codehaus/wadi/itest/tomcat/Tomcat5xExtendedStandaloneLocalConfiguration.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,45 @@
+package org.codehaus.wadi.itest.tomcat;
+
+import java.io.File;
+import org.codehaus.cargo.container.deployable.WAR;
+import org.codehaus.cargo.container.tomcat.Tomcat5xStandaloneLocalConfiguration;
+
+public class Tomcat5xExtendedStandaloneLocalConfiguration extends
+    Tomcat5xStandaloneLocalConfiguration {
+
+  public Tomcat5xExtendedStandaloneLocalConfiguration(File arg0) {
+    super(arg0);
+  }
+
+  /**
+   * If the managerClassName property has been set then the Contex will have a
+   * Manager subelement that uses the specified class name.
+   * 
+   * @param deployable
+   *          the WAR to deploy
+   * @return the "context" XML element to instert in the Tomcat
+   *         <code>server.xml</code> configuration file
+   */
+  protected String createContextToken(WAR deployable) {
+    StringBuffer contextTokenValue = new StringBuffer();
+    contextTokenValue.append("<Context path=\"");
+    contextTokenValue.append("/" + deployable.getContext());
+    contextTokenValue.append("\" docBase=\"");
+    // Tomcat requires an absolute path for the "docBase" attribute.
+    contextTokenValue.append(deployable.getFile().getAbsolutePath());
+    // contextTokenValue.append("\" debug=\"");
+    // contextTokenValue.append(getTomcatLoggingLevel(
+    // getPropertyValue(GeneralPropertySet.LOGGING)));
+    String managerClassName = getPropertyValue(ExtendedTomcatPropertySet.MANAGER_CLASS_NAME);
+
+    if (null == managerClassName) {
+      contextTokenValue.append("\"/>");
+    } else {
+      contextTokenValue.append("\">");
+      contextTokenValue.append("<Manager className=\"" + managerClassName
+          + "\"/>");
+      contextTokenValue.append("</Context>");
+    }
+    return contextTokenValue.toString();
+  }
+}

Added: incubator/wadi/trunk/modules/itest/target/surefire-reports/TEST-org.codehaus.wadi.itest.MultiNodeMultiContinerTest.xml
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/itest/target/surefire-reports/TEST-org.codehaus.wadi.itest.MultiNodeMultiContinerTest.xml?rev=356933&view=auto
==============================================================================
    (empty)

Added: incubator/wadi/trunk/modules/itest/target/surefire-reports/org.codehaus.wadi.itest.MultiNodeMultiContinerTest.txt
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/itest/target/surefire-reports/org.codehaus.wadi.itest.MultiNodeMultiContinerTest.txt?rev=356933&view=auto
==============================================================================
    (empty)

Added: incubator/wadi/trunk/modules/itest/target/test-classes/org/codehaus/wadi/itest/ContainerTestDecorator.class
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/itest/target/test-classes/org/codehaus/wadi/itest/ContainerTestDecorator.class?rev=356933&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wadi/trunk/modules/itest/target/test-classes/org/codehaus/wadi/itest/ContainerTestDecorator.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wadi/trunk/modules/itest/target/test-classes/org/codehaus/wadi/itest/MultiNodeMultiContinerTest.class
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/itest/target/test-classes/org/codehaus/wadi/itest/MultiNodeMultiContinerTest.class?rev=356933&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wadi/trunk/modules/itest/target/test-classes/org/codehaus/wadi/itest/MultiNodeMultiContinerTest.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wadi/trunk/modules/itest/target/test-classes/org/codehaus/wadi/itest/tomcat/ExtendedTomcatPropertySet.class
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/itest/target/test-classes/org/codehaus/wadi/itest/tomcat/ExtendedTomcatPropertySet.class?rev=356933&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wadi/trunk/modules/itest/target/test-classes/org/codehaus/wadi/itest/tomcat/ExtendedTomcatPropertySet.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wadi/trunk/modules/itest/target/test-classes/org/codehaus/wadi/itest/tomcat/Tomcat5xExtendedStandaloneLocalConfiguration.class
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/itest/target/test-classes/org/codehaus/wadi/itest/tomcat/Tomcat5xExtendedStandaloneLocalConfiguration.class?rev=356933&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wadi/trunk/modules/itest/target/test-classes/org/codehaus/wadi/itest/tomcat/Tomcat5xExtendedStandaloneLocalConfiguration.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wadi/trunk/modules/jetty5/.classpath
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/.classpath?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/.classpath (added)
+++ incubator/wadi/trunk/modules/jetty5/.classpath Wed Dec 14 15:32:56 2005
@@ -0,0 +1,27 @@
+<classpath>
+  <classpathentry kind="src" path="src/main/java"/>
+  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" path="M2_REPO/concurrent/concurrent/1.3.4/concurrent-1.3.4.jar" sourcepath="M2_REPO/concurrent/concurrent/1.3.4/concurrent-1.3.4-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/backport-util-concurrent/backport-util-concurrent/2.0_01_pd/backport-util-concurrent-2.0_01_pd.jar"/>
+  <classpathentry kind="var" path="M2_REPO/axion/axion/1.0-M3-dev/axion-1.0-M3-dev.jar"/>
+  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/geronimo-spec/geronimo-spec-servlet/2.4-rc4/geronimo-spec-servlet-2.4-rc4.jar" sourcepath="M2_REPO/geronimo-spec/geronimo-spec-servlet/2.4-rc4/geronimo-spec-servlet-2.4-rc4-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jcache/jcache/1.0-dev-2/jcache-1.0-dev-2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/activemq/activemq/WADI-3.2/activemq-WADI-3.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/geronimo-spec/geronimo-spec-j2ee-management/1.0-rc4/geronimo-spec-j2ee-management-1.0-rc4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-primitives/commons-primitives/1.0/commons-primitives-1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/springframework/spring/1.2.5/spring-1.2.5.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar" sourcepath="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1-sources.jar"/>
+  <classpathentry kind="src" path="/wadi-core"/>
+  <classpathentry kind="var" path="M2_REPO/geronimo-spec/geronimo-spec-jms/1.1-rc4/geronimo-spec-jms-1.1-rc4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jetty/org.mortbay.jetty/5.1.9/org.mortbay.jetty-5.1.9.jar"/>
+  <classpathentry kind="var" path="M2_REPO/mx4j/mx4j/3.0.1/mx4j-3.0.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-el/commons-el/1.0/commons-el-1.0.jar" sourcepath="M2_REPO/commons-el/commons-el/1.0/commons-el-1.0-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jetty/org.mortbay.jmx/5.1.9/org.mortbay.jmx-5.1.9.jar"/>
+  <classpathentry kind="var" path="M2_REPO/regexp/regexp/1.3/regexp-1.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-httpclient/commons-httpclient/2.0.2/commons-httpclient-2.0.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/activecluster/activecluster/1.2-20051115174934/activecluster-1.2-20051115174934.jar"/>
+</classpath>
\ No newline at end of file

Added: incubator/wadi/trunk/modules/jetty5/.cvsignore
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/.cvsignore?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/.cvsignore (added)
+++ incubator/wadi/trunk/modules/jetty5/.cvsignore Wed Dec 14 15:32:56 2005
@@ -0,0 +1,5 @@
+.classpath
+.project
+.settings
+.wtpmodules
+target

Added: incubator/wadi/trunk/modules/jetty5/.project
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/.project?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/.project (added)
+++ incubator/wadi/trunk/modules/jetty5/.project Wed Dec 14 15:32:56 2005
@@ -0,0 +1,30 @@
+<projectDescription>
+  <name>wadi-jetty5</name>
+  <comment/>
+  <projects>
+    <project>wadi-core</project>
+  </projects>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.wst.common.modulecore.ComponentStructuralBuilder</name>
+      <arguments/>
+    </buildCommand>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+      <arguments/>
+    </buildCommand>
+    <buildCommand>
+      <name>org.eclipse.wst.validation.validationbuilder</name>
+      <arguments/>
+    </buildCommand>
+    <buildCommand>
+      <name>org.eclipse.wst.common.modulecore.ComponentStructuralBuilderDependencyResolver</name>
+      <arguments/>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+    <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Added: incubator/wadi/trunk/modules/jetty5/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/.settings/org.eclipse.jdt.core.prefs?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/.settings/org.eclipse.jdt.core.prefs (added)
+++ incubator/wadi/trunk/modules/jetty5/.settings/org.eclipse.jdt.core.prefs Wed Dec 14 15:32:56 2005
@@ -0,0 +1,5 @@
+#Mon Dec 12 06:20:59 MST 2005
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.4
+org.eclipse.jdt.core.compiler.compliance=1.4

Added: incubator/wadi/trunk/modules/jetty5/.wtpmodules
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/.wtpmodules?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/.wtpmodules (added)
+++ incubator/wadi/trunk/modules/jetty5/.wtpmodules Wed Dec 14 15:32:56 2005
@@ -0,0 +1,8 @@
+<project-modules id="moduleCoreId">
+  <wb-module deploy-name="wadi-jetty5">
+    <module-type module-type-id="jst.utility">
+      <property name="java-output-path" value="/target/classes"/>
+    </module-type>
+    <wb-resource deploy-path="/" source-path="src/main/java"/>
+  </wb-module>
+</project-modules>
\ No newline at end of file

Added: incubator/wadi/trunk/modules/jetty5/pom.xml
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/pom.xml?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/pom.xml (added)
+++ incubator/wadi/trunk/modules/jetty5/pom.xml Wed Dec 14 15:32:56 2005
@@ -0,0 +1,102 @@
+<project>
+    <parent>
+        <groupId>wadi</groupId>
+        <artifactId>wadi</artifactId>
+        <version>2.0M1</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>wadi-jetty5</artifactId>
+    <packaging>jar</packaging>
+    <name>WADI :: Jetty5</name>
+    <scm>
+        <connection>scm:cvs:pserver:anoncvs@cvs.wadi.codehaus.org:/home/projects/wadi/scm:wadi/modules/jetty5</connection>
+        <developerConnection>scm:cvs:ext:${maven.username}@cvs.wadi.codehaus.org/home/projects/wadi/scm:wadi/modules/jetty5</developerConnection>
+        <url>http://cvs.wadi.codehaus.org/viewrep/wadi/wadi/modules/jetty5</url>
+    </scm>
+    <dependencies>
+
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo-spec</groupId>
+            <artifactId>geronimo-spec-servlet</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>wadi</groupId>
+            <artifactId>wadi-core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>jetty</groupId>
+            <artifactId>org.mortbay.jetty</artifactId>
+            <version>5.1.9</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>jetty</groupId>
+            <artifactId>org.mortbay.jmx</artifactId>
+            <version>5.1.9</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude implementation="java.lang.String">**/TestRelocation.java</exclude><!-- hardwired paths -->
+                    </excludes>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-site-plugin</artifactId>
+                <configuration>
+                    <outputDirectory>../../wadi-site/target/site/${artifactId}</outputDirectory>
+                </configuration>
+
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <configuration>
+                    <source>1.4</source>
+                    <destDir>../../wadi-site/target/site/${artifactId}</destDir>
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <configuration>
+                    <source>1.4</source>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>surefire-report-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </reporting>
+</project>

Added: incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/Handler.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/Handler.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/Handler.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/Handler.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,62 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.jetty5;
+
+import java.util.regex.Pattern;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codehaus.wadi.Securable;
+import org.mortbay.http.HttpRequest;
+import org.mortbay.http.HttpResponse;
+import org.mortbay.http.handler.AbstractHttpHandler;
+
+/**
+ * A Jetty Handler which checks incoming proxied requests to see if they were originally from
+ * a secure connection. If this is the case, it modifies the request object so that it encodes
+ * this fact.
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell</a>
+ * @version $Revision: 1.1 $
+ */
+
+public class Handler extends AbstractHttpHandler {
+	protected final Log _log=LogFactory.getLog(getClass());
+	protected final Pattern _trustedIps;
+	
+	public Handler(Pattern trustedIps) {
+		_trustedIps=trustedIps;
+		if (_log.isInfoEnabled()) _log.info("WADI Handler in place: "+_trustedIps.pattern());
+	}
+	
+	public void handle(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) {
+		// request must have been :
+		//  proxied by WADI
+		String field=request.getField("Via");
+		if (field!=null && field.endsWith("\"WADI\"")) { // TODO - should we ignore case ?
+			String ip=request.getRemoteAddr();
+			//  from a trusted IP...
+			if (_trustedIps.matcher(ip).matches()) {
+				if (_log.isTraceEnabled()) _log.trace("securing proxied request: "+request.getRequestURL());
+				((Securable)request.getHttpConnection()).setSecure(true);
+			} else {
+				// otherwise we have a configuration issue or are being spoofed...
+				if (_log.isWarnEnabled()) _log.warn("purported WADI request arrived from suspect IP address: "+_trustedIps.pattern()+" !~ "+ip);
+			}
+		}
+	}
+}

Added: incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/HttpSession.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/HttpSession.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/HttpSession.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/HttpSession.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.jetty5;
+
+import org.codehaus.wadi.Session;
+import org.codehaus.wadi.impl.SessionWrapper;
+import org.mortbay.jetty.servlet.SessionManager;
+
+/**
+ * A SessionWrapper that integrates correctly with Jetty.
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell</a>
+ * @version $Revision: 1.1 $
+ */
+
+public class HttpSession extends SessionWrapper implements SessionManager.Session {
+
+    HttpSession(Session session) {super(session);}
+    
+    public boolean isValid() {
+        return _session.getName()!=null;
+    }
+    
+    public void access() {
+        // used by Jetty to update a Session's lastAccessedTime on each request.
+        // we want to do this ourselves.
+        
+        // ignore
+    }
+
+}

Added: incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/JettyManager.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/JettyManager.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/JettyManager.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/JettyManager.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,171 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.jetty5;
+
+import java.io.InputStream;
+import java.util.EventListener;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codehaus.wadi.ManagerConfig;
+import org.codehaus.wadi.WADIHttpSession;
+import org.codehaus.wadi.impl.AtomicallyReplicableSessionFactory;
+import org.codehaus.wadi.impl.Filter;
+import org.codehaus.wadi.impl.ListenerSupport;
+import org.codehaus.wadi.impl.SpringManagerFactory;
+import org.codehaus.wadi.impl.StandardManager;
+import org.mortbay.jetty.servlet.Dispatcher;
+import org.mortbay.jetty.servlet.ServletHandler;
+import org.mortbay.jetty.servlet.SessionManager;
+import org.mortbay.jetty.servlet.WebApplicationHandler;
+
+public class JettyManager implements ManagerConfig, SessionManager {
+	
+	protected final Log _log = LogFactory.getLog(getClass());
+	
+	protected final ListenerSupport _listeners=new ListenerSupport();
+	
+	protected StandardManager _wadi;
+	protected ServletHandler _handler;
+	protected boolean _secureCookies=false;
+	protected boolean _httpOnly=true;
+	protected boolean _useRequestedId=false;
+	
+	// org.codehaus.wadi.ManagerConfig
+	
+	public ServletContext getServletContext() {
+		return _handler.getServletContext();
+	}
+	
+	public void callback(StandardManager manager) {
+		_listeners.installListeners(manager);
+	}
+	
+	// org.mortbay.jetty.servlet.SessionManager
+	
+	public void initialize(ServletHandler handler) {
+		_handler=handler;
+		try {
+			InputStream descriptor=_handler.getHttpContext().getResource("WEB-INF/wadi-web.xml").getInputStream();
+			_wadi=(StandardManager)SpringManagerFactory.create(descriptor, "SessionManager", new AtomicallyReplicableSessionFactory(), new JettySessionWrapperFactory());
+		} catch (Exception e) {
+			throw new RuntimeException(e);
+		}
+		_wadi.init(this);
+	}
+	
+	public HttpSession getHttpSession(String id) {
+		//throw new UnsupportedOperationException();
+		return null; // FIXME - this will be the container trying to 'refresh' a session...
+	}
+	
+	public HttpSession newHttpSession(HttpServletRequest request) {
+		org.codehaus.wadi.Session session = _wadi.create();
+		if (false == session instanceof WADIHttpSession) {
+			throw new IllegalStateException(WADIHttpSession.class + " is expected.");
+		}
+		WADIHttpSession httpSession = (WADIHttpSession) session;
+		return httpSession.getWrapper();
+	}
+	
+	public boolean getSecureCookies() {
+		return _secureCookies;
+	}
+	
+	public boolean getHttpOnly() {
+		return _httpOnly;
+	}
+	
+	public int getMaxInactiveInterval() {
+		return _wadi.getMaxInactiveInterval();
+	}
+	
+	public void setMaxInactiveInterval(int seconds) {
+		_wadi.setMaxInactiveInterval(seconds);
+	}
+	
+	public void addEventListener(EventListener listener) throws IllegalArgumentException {
+		_listeners.addEventListener(listener);
+	}
+	
+	public void removeEventListener(EventListener listener) {
+		_listeners.removeEventListener(listener);
+	}
+	
+	public Cookie
+	getSessionCookie(javax.servlet.http.HttpSession session,boolean requestIsSecure)
+	{
+		if (_handler.isUsingCookies())
+		{
+			javax.servlet.http.Cookie cookie=getHttpOnly()
+			?new org.mortbay.http.HttpOnlyCookie(SessionManager.__SessionCookie,session.getId())
+					:new javax.servlet.http.Cookie(SessionManager.__SessionCookie,session.getId());
+			String domain=_handler.getServletContext().getInitParameter(SessionManager.__SessionDomain);
+			String maxAge=_handler.getServletContext().getInitParameter(SessionManager.__MaxAge);
+			String path=_handler.getServletContext().getInitParameter(SessionManager.__SessionPath);
+			if (path==null)
+				path=getUseRequestedId()?"/":_handler.getHttpContext().getContextPath();
+			if (path==null || path.length()==0)
+				path="/";
+			
+			if (domain!=null)
+				cookie.setDomain(domain);
+			if (maxAge!=null)
+				cookie.setMaxAge(Integer.parseInt(maxAge));
+			else
+				cookie.setMaxAge(-1);
+			
+			cookie.setSecure(requestIsSecure && getSecureCookies());
+			cookie.setPath(path);
+			
+			return cookie;
+		}
+		return null;
+	}
+	
+	public void start() throws Exception {
+		_wadi.start();
+		WebApplicationHandler handler=(WebApplicationHandler)_handler;
+		String name="WadiFilter";
+		handler.defineFilter(name, Filter.class.getName());;
+		handler.addFilterPathMapping("/*", name, Dispatcher.__ALL); 
+	}
+	
+	public void stop() throws InterruptedException {
+		try {
+			_wadi.stop();
+		} catch (Exception e) {
+			_log.warn("unexpected problem shutting down", e);
+		}
+	}
+	
+	public boolean isStarted() {
+		return _wadi.isStarted();
+	}
+	
+	// org.codehaus.wadi.jetty5.JettyManager
+	
+	protected boolean getUseRequestedId() {
+		return _useRequestedId;
+	}
+	
+}

Added: incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/JettySessionWrapperFactory.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/JettySessionWrapperFactory.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/JettySessionWrapperFactory.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/JettySessionWrapperFactory.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,25 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.jetty5;
+
+import org.codehaus.wadi.Session;
+
+public class JettySessionWrapperFactory implements org.codehaus.wadi.SessionWrapperFactory {
+
+    public javax.servlet.http.HttpSession create(Session session) {return new HttpSession(session);}
+
+}

Added: incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/SocketListener.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/SocketListener.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/SocketListener.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/main/java/org/codehaus/wadi/jetty5/SocketListener.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,56 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.jetty5;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.Socket;
+
+import org.codehaus.wadi.Securable;
+import org.mortbay.http.HttpListener;
+
+/**
+ * A Jetty Listener, which defines a type of Connection on which we may set a flag to indicate whether
+ * it should be considered secure.
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell</a>
+ * @version $Revision: 1.1 $
+ */
+
+public class SocketListener extends org.mortbay.http.SocketListener {
+
+	public static class HttpConnection extends org.mortbay.http.HttpConnection implements Securable {
+		
+		public HttpConnection(HttpListener listener, InetAddress remoteAddr, InputStream in, OutputStream out, Object connection) {
+			super(listener, remoteAddr, in, out, connection);
+		}
+		
+		protected boolean _secure;
+		public boolean getSecure(){return _secure;}
+		public void setSecure(boolean secure){_secure=secure;}
+	}
+	
+	protected org.mortbay.http.HttpConnection createConnection(Socket socket) throws IOException {
+		HttpConnection connection=new HttpConnection(this, socket.getInetAddress(), socket.getInputStream(), socket.getOutputStream(), socket);
+		return connection;
+	}
+	
+	public boolean isIntegral(org.mortbay.http.HttpConnection connection){return ((HttpConnection)connection).getSecure();}
+	public boolean isConfidential(org.mortbay.http.HttpConnection connection){return ((HttpConnection)connection).getSecure();}
+}

Added: incubator/wadi/trunk/modules/jetty5/src/site/apt/license.apt
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/site/apt/license.apt?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/site/apt/license.apt (added)
+++ incubator/wadi/trunk/modules/jetty5/src/site/apt/license.apt Wed Dec 14 15:32:56 2005
@@ -0,0 +1,210 @@
+Overiew
+
+  Typically the licenses listed for the project are that of the project itself, and not of dependencies.
+  
+Project License
+
+---------------
+
+                                Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

Added: incubator/wadi/trunk/modules/jetty5/src/site/resources/css/maven-theme.css
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/site/resources/css/maven-theme.css?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/site/resources/css/maven-theme.css (added)
+++ incubator/wadi/trunk/modules/jetty5/src/site/resources/css/maven-theme.css Wed Dec 14 15:32:56 2005
@@ -0,0 +1,175 @@
+body {
+        background-color: #fff;
+	font-family: Verdana, Helvetica, Arial, sans-serif;
+	margin-left: auto;
+	margin-right: auto;
+	background-repeat: repeat-y;
+	font-size: 13px;
+	padding: 0px;
+}
+td, select, input, li{
+	font-family: Verdana, Helvetica, Arial, sans-serif;
+	font-size: 12px;
+	color:#333333;
+}
+code{
+  font-size: 12px;
+}
+a {
+  text-decoration: none;
+}
+a:link {
+  color:#47a;
+}
+a:visited  {
+  color:#666666;
+}
+a:active, a:hover {
+  color:#990000;
+}
+#legend li.externalLink {
+  background: url(../images/external.png) left top no-repeat;
+  padding-left: 18px;
+}
+a.externalLink, a.externalLink:link, a.externalLink:visited, a.externalLink:active, a.externalLink:hover {
+  background: url(../images/external.png) right center no-repeat;
+  padding-right: 18px;
+}
+#legend li.newWindow {
+  background: url(../images/newwindow.png) left top no-repeat;
+  padding-left: 18px;
+}
+a.newWindow, a.newWindow:link, a.newWindow:visited, a.newWindow:active, a.newWindow:hover {
+  background: url(../images/newwindow.png) right center no-repeat;
+  padding-right: 18px;
+}
+h2 {
+	font-size: 17px;
+	color: #333333;  
+}
+h3 {
+	padding: 4px 4px 4px 24px;
+	color: #666;
+	background-color: #ccc;
+	font-weight: bold;
+	font-size: 14px;
+	background-repeat: no-repeat;
+	background-position: left bottom;
+}
+p {
+  line-height: 1.3em;
+  font-size: 12px;
+  color: #000;
+}
+#breadcrumbs {
+	height: 13px;
+	background-image: url(../images/breadcrumbs.jpg);
+	padding: 5px 10px 14px 20px;
+}
+* html #breadcrumbs {
+	padding-bottom: 8px;
+}
+#leftColumn {
+	margin: 10px 0 10px 0;
+	border-top-color: #ccc;
+	border-top-style: solid;
+	border-top-width: 1px;
+	border-right-color: #ccc;
+	border-right-style: solid;
+	border-right-width: 1px;
+	border-bottom-color: #ccc;
+	border-bottom-style: solid;
+	border-bottom-width: 1px;
+	padding-right: 5px;
+	padding-left: 5px;
+}
+#navcolumn h5 {
+	font-size: smaller;
+	border-bottom: 1px solid #aaaaaa;
+	padding-top: 2px;
+	padding-left: 9px;
+	color: #49635a;
+	background-image: url(../images/h5.jpg);
+	background-repeat: no-repeat;
+	background-position: left bottom;
+}
+
+table.bodyTable th {
+  color: white;
+  background-color: #bbb;
+  text-align: left;
+  font-weight: bold;
+}
+
+table.bodyTable th, table.bodyTable td {
+  font-size: 11px;
+}
+
+table.bodyTable tr.a {
+  background-color: #ddd;
+}
+
+table.bodyTable tr.b {
+  background-color: #eee;
+}
+
+.source {
+  border: 1px solid #999;
+  overflow:auto
+}
+dt {
+	padding: 4px 4px 4px 24px;
+	color: #333333;
+	background-color: #ccc;
+	font-weight: bold;
+	font-size: 14px;
+	background-repeat: no-repeat;
+	background-position: left bottom;
+}
+.subsectionTitle {
+	font-size: 13px;
+	font-weight: bold;
+	color: #666;
+
+}
+
+table {
+	font-size: 10px;
+}
+.xright a:link, .xright a:visited, .xright a:active {
+  color: #666;
+}
+.xright a:hover {
+  color: #003300;
+}
+#banner {
+	height: 93px;
+}
+#navcolumn ul {
+	margin: 5px 0 15px -0em;
+}
+#navcolumn ul a {
+	color: #333333;
+}
+#navcolumn ul a:hover {
+	color: red;
+}
+#intro {
+	border: solid #ccc 1px;
+	margin: 6px 0px 0px 0px;
+	padding: 10px 40px 10px 40px;
+}
+.subsection {
+	margin-left: 3px;
+	color: #333333;
+}
+
+.subsection p {
+	font-size: 12px;
+}
+#footer {
+  padding: 10px;
+  margin: 20px 0px 20px 0px;
+  border-top: solid #ccc 1px; 
+  color: #333333;
+}

Added: incubator/wadi/trunk/modules/jetty5/src/site/resources/css/site.css
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/site/resources/css/site.css?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/site/resources/css/site.css (added)
+++ incubator/wadi/trunk/modules/jetty5/src/site/resources/css/site.css Wed Dec 14 15:32:56 2005
@@ -0,0 +1,52 @@
+a.externalLink, a.externalLink:link, a.externalLink:visited, a.externalLink:active, a.externalLink:hover {
+  background: none;
+  padding-right: 0;
+}
+
+/*
+body ul {
+  list-style-type: square;
+}
+*/
+
+#downloadbox {
+  float: right;
+  margin: 0 10px 20px 20px;
+  padding: 5px;
+  border: 1px solid #999;
+  background-color: #eee;
+}
+
+#downloadbox h5 {
+  color: #000;
+  margin: 0;
+  border-bottom: 1px solid #aaaaaa;
+  font-size: smaller;
+  padding: 0;
+}
+
+#downloadbox p {
+  margin-top: 1em;
+  margin-bottom: 0;
+}
+
+#downloadbox ul {
+  margin-top: 0;
+  margin-bottom: 1em;
+  list-style-type: disc;
+}
+
+#downloadbox li {
+  font-size: smaller;
+}
+
+/*
+h4 {
+  padding: 0;
+  border: none;
+  color: #000;
+  margin: 0;
+  font-size: larger;
+  font-weight: bold;
+}
+*/

Added: incubator/wadi/trunk/modules/jetty5/src/site/resources/images/breadcrumbs.jpg
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/site/resources/images/breadcrumbs.jpg?rev=356933&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wadi/trunk/modules/jetty5/src/site/resources/images/breadcrumbs.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wadi/trunk/modules/jetty5/src/site/resources/images/codehaus-small.png
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/site/resources/images/codehaus-small.png?rev=356933&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wadi/trunk/modules/jetty5/src/site/resources/images/codehaus-small.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wadi/trunk/modules/jetty5/src/site/resources/images/folder-open.gif
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/site/resources/images/folder-open.gif?rev=356933&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wadi/trunk/modules/jetty5/src/site/resources/images/folder-open.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wadi/trunk/modules/jetty5/src/site/resources/images/h5.jpg
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/site/resources/images/h5.jpg?rev=356933&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wadi/trunk/modules/jetty5/src/site/resources/images/h5.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wadi/trunk/modules/jetty5/src/site/resources/images/wadi.png
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/site/resources/images/wadi.png?rev=356933&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wadi/trunk/modules/jetty5/src/site/resources/images/wadi.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wadi/trunk/modules/jetty5/src/site/site.xml
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/site/site.xml?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/site/site.xml (added)
+++ incubator/wadi/trunk/modules/jetty5/src/site/site.xml Wed Dec 14 15:32:56 2005
@@ -0,0 +1,24 @@
+<project name="Mojo">
+   <bannerLeft>
+      <name>WADI</name>
+      <src>/images/wadi.png</src>
+      <href>http://wadi.codehaus.org</href>
+   </bannerLeft>
+   <bannerRight>
+      <name>Codehaus</name>
+      <src>/images/codehaus-small.png</src>
+      <href>http://www.codehaus.org</href>
+   </bannerRight>
+   <body>
+      <links>
+         <item name="Geronimo" href="http://geronimo.apache.org"/>
+         <item name="Tomcat" href="http://tomcat.apache.org"/>
+         <item name="Jetty" href="http://jetty.mortbay.org/jetty/index.html"/>
+      </links>
+      
+      <menu name="WADI">
+         <item name="Wadi" href="../index.html"/>
+      </menu>
+      ${reports}
+   </body>
+</project>

Added: incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/sandbox/jmx/ManagerMBean.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/sandbox/jmx/ManagerMBean.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/sandbox/jmx/ManagerMBean.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/sandbox/jmx/ManagerMBean.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,70 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.codehaus.wadi.sandbox.jmx;
+
+import javax.management.MBeanException;
+
+import org.codehaus.wadi.jetty5.JettyManager;
+import org.mortbay.util.jmx.LifeCycleMBean;
+
+/**
+ * Publishes session manager API to JMX agent
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell</a>
+ * @version $Revision: 1.1 $
+ */
+public class
+  ManagerMBean
+  extends LifeCycleMBean
+{
+  public ManagerMBean() throws MBeanException {}
+  public ManagerMBean(JettyManager object) throws MBeanException {super(object);}
+
+  protected void
+    defineManagedResource()
+  {
+    super.defineManagedResource();
+    // jetty/Manager
+    defineAttribute("houseKeepingInterval");
+    defineAttribute("sessionCookieName");
+    defineAttribute("sessionUrlParamName");
+    // shared/Manager
+    defineAttribute("distributable");
+    defineAttribute("maxInactiveInterval");
+    // stats
+    defineAttribute("specificationVersion");
+    defineAttribute("sessionCreationCounter");
+    defineAttribute("sessionDestructionCounter");
+    defineAttribute("sessionExpirationCounter");
+    defineAttribute("sessionInvalidationCounter");
+    defineAttribute("sessionRejectionCounter");
+    defineAttribute("sessionLoadCounter");
+    defineAttribute("sessionStoreCounter");
+    defineAttribute("sessionSendCounter");
+    defineAttribute("sessionReceivedCounter");
+    defineAttribute("sessionLocalHitCounter");
+    defineAttribute("sessionStoreHitCounter");
+    defineAttribute("sessionRemoteHitCounter");
+    defineAttribute("sessionMissCounter");
+    defineAttribute("requestAcceptedCounter");
+    defineAttribute("requestRedirectedCounter");
+    defineAttribute("requestProxiedCounter");
+    defineAttribute("requestStatefulCounter");
+    defineAttribute("requestStatelessCounter");
+  }
+}

Added: incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/FilterInstance.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/FilterInstance.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/FilterInstance.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/FilterInstance.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,65 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.test;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+/**
+ * A Class that can be instantiated to a Filter that will wrap-n-delegate to
+ * another Filter instance.
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell </a>
+ * @version $Revision: 1.1 $
+ */
+
+public class FilterInstance implements Filter {
+
+	protected FilterConfig _config;
+	protected Filter _instance;
+
+	public void init(FilterConfig config) {
+		_config=config;
+	}
+
+	public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws ServletException, IOException {
+		_instance.doFilter(req, res, chain);
+	}
+
+	public void destroy() {
+		if (_instance!=null) {
+			_instance.destroy();
+			_instance=null;
+		}
+	}
+
+	public void setInstance(Filter instance) throws ServletException {
+		_instance=instance;
+		_instance.init(_config);
+	}
+
+	public Filter getInstance() {
+		return _instance;
+	}
+}
+

Added: incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/JettyNode.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/JettyNode.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/JettyNode.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/JettyNode.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,99 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.test;
+
+import java.io.IOException;
+import java.net.UnknownHostException;
+import java.util.regex.Pattern;
+
+import javax.servlet.Filter;
+import javax.servlet.Servlet;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codehaus.wadi.jetty5.Handler;
+import org.codehaus.wadi.jetty5.SocketListener;
+import org.mortbay.http.HttpHandler;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.servlet.FilterHolder;
+import org.mortbay.jetty.servlet.ServletHolder;
+import org.mortbay.jetty.servlet.WebApplicationContext;
+import org.mortbay.jetty.servlet.WebApplicationHandler;
+
+
+public class JettyNode implements Node {
+
+	public static class SwitchableListener extends SocketListener {
+		protected boolean _secure;
+		public boolean getSecure(){return _secure;}
+		public void setSecure(boolean secure){_secure=secure;}
+
+		public boolean isIntegral(org.mortbay.http.HttpConnection connection){return _secure||super.isIntegral(connection);}
+	    public boolean isConfidential(org.mortbay.http.HttpConnection connection){return _secure||super.isConfidential(connection);}
+	}
+
+	protected final Log _log;
+	protected final Server _server=new Server();
+	protected final SwitchableListener _listener=new SwitchableListener();
+	protected final WebApplicationContext _context;
+	protected final WebApplicationHandler _handler;
+	protected final FilterHolder _filterHolder;
+	protected final ServletHolder _servletHolder;
+	protected final Filter _filter;
+	protected final Servlet _servlet;
+	protected final HttpHandler _whandler;
+
+	public JettyNode(String name, String host, int port, String context, String webApp, Filter filter, Servlet servlet) throws Exception,IOException, UnknownHostException {
+		System.setProperty("org.mortbay.xml.XmlParser.NotValidating", "true");
+		_log=LogFactory.getLog(getClass().getName()+"#"+name);
+
+		_context=_server.addWebApplication(context, webApp);
+		_whandler=new Handler(Pattern.compile("127\\.0\\.0\\.1|192\\.168\\.0\\.\\d{1,3}"));
+		_context.addHandler(0, _whandler);
+		_context.start();
+		HttpHandler[] handlers=_context.getHandlers();
+		_handler=(WebApplicationHandler)handlers[1];
+		// handler
+		_filterHolder=_handler.getFilter("Filter");
+		_servletHolder=_handler.getServletHolder("Servlet");
+
+		// listener
+		_listener.setHost(host);
+		_listener.setPort(port);
+		_server.addListener(_listener);
+
+		_filter=filter;
+		_servlet=servlet;
+	}
+
+	public Filter getFilter(){return _filter;}
+	public Servlet getServlet(){return _servlet;}
+
+	public void start() throws Exception {
+		_server.start();
+		((FilterInstance)_filterHolder.getFilter()).setInstance(_filter);
+		((ServletInstance)_servletHolder.getServlet()).setInstance(_servlet);
+	}
+
+	public void stop() throws Exception {
+		_server.stop();
+	}
+
+	// Securable
+	public boolean getSecure(){return _listener.getSecure();}
+	public void setSecure(boolean secure){_listener.setSecure(secure);}
+}

Added: incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyContext.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyContext.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyContext.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyContext.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,51 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.test;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codehaus.wadi.impl.AbstractContext;
+
+public class MyContext extends AbstractContext {
+	protected static Log _log = LogFactory.getLog(MyContext.class);
+
+	protected String _val;
+	MyContext(String id, String val) {
+		//this();
+		_name=id;
+		_val=val;
+	}
+
+	MyContext() {
+		//_lock=new RWLock();
+		}
+
+	public void readContent(ObjectInput oi) throws IOException, ClassNotFoundException {
+	    _name=(String)oi.readObject();
+		_val=(String)oi.readObject();
+	}
+
+	public void writeContent(ObjectOutput oo) throws IOException {
+		oo.writeObject(_name);
+		oo.writeObject(_val);
+	}
+
+}

Added: incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyContextPool.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyContextPool.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyContextPool.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyContextPool.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,31 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.test;
+
+import org.codehaus.wadi.Context;
+import org.codehaus.wadi.ContextPool;
+
+
+public class MyContextPool implements ContextPool {
+    public void put(Context context) {
+        // we are not going to bother to pool :-)
+    }
+    
+    public Context take() {
+        return new MyContext();
+    }
+}

Added: incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyDummyHttpServletRequestWrapperPool.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyDummyHttpServletRequestWrapperPool.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyDummyHttpServletRequestWrapperPool.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyDummyHttpServletRequestWrapperPool.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,27 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.test;
+
+import org.codehaus.wadi.PoolableInvocationWrapper;
+import org.codehaus.wadi.PoolableInvocationWrapperPool;
+
+public class MyDummyHttpServletRequestWrapperPool implements PoolableInvocationWrapperPool {
+	
+	public PoolableInvocationWrapper take(){return new MyPoolableHttpServletRequestWrapper();}
+	public void put(PoolableInvocationWrapper wrapper){/* empty */}
+	
+}
\ No newline at end of file

Added: incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyFilter.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyFilter.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyFilter.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyFilter.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,83 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.test;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codehaus.wadi.InvocationException;
+import org.codehaus.wadi.impl.WebInvocationContext;
+
+public class MyFilter implements Filter {
+	protected final Log _log;
+	protected final MyServlet _servlet;
+	
+	public MyFilter(String name, MyServlet servlet) {
+		_log=LogFactory.getLog(getClass().getName()+"#"+name);
+		_servlet=servlet;
+	}
+	
+	public void init(FilterConfig config) {
+		_log.info("Filter.init()");
+	}
+	
+	public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
+	throws ServletException, IOException {
+		if (req instanceof HttpServletRequest) {
+			HttpServletRequest hreq=(HttpServletRequest)req;
+			HttpServletResponse hres=(HttpServletResponse)res;
+			String sessionId=hreq.getRequestedSessionId();
+			if ( _log.isInfoEnabled() ) {
+				_log.info("Filter.doFilter("+((sessionId==null)?"":sessionId)+")"+(hreq.isSecure()?" - SECURE":""));
+			}
+			boolean found;
+			try {
+				found = _servlet.getContextualiser().contextualise(new WebInvocationContext(hreq, hres, chain), sessionId, null, null, _exclusiveOnly);
+			} catch (InvocationException e) {
+				throw new ServletException(e);
+			}
+			
+			// only here for testing...
+			if (!found) {
+				if (_log.isErrorEnabled()) _log.error("could not locate session: "+sessionId);
+				hres.sendError(410, "could not locate session: "+sessionId);
+			}
+			
+		} else {
+			// not http - therefore stateless...
+			chain.doFilter(req, res);
+		}
+	}
+	
+	public void destroy() {
+		// can't be bothered...
+	}
+	
+	protected boolean _exclusiveOnly=false;
+	public void setExclusiveOnly(boolean exclusiveOnly){_exclusiveOnly=exclusiveOnly;}
+
+}

Added: incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyHttpServletRequest.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyHttpServletRequest.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyHttpServletRequest.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyHttpServletRequest.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,311 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.test;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+public class MyHttpServletRequest implements HttpServletRequest {
+
+    public MyHttpServletRequest() {
+        super();
+        // TODO Auto-generated constructor stub
+    }
+
+    public String getAuthType() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Cookie[] getCookies() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public long getDateHeader(String name) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public String getHeader(String name) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Enumeration getHeaders(String name) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Enumeration getHeaderNames() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public int getIntHeader(String name) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public String getMethod() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getPathInfo() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getPathTranslated() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getContextPath() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getQueryString() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getRemoteUser() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean isUserInRole(String role) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public Principal getUserPrincipal() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getRequestedSessionId() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getRequestURI() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public StringBuffer getRequestURL() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getServletPath() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public HttpSession getSession(boolean create) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public HttpSession getSession() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean isRequestedSessionIdValid() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean isRequestedSessionIdFromCookie() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean isRequestedSessionIdFromURL() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean isRequestedSessionIdFromUrl() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public Object getAttribute(String name) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Enumeration getAttributeNames() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getCharacterEncoding() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void setCharacterEncoding(String env)
+            throws UnsupportedEncodingException {
+        // TODO Auto-generated method stub
+
+    }
+
+    public int getContentLength() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public String getContentType() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public ServletInputStream getInputStream() throws IOException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getParameter(String name) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Enumeration getParameterNames() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String[] getParameterValues(String name) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Map getParameterMap() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getProtocol() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getScheme() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getServerName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public int getServerPort() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public BufferedReader getReader() throws IOException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getRemoteAddr() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getRemoteHost() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void setAttribute(String name, Object o) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void removeAttribute(String name) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public Locale getLocale() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Enumeration getLocales() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean isSecure() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public RequestDispatcher getRequestDispatcher(String path) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getRealPath(String path) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public int getRemotePort() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public String getLocalName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getLocalAddr() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public int getLocalPort() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+}

Added: incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyPoolableHttpServletRequestWrapper.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyPoolableHttpServletRequestWrapper.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyPoolableHttpServletRequestWrapper.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyPoolableHttpServletRequestWrapper.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,33 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.test;
+
+import org.codehaus.wadi.Context;
+import org.codehaus.wadi.InvocationContext;
+import org.codehaus.wadi.PoolableHttpServletRequestWrapper;
+
+class MyPoolableHttpServletRequestWrapper extends MyHttpServletRequest implements PoolableHttpServletRequestWrapper {
+	
+	public void init(InvocationContext invocationContext, Context context) {
+		/* I KNOW */
+	}
+	
+	public void destroy(){
+		/* I KNOW */
+	}
+	
+}
\ No newline at end of file