incubator-wadi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdud...@apache.org
Subject svn commit: r356933 [23/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...
Date Wed, 14 Dec 2005 23:36:16 GMT
Added: incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyServlet.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyServlet.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyServlet.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/MyServlet.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,182 @@
+/**
+ *
+ * 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.net.InetSocketAddress;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codehaus.wadi.AttributesFactory;
+import org.codehaus.wadi.Collapser;
+import org.codehaus.wadi.ContextPool;
+import org.codehaus.wadi.Contextualiser;
+import org.codehaus.wadi.InvocationProxy;
+import org.codehaus.wadi.ManagerConfig;
+import org.codehaus.wadi.ProxiedLocation;
+import org.codehaus.wadi.Relocater;
+import org.codehaus.wadi.Router;
+import org.codehaus.wadi.SessionIdFactory;
+import org.codehaus.wadi.SessionPool;
+import org.codehaus.wadi.SessionWrapperFactory;
+import org.codehaus.wadi.Streamer;
+import org.codehaus.wadi.ValuePool;
+import org.codehaus.wadi.gridstate.Dispatcher;
+import org.codehaus.wadi.gridstate.PartitionManager;
+import org.codehaus.wadi.gridstate.activecluster.ActiveClusterDispatcher;
+import org.codehaus.wadi.gridstate.impl.DummyPartitionManager;
+import org.codehaus.wadi.http.HTTPProxiedLocation;
+import org.codehaus.wadi.impl.ClusterContextualiser;
+import org.codehaus.wadi.impl.ClusteredManager;
+import org.codehaus.wadi.impl.DistributableAttributesFactory;
+import org.codehaus.wadi.impl.DistributableSessionFactory;
+import org.codehaus.wadi.impl.DistributableValueFactory;
+import org.codehaus.wadi.impl.DummyContextualiser;
+import org.codehaus.wadi.impl.DummyReplicaterFactory;
+import org.codehaus.wadi.impl.DummyRouter;
+import org.codehaus.wadi.impl.HashingCollapser;
+import org.codehaus.wadi.impl.MemoryContextualiser;
+import org.codehaus.wadi.impl.NeverEvicter;
+import org.codehaus.wadi.impl.SerialContextualiser;
+import org.codehaus.wadi.impl.SessionToContextPoolAdapter;
+import org.codehaus.wadi.impl.SimpleSessionPool;
+import org.codehaus.wadi.impl.SimpleStreamer;
+import org.codehaus.wadi.impl.SimpleValuePool;
+import org.codehaus.wadi.impl.StandardManager;
+import org.codehaus.wadi.impl.StandardSessionWrapperFactory;
+import org.codehaus.wadi.impl.StatelessContextualiser;
+import org.codehaus.wadi.impl.TomcatSessionIdFactory;
+import org.codehaus.wadi.impl.Utils;
+
+public class MyServlet implements Servlet {
+	protected ServletConfig _config;
+	protected final Log _log;
+	protected final String _clusterUri=Utils.getClusterUri();
+	protected final String _clusterName;
+	protected final String _nodeName;
+	protected final Map _clusterMap;
+	protected final Map _memoryMap;
+	protected final Relocater _relocater;
+	protected final ClusterContextualiser _clusterContextualiser;
+	protected final StatelessContextualiser _statelessContextualiser;
+	protected final SerialContextualiser _serialContextualiser;
+	protected final MemoryContextualiser _memoryContextualiser;
+	protected final Streamer _streamer=new SimpleStreamer();
+	protected final Contextualiser _dummyContextualiser=new DummyContextualiser();
+	protected final Collapser _collapser=new HashingCollapser(10, 2000);
+	protected final SessionWrapperFactory _sessionWrapperFactory=new StandardSessionWrapperFactory();
+	protected final SessionIdFactory _sessionIdFactory=new TomcatSessionIdFactory();
+	protected final boolean _accessOnLoad=true;
+	protected final Router _router=new DummyRouter();
+	protected final SessionPool _distributableSessionPool=new SimpleSessionPool(new DistributableSessionFactory());
+	protected final ContextPool _distributableContextPool=new SessionToContextPoolAdapter(_distributableSessionPool);
+	protected final AttributesFactory _distributableAttributesFactory=new DistributableAttributesFactory();
+	protected final ValuePool _distributableValuePool=new SimpleValuePool(new DistributableValueFactory());
+	protected final InvocationProxy _httpProxy;
+	protected final ProxiedLocation _proxiedLocation;
+	protected final StandardManager _manager;
+	
+	
+	public MyServlet(String nodeName, String clusterName, ContextPool contextPool, Relocater relocater, InvocationProxy httpProxy, InetSocketAddress httpAddress) throws Exception {
+		_log=LogFactory.getLog(getClass().getName()+"#"+nodeName);
+		_clusterName=clusterName;
+		_nodeName=nodeName;
+		_clusterMap=new HashMap();
+		_relocater=relocater;
+		_clusterContextualiser=new ClusterContextualiser(new DummyContextualiser(), _collapser, _relocater);
+		//(Contextualiser next, Pattern methods, boolean methodFlag, Pattern uris, boolean uriFlag)
+		Pattern methods=Pattern.compile("GET|POST", Pattern.CASE_INSENSITIVE);
+		Pattern uris=Pattern.compile(".*\\.(JPG|JPEG|GIF|PNG|ICO|HTML|HTM)(|;jsessionid=.*)", Pattern.CASE_INSENSITIVE);
+		_statelessContextualiser=new StatelessContextualiser(_clusterContextualiser, methods, true, uris, false);
+		_memoryMap=new HashMap();
+		_serialContextualiser=new SerialContextualiser(_statelessContextualiser, _collapser, _memoryMap);
+		_memoryContextualiser=new MemoryContextualiser(_serialContextualiser, new NeverEvicter(30000, true), _memoryMap, new SimpleStreamer(), contextPool, new MyDummyHttpServletRequestWrapperPool());
+		_proxiedLocation=new HTTPProxiedLocation(httpAddress);
+		_httpProxy=httpProxy;
+		PartitionManager partitionManager=new DummyPartitionManager(24);
+		Dispatcher dispatcher=new ActiveClusterDispatcher(_nodeName, _clusterName, _clusterUri, 5000L);
+		_manager=new ClusteredManager(_distributableSessionPool, _distributableAttributesFactory, _distributableValuePool, _sessionWrapperFactory, _sessionIdFactory, _memoryContextualiser, _memoryMap, _router, true, _streamer, _accessOnLoad, new DummyReplicaterFactory(), _proxiedLocation, _httpProxy, dispatcher, partitionManager, _collapser);
+	}
+	
+	public Contextualiser getContextualiser(){return _memoryContextualiser;}
+	
+	public void init(ServletConfig config) {
+		_config = config;
+		_log.info("Servlet.init()");
+		try {
+			_manager.init(new ManagerConfig() {
+				
+				public ServletContext getServletContext() {
+					return null;
+				}
+				
+				public void callback(StandardManager manager) {
+					// do nothing - should install Listeners...
+				}
+				
+			});
+			_manager.start();
+		} catch (Exception e) {
+			_log.warn(e);
+		}
+	}
+	
+	public ServletConfig getServletConfig() {
+		return _config;
+	}
+	
+	public void service(ServletRequest req, ServletResponse res) {
+		String sessionId=((HttpServletRequest)req).getRequestedSessionId();
+		if (_log.isInfoEnabled()) _log.info("Servlet.service("+((sessionId==null)?"":sessionId)+")");
+		
+		if (_test!=null)
+			_test.test(req, res);
+	}
+	
+	public String getServletInfo() {
+		return "Test Servlet";
+	}
+	
+	public void destroy() {
+		try {
+			_manager.stop();
+			_manager.destroy();
+		} catch (Exception e) {
+			_log.warn("unexpected problem", e);
+		}
+	}
+	
+	interface Test {
+		void test(ServletRequest req, ServletResponse res);
+	}
+	
+	protected Test _test;
+	public void setTest(Test test){_test=test;}
+	
+	public Map getClusterMap(){return _clusterMap;}
+	public Map getMemoryMap(){return _memoryMap;}
+	
+}

Added: incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/Node.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/Node.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/Node.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/Node.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,40 @@
+/**
+ *
+ * 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 javax.servlet.Filter;
+import javax.servlet.Servlet;
+
+import org.codehaus.wadi.Securable;
+
+
+/**
+ * TODO - JavaDoc this type
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell</a>
+ * @version $Revision: 1.1 $
+ */
+
+public interface Node extends Securable {
+	Filter getFilter();
+
+	Servlet getServlet();
+
+	void start() throws Exception;
+
+	void stop() throws Exception;
+}

Added: incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/ProxyServlet.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/ProxyServlet.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/ProxyServlet.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/ProxyServlet.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,154 @@
+/**
+ *
+ * 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.InetSocketAddress;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+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.InvocationProxy;
+import org.codehaus.wadi.ProxiedLocation;
+import org.codehaus.wadi.http.HTTPProxiedLocation;
+import org.codehaus.wadi.impl.StandardHttpProxy;
+import org.codehaus.wadi.impl.WebInvocationContext;
+import org.mortbay.http.SocketListener;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.servlet.ServletHttpContext;
+import org.mortbay.util.InetAddrPort;
+
+/**
+ * TODO - JavaDoc this type
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell</a>
+ * @version $Revision: 1.4 $
+ */
+public class ProxyServlet implements Servlet {
+	protected final Log _log = LogFactory.getLog(getClass());
+	
+	protected ServletConfig _config;
+	protected ServletContext _context;
+	
+	protected InvocationProxy _proxy=new StandardHttpProxy("jsessionid");
+	
+	public void init(ServletConfig config) {
+		_config = config;
+		_context = config.getServletContext();
+	}
+	
+	public ServletConfig getServletConfig() {
+		return _config;
+	}
+	
+	public void service(ServletRequest req, ServletResponse res) {
+		
+		HttpServletRequest hreq=(HttpServletRequest)req;
+		HttpServletResponse hres=(HttpServletResponse)res;
+		
+//		if (!_proxy.canProxy(hreq)) {
+//		_log.info("request not proxyable: "+hreq.getRequestURL());
+//		// so we can't do anything about it...
+//		return;
+//		}
+		
+		ProxiedLocation location=null;
+		try {
+			location=new HTTPProxiedLocation(new InetSocketAddress(req.getServerName(), req.getServerPort()));
+			_proxy.proxy(location, new WebInvocationContext(hreq, hres, null));
+		} catch (Exception e) {
+			hres.setHeader("Date", null);
+			hres.setHeader("Server", null);
+			hres.addHeader("Via", "1.1 (WADI)");
+			// hres.setStatus(502, message);
+			try {
+				String message="problem proxying request to; "+location;
+				_log.warn(message, e);
+				hres.sendError(502, "Bad Gateway: "+message);
+			} catch (IOException e2) {
+				_log.warn("could not return error to client", e2);
+			}
+		}
+	}
+	
+	public String getServletInfo() {
+		return "Proxy Servlet";
+	}
+	
+	public void destroy() {
+		_context=null;
+		_config=null;
+	}
+	
+	public static class RemoteDetailsServlet implements Servlet {
+		
+		protected final Log _log = LogFactory.getLog(getClass());
+		
+		public void init(ServletConfig config) {
+			// nothing to do
+		}
+		
+		public ServletConfig getServletConfig() {return null;}
+		
+		public void service(ServletRequest req, ServletResponse res) {
+			HttpServletRequest hreq=(HttpServletRequest)req;
+			if (_log.isInfoEnabled()) {
+				_log.info("Via: "+hreq.getHeader("Via"));
+				_log.info("Max-Forwards: "+hreq.getHeader("Max-Forwards"));
+				_log.info("X-Forwarded-For: "+hreq.getHeader("X-Forwarded-For"));
+				_log.info("remote location was: "+req.getRemoteAddr()+"/"+req.getRemoteHost()+":"+req.getRemotePort());
+			}
+		}
+		
+		public String getServletInfo() {return null;}
+		
+		public void destroy() {
+			// nothing to do
+		}
+	}
+	
+	public static void main(String[] args) throws Exception {
+		{
+			Server server=new Server();
+			SocketListener listener=new SocketListener(new InetAddrPort(8080));
+			listener.setMinThreads(1);
+			//listener.setMaxThreads(2000);
+			server.addListener(listener);
+			ServletHttpContext context=(ServletHttpContext)server.getContext("/");
+			context.addServlet("Proxy", "/", ProxyServlet.class.getName());
+			server.start();
+		}
+		{
+			Server server=new Server();
+			SocketListener listener=new SocketListener(new InetAddrPort(8081));
+			listener.setMinThreads(1);
+			//listener.setMaxThreads(2000);
+			server.addListener(listener);
+			ServletHttpContext context=(ServletHttpContext)server.getContext("/");
+			context.addServlet("RemoteDetails", "/", RemoteDetailsServlet.class.getName());
+			server.start();
+		}
+	}
+	
+}

Added: incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/ServletInstance.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/ServletInstance.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/ServletInstance.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/ServletInstance.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,71 @@
+/**
+ *
+ * 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.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+/**
+ * A Class that will instantiate to a Servlet that will wrap-n-delegate to
+ * another Servlet instance.
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell </a>
+ * @version $Revision: 1.1 $
+ */
+
+public class ServletInstance implements Servlet {
+
+	protected ServletConfig _config;
+	protected Servlet _instance;
+
+	public void init(ServletConfig config) {
+		_config=config;
+	}
+
+	public ServletConfig getServletConfig() {
+		return _instance.getServletConfig();
+	}
+
+	public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
+		_instance.service(req, res);
+	}
+
+	public String getServletInfo() {
+		return _instance.getServletInfo();
+	}
+
+	public void destroy() {
+		if (_instance!=null) {
+			_instance.destroy();
+			_instance=null;
+		}
+	}
+
+	public void setInstance(Servlet instance) throws ServletException {
+		_instance=instance;
+		_instance.init(_config);
+	}
+
+	public Servlet getInstance() {
+		return _instance;
+	}
+}

Added: incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/TestJetty.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/TestJetty.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/TestJetty.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/TestJetty.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,164 @@
+/**
+ *
+ * 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.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Enumeration;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+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.mortbay.http.SocketListener;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.servlet.ServletHolder;
+import org.mortbay.jetty.servlet.WebApplicationContext;
+import org.mortbay.jetty.servlet.WebApplicationHandler;
+
+import junit.framework.TestCase;
+
+/**
+ * TODO - JavaDoc this type
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell</a>
+ * @version $Revision: 1.3 $
+ */
+
+public class TestJetty extends TestCase {
+	protected Log _log;
+	protected Server _server=new Server();
+	protected SocketListener _listener=new SocketListener();
+	protected WebApplicationContext _context=new WebApplicationContext();
+	protected WebApplicationHandler _handler=new WebApplicationHandler();
+	protected ServletHolder _servletHolder;
+	protected Servlet _servlet;
+
+	public class TestServlet implements Servlet {
+
+	    public void init(ServletConfig config) {
+	        // nothing to do
+	    }
+
+	    public ServletConfig getServletConfig() {return null;}
+
+	    public String getServletInfo() {return null;}
+
+	    public void destroy() {
+	        // nothing to do
+	    }
+
+	    public void service(ServletRequest req, ServletResponse res) {
+	        HttpServletRequest hreq=(HttpServletRequest)req;
+	        HttpServletResponse hres=(HttpServletResponse)res;
+	        String name=hreq.getPathInfo();
+	        name=name.substring(1, name.length());
+            if (_log.isInfoEnabled()) _log.info("invoking: "+name);
+            Class[] argTypes=new Class[]{HttpServletRequest.class, HttpServletResponse.class};
+	        Object[] argInstances=new Object[]{hreq, hres};
+	        try {
+	            TestJetty.class.getMethod(name, argTypes).invoke(TestJetty.this, argInstances);
+	        } catch (Exception e) {
+		  _log.error(e);
+                assertTrue(false);
+	        }
+	    }
+	}
+
+	/*
+	 * @see TestCase#setUp()
+	 */
+	protected void setUp() throws Exception {
+		super.setUp();
+		_log=LogFactory.getLog(getClass().getName());
+		//servlet
+		String servletName="Servlet";
+		_servletHolder=new ServletHolder(_handler, servletName, ServletInstance.class.getName());
+		_handler.addServletHolder(_servletHolder);
+		_handler.mapPathToServlet("/*", servletName);
+		// handler
+		_context.addHandler(_handler);
+		// context
+		_context.setContextPath("/");
+		_server.addContext(_context);
+		// listener
+		_listener.setHost("localhost");
+		_listener.setPort(8080);
+		_server.addListener(_listener);
+
+		_servlet=new TestServlet();
+		System.setProperty("org.mortbay.xml.XmlParser.NotValidating", "true");
+		_server.start();
+
+		((ServletInstance)_servletHolder.getServlet()).setInstance(_servlet);
+	}
+
+	/*
+	 * @see TestCase#tearDown()
+	 */
+	protected void tearDown() throws Exception {
+		super.tearDown();
+
+		_server.stop();
+	}
+
+	/**
+	 * Constructor for TestJetty.
+	 * @param name
+	 */
+	public TestJetty(String name) {
+		super(name);
+	}
+
+	// how exactly are headers handled by Jetty ? (and hopefully Tomcat)
+	public void testHeaders() throws Exception {
+		HttpURLConnection huc=(HttpURLConnection)new URL("http://localhost:8080/testHeaders").openConnection();
+		// set headers
+		huc.addRequestProperty("A","1");
+		huc.addRequestProperty("a","2");
+		huc.addRequestProperty("b","2");
+		huc.addRequestProperty("c","3");
+
+		huc.connect();
+		assertTrue(huc.getResponseCode()==200);
+	}
+
+	public void testHeaders(HttpServletRequest hreq, HttpServletResponse hres) {
+
+        if (_log.isInfoEnabled()) _log.info("HttpServletRequest.class is: "+hreq.getClass().getName());
+
+        for (Enumeration e=hreq.getHeaderNames(); e.hasMoreElements(); ) {
+			String key=(String)e.nextElement();
+			for (Enumeration f=hreq.getHeaders(key); f.hasMoreElements(); ) {
+				String val=(String)f.nextElement();
+                if (_log.isInfoEnabled()) _log.info(key+":"+val);
+            }
+		}
+
+		for (Enumeration e=hreq.getHeaderNames(); e.hasMoreElements(); ) {
+			String key=(String)e.nextElement();
+			String val=hreq.getHeader(key);
+            if (_log.isInfoEnabled()) _log.info(key+":"+val);
+        }
+	}
+}

Added: incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/TestRelocation.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/TestRelocation.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/TestRelocation.java (added)
+++ incubator/wadi/trunk/modules/jetty5/src/test/java/org/codehaus/wadi/test/TestRelocation.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,443 @@
+/**
+ *
+ * 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.InetSocketAddress;
+import java.util.Map;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import junit.framework.TestCase;
+
+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;
+import org.codehaus.wadi.Contextualiser;
+import org.codehaus.wadi.Immoter;
+import org.codehaus.wadi.InvocationContext;
+import org.codehaus.wadi.InvocationException;
+import org.codehaus.wadi.InvocationProxy;
+import org.codehaus.wadi.Location;
+import org.codehaus.wadi.Relocater;
+import org.codehaus.wadi.gridstate.Dispatcher;
+import org.codehaus.wadi.impl.AbstractRelocater;
+import org.codehaus.wadi.impl.CommonsHttpProxy;
+import org.codehaus.wadi.impl.StandardHttpProxy;
+import org.codehaus.wadi.impl.WebHybridRelocater;
+
+import EDU.oswego.cs.dl.util.concurrent.Sync;
+
+/**
+ * Unit Tests requiring a pair of Jetty's. Each one is set up with a Filter and Servlet placeholder.
+ * These are injected with actual Filter and Servlet instances before the running of each test. This
+ * allows the tests to set up the innards of these components, make http requests to them and then inspect
+ * their innards for the expected changes,
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell</a>
+ * @version $Revision: 1.9 $
+ */
+
+public class TestRelocation extends TestCase {
+	protected Log _log = LogFactory.getLog(getClass());
+	
+	protected final String _clusterName="WADI.TEST";
+	protected Node _node0;
+	protected Node _node1;
+	protected MyFilter _filter0;
+	protected MyFilter _filter1;
+	protected MyServlet _servlet0;
+	protected MyServlet _servlet1;
+	protected Location _location0;
+	protected Location _location1;
+	protected Dispatcher _dispatcher0;
+	protected Dispatcher _dispatcher1;
+	protected SwitchableRelocater _relocater0;
+	protected SwitchableRelocater _relocater1;
+	
+	class SwitchableRelocater extends AbstractRelocater {
+		protected Relocater _delegate=new DummyRelocater();
+		
+		public void setRelocationStrategy(Relocater delegate){
+			_delegate=delegate;
+			_delegate.init(_config);
+		}
+		
+		// Relocater
+		public boolean relocate(InvocationContext invocationContext, String name, Immoter immoter, Sync motionLock) throws InvocationException {
+			return _delegate.relocate(invocationContext, name, immoter, motionLock);
+		}
+		
+	}
+	
+	class DummyRelocater extends AbstractRelocater {
+		public boolean relocate(InvocationContext invocationContext, String name, Immoter immoter, Sync motionLock) throws InvocationException {
+			return false;
+		}
+		protected Contextualiser _top;
+		public void setTop(Contextualiser top) {_top=top;}
+		public Contextualiser getTop(){return _top;}
+	}
+	
+	/*
+	 * @see TestCase#setUp()
+	 */
+	protected void setUp() throws Exception {
+		super.setUp();
+		//ConnectionFactory connectionFactory = Utils.getConnectionFactory();
+		//ClusterFactory clusterFactory       = new CustomClusterFactory(connectionFactory);
+		//String clusterName                  = "ORG.CODEHAUS.WADI.TEST.CLUSTER";
+		
+		InetSocketAddress httpAddress0=new InetSocketAddress("localhost", 8080);
+		InvocationProxy httpProxy0=new StandardHttpProxy("jsessionid");
+		_relocater0=new SwitchableRelocater();
+		_servlet0=new MyServlet("0", _clusterName, new MyContextPool(), _relocater0, httpProxy0, httpAddress0);
+		_filter0=new MyFilter("0", _servlet0);
+		// TODO - I'd like to use a TomcatNode - but using 5.0.18 it fails TestRelocation - investigate...
+		(_node0=new JettyNode("0", "localhost", 8080, "/test", "/home/jules/workspace/wadi/webapps/test", _filter0, _servlet0)).start();
+		
+		InetSocketAddress httpAddress1=new InetSocketAddress("localhost", 8081);
+		InvocationProxy httpProxy1=new CommonsHttpProxy("jsessionid");
+		_relocater1=new SwitchableRelocater();
+		_servlet1=new MyServlet("1", _clusterName, new MyContextPool(), _relocater1, httpProxy1, httpAddress1);
+		_filter1=new MyFilter("1", _servlet1);
+		(_node1=new JettyNode("1", "localhost", 8081, "/test", "/home/jules/workspace/wadi/webapps/test", _filter1, _servlet1)).start();
+		Thread.sleep(2000); // activecluster needs a little time to sort itself out...
+		_log.info("STARTING NOW!");
+	}
+	
+	/*
+	 * @see TestCase#tearDown()
+	 */
+	protected void tearDown() throws Exception {
+		_log.info("STOPPING NOW!");
+		Thread.sleep(2000); // activecluster needs a little time to sort itself out...
+		
+		_node1.stop();
+		_node0.stop();
+		super.tearDown();
+	}
+	
+	/**
+	 * Constructor for TestMigration.
+	 * @param name
+	 */
+	public TestRelocation(String name) {
+		super(name);
+	}
+	
+	public int get(HttpClient client, HttpMethod method, String path) throws IOException, HttpException {
+		client.setState(new HttpState());
+		method.recycle();
+		method.setPath(path);
+		client.executeMethod(method);
+		return method.getStatusCode();
+	}
+	
+	public void testProxyInsecureRelocation() throws Exception {
+		_relocater0.setRelocationStrategy(new WebHybridRelocater(2000, 3000, true));
+		_relocater1.setRelocationStrategy(new WebHybridRelocater(2000, 3000, true));
+		testInsecureRelocation(false);
+	}
+	
+	public void testMigrateInsecureRelocation() throws Exception {
+		//Collapser collapser=new HashingCollapser(10, 2000);
+		_relocater0.setRelocationStrategy(new WebHybridRelocater(2000, 500, true));
+		_relocater1.setRelocationStrategy(new WebHybridRelocater(2000, 500, true));
+		testInsecureRelocation(true);
+	}
+	
+	public void testInsecureRelocation(boolean migrating) throws Exception {
+		HttpClient client=new HttpClient();
+		HttpMethod method0=new GetMethod("http://localhost:8080");
+		HttpMethod method1=new GetMethod("http://localhost:8081");
+		
+		Map m0=_servlet0.getMemoryMap();
+		Map m1=_servlet1.getMemoryMap();
+		Map c0=_servlet0.getClusterMap();
+		Map c1=_servlet1.getClusterMap();
+		
+		assertTrue(m0.isEmpty());
+		assertTrue(m1.isEmpty());
+		assertTrue(c0.isEmpty());
+		assertTrue(c1.isEmpty());
+		
+		// no sessions available locally
+		_filter0.setExclusiveOnly(true);
+		assertTrue(get(client, method0, "/test;jsessionid=foo")!=200);
+		assertTrue(get(client, method0, "/test;jsessionid=bar")!=200);
+		_filter1.setExclusiveOnly(true);
+		assertTrue(get(client, method1, "/test;jsessionid=foo")!=200);
+		assertTrue(get(client, method1, "/test;jsessionid=bar")!=200);
+		
+		assertTrue(m0.isEmpty());
+		assertTrue(m1.isEmpty());
+		assertTrue(c0.isEmpty());
+		assertTrue(c1.isEmpty());
+		
+		m0.put("foo", new MyContext("foo", "1"));
+		m1.put("bar", new MyContext("bar", "2"));
+		
+		assertTrue(m0.size()==1);
+		assertTrue(m1.size()==1);
+		assertTrue(c0.isEmpty());
+		assertTrue(c1.isEmpty());
+		
+		// 2/4 sessions available locally
+		_filter0.setExclusiveOnly(true);
+		int status=get(client, method0, "/test;jsessionid=foo");
+		if (_log.isInfoEnabled()) _log.info("STATUS="+status);
+		assertTrue(status==200);
+		assertTrue(get(client, method0, "/test;jsessionid=bar")!=200);
+		_filter1.setExclusiveOnly(true);
+		assertTrue(get(client, method1, "/test;jsessionid=foo")!=200);
+		assertTrue(get(client, method1, "/test;jsessionid=bar")==200);
+		
+		assertTrue(m0.size()==1);
+		assertTrue(m1.size()==1);
+		assertTrue(c0.isEmpty());
+		assertTrue(c1.isEmpty());
+		
+		// 4/4 sessions available locally|remotely
+		_filter0.setExclusiveOnly(false);
+		assertTrue(get(client, method0, "/test;jsessionid=foo")==200);
+		assertTrue(get(client, method0, "/test;jsessionid=bar")==200);
+		
+		if (migrating) {
+			assertTrue(m0.size()==2);
+			Thread.sleep(1000); // can take a while for ACK to be processed
+			assertTrue(m1.size()==0);
+			assertTrue(c0.size()==0); // n0 has all the sessions, so needn't remember any further locations...
+			assertTrue(c1.size()==1); // bar migrated from n1 to n0, so n1 needs to remember the new location...
+		} else {
+			assertTrue(m0.size()==1);
+			assertTrue(m1.size()==1);
+			assertTrue(c0.size()==1); // n0 had to proxy a request to n1, so needs to remember the location
+			assertTrue(c1.size()==0);
+		}
+		
+		_filter1.setExclusiveOnly(false);
+		assertTrue(get(client, method1, "/test;jsessionid=foo")==200);
+		assertTrue(get(client, method1, "/test;jsessionid=bar")==200);
+		
+		if (migrating) {
+			assertTrue(m1.size()==2);
+			Thread.sleep(1000); // can take a while for ACK to be processed
+			assertTrue(m0.size()==0);
+			assertTrue(c0.size()==2); // n0 should now know that both sessions are on n1
+			if (_log.isInfoEnabled()) {
+				_log.info("M0="+m0);
+				_log.info("M1="+m1);
+				_log.info("C0="+c0);
+				_log.info("C1="+c1);
+			}
+			assertTrue(c1.size()==0); // n1 has all the sessions and doesn't need to know anything...
+		} else {
+			assertTrue(m0.size()==1);
+			assertTrue(m1.size()==1);
+			assertTrue(c0.size()==1); // location from clusterwide query has been cached
+			assertTrue(c1.size()==1); // location from clusterwide query has been cached
+		}
+		
+		// ensure that cached locations work second time around...
+		_filter0.setExclusiveOnly(false);
+		assertTrue(get(client, method0, "/test;jsessionid=foo")==200);
+		assertTrue(get(client, method0, "/test;jsessionid=bar")==200);
+		
+		if (migrating) {
+			assertTrue(m0.size()==2);
+			Thread.sleep(1000); // can take a while for ACK to be processed
+			assertTrue(m1.size()==0);
+			assertTrue(c0.size()==0); // n1 had all the sessions, now n0 has
+			assertTrue(c1.size()==2); // n1 needs to know all their new locations
+		} else {
+			assertTrue(m0.size()==1);
+			assertTrue(m1.size()==1);
+			assertTrue(c0.size()==1); // no change - everyone already knows
+			assertTrue(c1.size()==1); // all locations...
+		}
+		
+		_filter1.setExclusiveOnly(false);
+		assertTrue(get(client, method1, "/test;jsessionid=foo")==200);
+		assertTrue(get(client, method1, "/test;jsessionid=bar")==200);
+		
+		if (migrating) {
+			assertTrue(m1.size()==2);
+			Thread.sleep(1000); // can take a while for ACK to be processed
+			assertTrue(m0.size()==0);
+			assertTrue(c0.size()==2); // n0 needs to know all their new locations
+			assertTrue(c1.size()==0); // n0 had all the sessions, now n1 has
+		} else {
+			assertTrue(m0.size()==1);
+			assertTrue(m1.size()==1);
+			assertTrue(c0.size()==1);
+			assertTrue(c1.size()==1);
+		}
+	}
+	
+	public void testProxySecureRelocation() throws Exception {
+		_relocater0.setRelocationStrategy(new WebHybridRelocater(2000, 3000, true));
+		_relocater1.setRelocationStrategy(new WebHybridRelocater(2000, 3000, true));
+		testSecureRelocation(false);
+	}
+	
+	public void testMigrateSecureRelocation() throws Exception {
+		//Collapser collapser=new HashingCollapser(10, 2000);
+		_relocater0.setRelocationStrategy(new WebHybridRelocater(2000, 500, true));
+		_relocater1.setRelocationStrategy(new WebHybridRelocater(2000, 500, true));
+		testSecureRelocation(true);
+	}
+	
+	public void testSecureRelocation(boolean migrating) throws Exception {
+		HttpClient client=new HttpClient();
+		HttpMethod method0=new GetMethod("http://localhost:8080");
+		HttpMethod method1=new GetMethod("http://localhost:8081");
+		
+		Map m0=_servlet0.getMemoryMap();
+		Map m1=_servlet1.getMemoryMap();
+		Map c0=_servlet0.getClusterMap();
+		Map c1=_servlet1.getClusterMap();
+		
+		assertTrue(m0.isEmpty());
+		assertTrue(m1.isEmpty());
+		assertTrue(c0.isEmpty());
+		assertTrue(c1.isEmpty());
+		
+		m0.put("foo", new MyContext("foo", "1"));
+		m1.put("bar", new MyContext("bar", "2"));
+		
+		assertTrue(m0.size()==1);
+		assertTrue(m1.size()==1);
+		assertTrue(c0.isEmpty());
+		assertTrue(c1.isEmpty());
+		
+		assertTrue(!_node0.getSecure());
+		// won't run locally
+		assertTrue(get(client, method0, "/test/confidential;jsessionid=foo")==403); // forbidden
+		// won't run remotely
+		assertTrue(get(client, method0, "/test/confidential;jsessionid=bar")==403); // forbidden
+		
+		_node0.setSecure(true);
+		assertTrue(_node0.getSecure());
+		// will run locally - since we have declared the Listener secure
+		assertTrue(get(client, method0, "/test/confidential;jsessionid=foo")==200);
+		// will run remotely - proxy should preserve confidentiality on remote server...
+		assertTrue(get(client, method0, "/test/confidential;jsessionid=bar")==200);
+		
+		assertTrue(!_node1.getSecure());
+		// won't run locally
+		assertTrue(get(client, method1, "/test/confidential;jsessionid=bar")==403); // forbidden
+		// won't run remotely
+		assertTrue(get(client, method1, "/test/confidential;jsessionid=foo")==403); // forbidden
+		
+		_node1.setSecure(true);
+		assertTrue(_node1.getSecure());
+		// will run locally - since we have declared the Listener secure
+		assertTrue(get(client, method1, "/test/confidential;jsessionid=bar")==200);
+		// will run remotely - proxy should preserve confidentiality on remote server...
+		assertTrue(get(client, method1, "/test/confidential;jsessionid=foo")==200);
+	}
+	
+	// TODO:
+	// if we have located a session and set up a timeout, this should be released after the first proxy to it...
+	// 8080, 8081 should only be encoded once...
+	
+	static class Test implements MyServlet.Test {
+		protected int _count=0;
+		public int getCount(){return _count;}
+		public void setCount(int count){_count=count;}
+		
+		protected boolean _stateful;
+		public boolean isStateful(){return _stateful;}
+		
+		public void test(ServletRequest req, ServletResponse res){
+			_count++;
+			try {
+				((javax.servlet.http.HttpServletRequest)req).getSession();
+				_stateful=true;
+			} catch (UnsupportedOperationException ignore){
+				_stateful=false;
+			}
+		}
+	}
+	
+	public void testRelocationStatelessContextualiser() throws Exception {
+		_relocater0.setRelocationStrategy(new WebHybridRelocater(2000, 3000, true));
+		_relocater1.setRelocationStrategy(new WebHybridRelocater(2000, 3000, true));
+		testStatelessContextualiser(false);
+	}
+	
+	public void testMigrateStatelessContextualiser() throws Exception {
+		//Collapser collapser=new HashingCollapser(10, 2000);
+		_relocater0.setRelocationStrategy(new WebHybridRelocater(2000, 500, true));
+		_relocater1.setRelocationStrategy(new WebHybridRelocater(2000, 500, true));
+		testStatelessContextualiser(true);
+	}
+	
+	public void testStatelessContextualiser(boolean migrating) throws Exception {
+		
+		HttpClient client=new HttpClient();
+		HttpMethod method0=new GetMethod("http://localhost:8080");
+		HttpMethod method1=new GetMethod("http://localhost:8081");
+		
+		Map m0=_servlet0.getMemoryMap();
+		Map m1=_servlet1.getMemoryMap();
+		
+		m0.put("foo", new MyContext("foo", "1"));
+		m1.put("bar", new MyContext("bar", "2"));
+		
+		Test test;
+		
+		// this won't be proxied, because we can prove that it is stateless...
+		test=new Test();
+		_servlet0.setTest(test);
+		assertTrue(get(client, method0, "/test/static.html;jsessionid=bar")==200);
+		assertTrue(test.getCount()==1 && !test.isStateful());
+		_servlet0.setTest(null);
+		
+		MyServlet servlet;
+		
+		servlet=migrating?_servlet0:_servlet1;
+		// this will be proxied, because we cannot prove that it is stateless...
+		test=new Test();
+		servlet.setTest(test);
+		assertTrue(get(client, method0, "/test/dynamic.dyn;jsessionid=bar")==200);
+		assertTrue(test.getCount()==1 && test.isStateful());
+		servlet.setTest(null);
+		
+		// this won't be proxied, because we can prove that it is stateless...
+		test=new Test();
+		_servlet1.setTest(test);
+		assertTrue(get(client, method1, "/test/static.html;jsessionid=foo")==200);
+		assertTrue(test.getCount()==1 && !test.isStateful());
+		_servlet1.setTest(null);
+		
+		servlet=migrating?_servlet1:_servlet0;
+		// this will be proxied, because we cannot prove that it is stateless...
+		test=new Test();
+		servlet.setTest(test);
+		assertTrue(get(client, method1, "/test/dynamic.jsp;jsessionid=foo")==200);
+		assertTrue(test.getCount()==1 && test.isStateful());
+		servlet.setTest(null);
+	}
+	
+}

Added: incubator/wadi/trunk/modules/jetty6/.classpath
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty6/.classpath?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty6/.classpath (added)
+++ incubator/wadi/trunk/modules/jetty6/.classpath Wed Dec 14 15:32:56 2005
@@ -0,0 +1,26 @@
+<classpath>
+  <classpathentry kind="src" path="src/main/java"/>
+  <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/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/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/axion/axion/1.0-M3-dev/axion-1.0-M3-dev.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/org/mortbay/jetty/jetty/6.0-SNAPSHOT/jetty-6.0-SNAPSHOT.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/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/org/mortbay/jetty/servlet-api-2.5/6.0-SNAPSHOT/servlet-api-2.5-6.0-SNAPSHOT.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/jetty6/.cvsignore
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty6/.cvsignore?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty6/.cvsignore (added)
+++ incubator/wadi/trunk/modules/jetty6/.cvsignore Wed Dec 14 15:32:56 2005
@@ -0,0 +1,5 @@
+.classpath
+.project
+.settings
+.wtpmodules
+target

Added: incubator/wadi/trunk/modules/jetty6/.project
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty6/.project?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty6/.project (added)
+++ incubator/wadi/trunk/modules/jetty6/.project Wed Dec 14 15:32:56 2005
@@ -0,0 +1,30 @@
+<projectDescription>
+  <name>wadi-jetty6</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/jetty6/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty6/.settings/org.eclipse.jdt.core.prefs?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty6/.settings/org.eclipse.jdt.core.prefs (added)
+++ incubator/wadi/trunk/modules/jetty6/.settings/org.eclipse.jdt.core.prefs Wed Dec 14 15:32:56 2005
@@ -0,0 +1,5 @@
+#Mon Dec 12 11:31:44 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/jetty6/.wtpmodules
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty6/.wtpmodules?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty6/.wtpmodules (added)
+++ incubator/wadi/trunk/modules/jetty6/.wtpmodules Wed Dec 14 15:32:56 2005
@@ -0,0 +1,8 @@
+<project-modules id="moduleCoreId">
+  <wb-module deploy-name="wadi-jetty6">
+    <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/jetty6/pom.xml
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty6/pom.xml?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty6/pom.xml (added)
+++ incubator/wadi/trunk/modules/jetty6/pom.xml Wed Dec 14 15:32:56 2005
@@ -0,0 +1,90 @@
+<project>
+    <parent>
+        <groupId>wadi</groupId>
+        <artifactId>wadi</artifactId>
+        <version>2.0M1</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>wadi-jetty6</artifactId>
+    <packaging>jar</packaging>
+    <name>WADI :: Jetty6</name>
+    <scm>
+        <connection>scm:cvs:pserver:anoncvs@cvs.wadi.codehaus.org:/home/projects/wadi/scm:wadi/modules/jetty6</connection>
+        <developerConnection>scm:cvs:ext:${maven.username}@cvs.wadi.codehaus.org/home/projects/wadi/scm:wadi/modules/jetty6</developerConnection>
+        <url>http://cvs.wadi.codehaus.org/viewrep/wadi/wadi/modules/jetty6</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>org.mortbay.jetty</groupId>
+            <artifactId>jetty</artifactId>
+            <version>6.0-SNAPSHOT</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>
+            </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/jetty6/src/main/java/org/codehaus/wadi/jetty6/Connector.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty6/src/main/java/org/codehaus/wadi/jetty6/Connector.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty6/src/main/java/org/codehaus/wadi/jetty6/Connector.java (added)
+++ incubator/wadi/trunk/modules/jetty6/src/main/java/org/codehaus/wadi/jetty6/Connector.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,63 @@
+/**
+ *
+ * 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.jetty6;
+
+import java.util.regex.Pattern;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+
+/**
+ * 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.2 $
+ */
+
+public class Connector extends SelectChannelConnector {
+	
+	protected final Log _log=LogFactory.getLog(getClass());
+	protected final Pattern _trustedIps;
+	
+	public Connector(Pattern trustedIps) {
+		_trustedIps=trustedIps;
+		if (_log.isInfoEnabled()) _log.info("WADI Handler in place: "+_trustedIps.pattern());
+	}
+	
+	public boolean isConfidential(Request request) {
+		// request must have been :
+		//  proxied by WADI
+		String field=request.getHeader("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());
+				return 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);
+				return false;
+			}
+		}
+		return true;
+	}
+	
+}

Added: incubator/wadi/trunk/modules/jetty6/src/main/java/org/codehaus/wadi/jetty6/HttpSession.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty6/src/main/java/org/codehaus/wadi/jetty6/HttpSession.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty6/src/main/java/org/codehaus/wadi/jetty6/HttpSession.java (added)
+++ incubator/wadi/trunk/modules/jetty6/src/main/java/org/codehaus/wadi/jetty6/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.jetty6;
+
+import org.codehaus.wadi.Session;
+import org.codehaus.wadi.impl.SessionWrapper;
+import org.mortbay.jetty.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/jetty6/src/main/java/org/codehaus/wadi/jetty6/JettyManager.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty6/src/main/java/org/codehaus/wadi/jetty6/JettyManager.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty6/src/main/java/org/codehaus/wadi/jetty6/JettyManager.java (added)
+++ incubator/wadi/trunk/modules/jetty6/src/main/java/org/codehaus/wadi/jetty6/JettyManager.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,188 @@
+/**
+ *
+ * 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.jetty6;
+
+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.ListenerSupport;
+import org.codehaus.wadi.impl.SpringManagerFactory;
+import org.codehaus.wadi.impl.StandardManager;
+import org.mortbay.jetty.handler.ContextHandler;
+import org.mortbay.jetty.HttpOnlyCookie;
+import org.mortbay.jetty.SessionManager;
+import org.mortbay.component.AbstractLifeCycle;
+
+public class JettyManager extends AbstractLifeCycle implements ManagerConfig, SessionManager {
+	
+	protected final Log _log = LogFactory.getLog(getClass());
+	
+	protected final ListenerSupport _listeners=new ListenerSupport();
+	
+	protected StandardManager _wadi;
+	protected ContextHandler.Context _context;
+	protected boolean _usingCookies=true;
+	protected int _maxInactiveInterval=60*30;
+	
+	// org.codehaus.wadi.ManagerConfig
+	
+	public ServletContext getServletContext() {
+		return _context;
+	}
+	
+	public void callback(StandardManager manager) {
+		_listeners.installListeners(manager);
+	}
+	
+	// org.mortbay.thread.AbstractLifecycle
+	
+	public void doStart() throws Exception {
+		_context=ContextHandler.getCurrentContext();
+		
+		try {
+			InputStream descriptor=_context.getContextHandler().getBaseResource().addPath("WEB-INF/wadi-web.xml").getInputStream();
+			_wadi=(StandardManager)SpringManagerFactory.create(descriptor, "SessionManager", new AtomicallyReplicableSessionFactory(), new JettySessionWrapperFactory());
+		} catch (Exception e) {
+			throw new RuntimeException(e);
+		}
+		
+		_wadi.setMaxInactiveInterval(_maxInactiveInterval);
+		_wadi.init(this);
+		_wadi.start();
+	}
+	
+	public void doStop() throws InterruptedException {
+		try {
+			_wadi.stop();
+		} catch (Exception e) {
+			_log.warn("unexpected problem shutting down", e);
+		}
+	}
+	
+	// org.mortbay.jetty.SessionManager
+	
+	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();
+	}
+	
+	protected boolean _secureCookies=false;
+	
+	public boolean getSecureCookies() {
+		return _secureCookies;
+	}
+	
+	protected boolean _httpOnly=true;
+	
+	public boolean getHttpOnly() {
+		return _httpOnly;
+	}
+	
+	public int getMaxInactiveInterval() {
+		return _wadi.getMaxInactiveInterval();
+	}
+	
+	public void setMaxInactiveInterval(int seconds) {
+		_maxInactiveInterval=seconds;
+	}
+	
+	public void addEventListener(EventListener listener) throws IllegalArgumentException, IllegalStateException {
+		_listeners.addEventListener(listener);
+	}
+	
+	public void removeEventListener(EventListener listener) throws IllegalStateException {
+		_listeners.removeEventListener(listener);
+	}
+	
+	// cut-n-pasted from Jetty src - aargh !
+	// Greg uses Apache-2.0 as well - so no licensing issue as yet - TODO
+	
+	// now out of date - refresh - TODO
+	public Cookie
+	getSessionCookie(javax.servlet.http.HttpSession session, String contextPath, boolean requestIsSecure)
+	{
+		if (isUsingCookies())
+		{
+			Cookie cookie = getHttpOnly()
+			?new HttpOnlyCookie(SessionManager.__SessionCookie,session.getId())
+					:new Cookie(SessionManager.__SessionCookie,session.getId());
+			
+			cookie.setPath(contextPath==null?"/":contextPath);
+			cookie.setMaxAge(-1);
+			cookie.setSecure(requestIsSecure && getSecureCookies());
+			
+			if (_context!=null)
+			{
+				String domain=_context.getInitParameter(SessionManager.__SessionDomain);
+				String maxAge=_context.getInitParameter(SessionManager.__MaxAge);
+				String path=_context.getInitParameter(SessionManager.__SessionPath);
+				
+				if (path!=null)
+					cookie.setPath(path);
+				if (domain!=null)
+					cookie.setDomain(domain);
+				if (maxAge!=null)
+					cookie.setMaxAge(Integer.parseInt(maxAge));
+			}
+			
+			return cookie;
+		}
+		return null;
+	}
+	
+	protected MetaManager _metaManager;
+	
+	public MetaManager getMetaManager() {
+		return _metaManager;
+	}
+	
+	public void setMetaManager(MetaManager metaManager) {
+		_metaManager=metaManager;
+	}
+	
+	// org.codehaus.wadi.jetty6.JettyManagerLoader
+	
+	protected boolean isUsingCookies() {
+		return _usingCookies;
+	}
+	
+	// TODO - implement ?
+	public void clearEventListeners() {
+		_log.warn("NYI");
+	}
+	
+}

Added: incubator/wadi/trunk/modules/jetty6/src/main/java/org/codehaus/wadi/jetty6/JettySessionWrapperFactory.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty6/src/main/java/org/codehaus/wadi/jetty6/JettySessionWrapperFactory.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty6/src/main/java/org/codehaus/wadi/jetty6/JettySessionWrapperFactory.java (added)
+++ incubator/wadi/trunk/modules/jetty6/src/main/java/org/codehaus/wadi/jetty6/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.jetty6;
+
+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/jetty6/src/site/apt/license.apt
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty6/src/site/apt/license.apt?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty6/src/site/apt/license.apt (added)
+++ incubator/wadi/trunk/modules/jetty6/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/jetty6/src/site/resources/css/maven-theme.css
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty6/src/site/resources/css/maven-theme.css?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty6/src/site/resources/css/maven-theme.css (added)
+++ incubator/wadi/trunk/modules/jetty6/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/jetty6/src/site/resources/css/site.css
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty6/src/site/resources/css/site.css?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty6/src/site/resources/css/site.css (added)
+++ incubator/wadi/trunk/modules/jetty6/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/jetty6/src/site/resources/images/breadcrumbs.jpg
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty6/src/site/resources/images/breadcrumbs.jpg?rev=356933&view=auto
==============================================================================
Binary file - no diff available.

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

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

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

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

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

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

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

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

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

Added: incubator/wadi/trunk/modules/jetty6/src/site/site.xml
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/jetty6/src/site/site.xml?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/jetty6/src/site/site.xml (added)
+++ incubator/wadi/trunk/modules/jetty6/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/openejb/ROADMAP.txt
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/openejb/ROADMAP.txt?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/openejb/ROADMAP.txt (added)
+++ incubator/wadi/trunk/modules/openejb/ROADMAP.txt Wed Dec 14 15:32:56 2005
@@ -0,0 +1,99 @@
+
+This is a very brief braindump of how I imagine OpenEJB might be
+clustered using WADI. It's probably a little confused because it's
+beena while since I did any EJB stuff, but the broad outline should be
+OK. Anyone interested in getting this going should start here....
+
+
+OpenEJB clustering on top of WADI technology will require the
+following :
+
+Some form of JNDI service (ultimately this will need to be HA)
+
+     I guess OpenEJB must come with instructions for setting up a
+     simple JNDI service.
+
+Server-side :
+
+	    OpenEJB will need to store its SFSBs in WADI's distributed
+	    cache and adhere to WADI locking policies (still under
+	    construction).
+
+
+Client-side :
+
+	    Clustered OpenEJBs will need to register cluster-aware
+	    Home and Bean stubs with JNDI on deployment.
+
+	    A Client/Server interaction might go something like this :
+
+	      Client locates a JNDI service somehow (for HA-JNDI, this
+	      will probably be via some form of autodiscovery)
+
+	      Client d/ls and runs a Home stub.
+
+	      Home stub may contain details of all OpenEJB services
+	      within cluster at its registration time, or use
+	      autodiscovery again to locate one
+
+	      Client uses Home stub to talk to an OpenEJB service and
+	      create() e.g. an SFSB
+
+	      OpenEJB container returns a cluster-aware Bean stub.
+
+	      The type of Bean stub should contain a pluggable
+	      'Coordinator' component (the location it came from and a
+	      list of the other OpenEJB services in the same cluster)
+
+	      Different modes of 'Coordination' available would
+	      include e.g. :
+
+			Sticky (client always returns to same OpenEJB
+			instance for service - used with SFSB to avoid
+			unnecessary migration)
+
+			PseudoRandom (client can use any OpenEJB
+			service that has this Bean deployed - used
+			with e.g. SLSB, Homes etc)
+
+			... (Other load-balancing algorithms)
+
+			SLSBs and Entities might use a sticky
+			coordinator just to save cycles, but should
+			not reqire it.
+
+			SFSBs should also work without sticky but will
+			stress distributed cache as state is
+			transferred back and forth unnecessarily
+
+	      If the service to which a client is 'stuck' should
+	      disappear, that client's stub should have a list
+	      (updated at last call to the service when it was alive)
+	      of all the other nodes in the cluster (If none of these
+	      nodes remain, but others have taken their place, falling
+	      back to autodiscovery should locate a running
+	      service). Once the client has located a running OpenEJB
+	      service it may send it an invocation for its
+	      e.g. SFSB. This Bean may, by now live somewhere else. A
+	      distributable Invocation object will be passed from
+	      OpenEJB to WADI's Distributed cache which will decide
+	      whether to migrate the SFSB in under the Invocation and
+	      run it locally, whether to send a 'redirect' message
+	      back to the client stub, with the new whereabouts of the
+	      SFSB, or whether to act as a proxy and forward the
+	      Invocation to the SFSB location where it can be
+	      successfully run (returning the new location in the
+	      response so that the client stub knows where to find it
+	      the next time).
+
+	      WADI's distributed cache will manage replication and
+	      location of all state stored within it.
+
+
+	      Later, all this will need to be tied in to ideas that I
+	      have for a cluster-wide Application or User scoped
+	      Session object, to allow colocation of related resources
+	      - see thread on g-dev.
+
+
+Jules

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



Mime
View raw message