diff --git a/VERSION.txt b/VERSION.txt
index c0eab2859dd..2fa339520c3 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1,4 +1,7 @@
jetty-7.0.1-SNAPSHOT
+ + Refactored continuation test harnessess
+ + Continuations ISE rather than ignore bad transitions
+ + Improved start.jar usage text for properties
+ Promoted Jetty WebApp Verifier from Sandbox
+ Promoted Jetty Centralized Logging from Sandbox
+ 274251 DefaultServlet supports exact match mode.
@@ -15,14 +18,16 @@ jetty-7.0.1-SNAPSHOT
+ 291340 Race condition in onException() notifications
+ 291543 make bin/*.sh scripts executable in distribution
+ 291589 Update jetty-rewrite demo
+
+jetty-7.0.0.v20091005 5 October 2009
+291340 Race condition in onException() notifications
-jetty-7.0.0.v20091005 October 5 2009
+jetty-7.0.0.RC6 September 21 2009
+ + Fixed XSS issue in CookieDump demo servlet.
+ 289958 StatisticsServlet incorrectly adds StatisticsHandler
- + Remove printlns from jetty-plus
+ + 289960 start.jar assumes command line args are configs
+ 290081 Eager consume LF after CR
+ 290761 HttpExchange isDone handles intercepted events.
-
-jetty-7.0.0.RC6 September 18th 2009
+ JETTY-719 Document state machine of jetty http client
+ JETTY-780 CNFE during startup of webapp with spring-context >= 2.5.1
+ JETTY-936 274251 Improved servlet matching and optimized'
diff --git a/jetty-continuation/src/main/java/org/eclipse/jetty/continuation/ContinuationListener.java b/jetty-continuation/src/main/java/org/eclipse/jetty/continuation/ContinuationListener.java
index 7eb57660656..54581a8f5b1 100644
--- a/jetty-continuation/src/main/java/org/eclipse/jetty/continuation/ContinuationListener.java
+++ b/jetty-continuation/src/main/java/org/eclipse/jetty/continuation/ContinuationListener.java
@@ -6,7 +6,6 @@ import java.util.EventListener;
import javax.servlet.ServletRequestListener;
-
/* ------------------------------------------------------------ */
/** A Continuation Listener
*
@@ -35,4 +34,5 @@ public interface ContinuationListener extends EventListener
* @param continuation
*/
public void onTimeout(Continuation continuation);
+
}
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContext.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContext.java
index a0686694fea..2f6ed1e9aba 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContext.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContext.java
@@ -17,6 +17,8 @@ import javax.servlet.ServletContext;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
+import org.eclipse.jetty.continuation.ContinuationListener;
+
/* temporary interface in anticipation of servlet 3.0 */
public interface AsyncContext
{
@@ -34,6 +36,8 @@ public interface AsyncContext
public void dispatch(ServletContext context, String path);
public void complete();
public void start(Runnable run);
+ public void setTimeout(long ms);
+ public void addContinuationListener(ContinuationListener listener);
}
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContinuation.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContinuation.java
index 4fe41e275a5..646c14fbad6 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContinuation.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContinuation.java
@@ -13,6 +13,9 @@
package org.eclipse.jetty.server;
+import java.util.ArrayList;
+import java.util.List;
+
import javax.servlet.ServletContext;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
@@ -25,7 +28,6 @@ import org.eclipse.jetty.io.AsyncEndPoint;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandler.Context;
-import org.eclipse.jetty.util.LazyList;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.thread.Timeout;
@@ -66,7 +68,7 @@ public class AsyncContinuation implements AsyncContext, Continuation
/* ------------------------------------------------------------ */
protected HttpConnection _connection;
- private Object _listeners;
+ private List _continuationListeners;
/* ------------------------------------------------------------ */
private int _state;
@@ -78,15 +80,11 @@ public class AsyncContinuation implements AsyncContext, Continuation
private AsyncEventState _event;
private volatile long _expireAt;
-// private StringBuilder _history = new StringBuilder();
-
/* ------------------------------------------------------------ */
protected AsyncContinuation()
{
_state=__IDLE;
_initial=true;
-// _history.append(super.toString());
-// _history.append('\n');
}
/* ------------------------------------------------------------ */
@@ -95,8 +93,6 @@ public class AsyncContinuation implements AsyncContext, Continuation
synchronized(this)
{
_connection=connection;
-// _history.append(connection.toString());
-// _history.append('\n');
}
}
@@ -105,24 +101,23 @@ public class AsyncContinuation implements AsyncContext, Continuation
{
synchronized(this)
{
- _listeners=LazyList.add(_listeners,listener);
-// _history.append('L');
+ if (_continuationListeners==null)
+ _continuationListeners=new ArrayList();
+ _continuationListeners.add(listener);
}
}
/* ------------------------------------------------------------ */
- public void setAsyncTimeout(long ms)
+ public void setTimeout(long ms)
{
synchronized(this)
{
_timeoutMs=ms;
-// _history.append('T');
-// _history.append(ms);
}
}
/* ------------------------------------------------------------ */
- public long getAsyncTimeout()
+ public long getTimeout()
{
synchronized(this)
{
@@ -220,34 +215,22 @@ public class AsyncContinuation implements AsyncContext, Continuation
}
/* ------------------------------------------------------------ */
- /* (non-Javadoc)
- * @see javax.servlet.ServletRequest#resume()
+ /**
+ * @return false if the handling of the request should not proceed
*/
protected boolean handling()
{
synchronized (this)
{
-// _history.append('H');
-// _history.append(_connection.getRequest().getUri().toString());
-// _history.append(':');
_responseWrapped=false;
switch(_state)
{
- case __DISPATCHED:
- case __REDISPATCHED:
- case __COMPLETED:
- throw new IllegalStateException(this.getStatusString());
-
case __IDLE:
_initial=true;
_state=__DISPATCHED;
return true;
-
- case __ASYNCSTARTED:
- case __REDISPATCHING:
- throw new IllegalStateException(this.getStatusString());
-
+
case __COMPLETING:
_state=__UNCOMPLETED;
return false;
@@ -260,7 +243,7 @@ public class AsyncContinuation implements AsyncContext, Continuation
return true;
default:
- throw new IllegalStateException(""+_state);
+ throw new IllegalStateException(this.getStatusString());
}
}
}
@@ -275,11 +258,9 @@ public class AsyncContinuation implements AsyncContext, Continuation
{
synchronized (this)
{
-// _history.append('S');
_resumed=false;
_expired=false;
- // TODO move this to callers
if (_event==null || request!=_event.getRequest() || response != _event.getResponse() || context != _event.getServletContext())
_event=new AsyncEventState(context,request,response);
else
@@ -293,25 +274,13 @@ public class AsyncContinuation implements AsyncContext, Continuation
case __DISPATCHED:
case __REDISPATCHED:
_state=__ASYNCSTARTED;
- return;
-
- case __IDLE:
- throw new IllegalStateException(this.getStatusString());
-
- case __ASYNCSTARTED:
- case __REDISPATCHING:
- return;
-
- case __COMPLETING:
- case __ASYNCWAIT:
- case __REDISPATCH:
- case __COMPLETED:
- throw new IllegalStateException(this.getStatusString());
+ break;
default:
- throw new IllegalStateException(""+_state);
+ throw new IllegalStateException(this.getStatusString());
}
}
+
}
/* ------------------------------------------------------------ */
@@ -326,7 +295,8 @@ public class AsyncContinuation implements AsyncContext, Continuation
{
synchronized (this)
{
-// _history.append('U');
+ List listeners=_continuationListeners;
+
switch(_state)
{
case __REDISPATCHED:
@@ -362,8 +332,6 @@ public class AsyncContinuation implements AsyncContext, Continuation
_state=__UNCOMPLETED;
return true;
- case __ASYNCWAIT:
- case __REDISPATCH:
default:
throw new IllegalStateException(this.getStatusString());
}
@@ -376,18 +344,8 @@ public class AsyncContinuation implements AsyncContext, Continuation
boolean dispatch=false;
synchronized (this)
{
-// _history.append('D');
switch(_state)
{
- case __REDISPATCHED:
- case __DISPATCHED:
- case __IDLE:
- case __REDISPATCHING:
- case __COMPLETING:
- case __COMPLETED:
- case __UNCOMPLETED:
- return;
-
case __ASYNCSTARTED:
_state=__REDISPATCHING;
_resumed=true;
@@ -417,17 +375,17 @@ public class AsyncContinuation implements AsyncContext, Continuation
/* ------------------------------------------------------------ */
protected void expired()
{
- Object listeners=null;
+ final List listeners;
synchronized (this)
{
-// _history.append('E');
switch(_state)
{
case __ASYNCSTARTED:
case __ASYNCWAIT:
- listeners=_listeners;
+ listeners=_continuationListeners;
break;
default:
+ listeners=null;
return;
}
_expired=true;
@@ -435,16 +393,11 @@ public class AsyncContinuation implements AsyncContext, Continuation
if (listeners!=null)
{
- for(int i=0;i listeners;
synchronized (this)
{
-// _history.append("c");
switch(_state)
{
case __UNCOMPLETED:
_state=__COMPLETED;
- listeners=_listeners;
+ listeners=_continuationListeners;
break;
default:
+ listeners=null;
throw new IllegalStateException(this.getStatusString());
}
}
-
+
if (listeners!=null)
{
- for(int i=0;i0)
- baseRequest.setAsyncTimeout(_suspendFor);
- baseRequest.addEventListener(__asyncListener);
final AsyncContext asyncContext = baseRequest.startAsync();
+ asyncContext.addContinuationListener(__asyncListener);
+ if (_suspendFor>0)
+ asyncContext.setTimeout(_suspendFor);
if (_completeAfter>0)
{
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/AsyncStressTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/AsyncStressTest.java
index 9d16d60ebf6..fe43336eaf8 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/AsyncStressTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/AsyncStressTest.java
@@ -214,12 +214,11 @@ public class AsyncStressTest extends TestCase
if (suspend_for>=0)
{
- if (suspend_for>0)
- baseRequest.setAsyncTimeout(suspend_for);
- baseRequest.addEventListener(__asyncListener);
final AsyncContext asyncContext = baseRequest.startAsync();
-
-
+ asyncContext.addContinuationListener(__asyncListener);
+ if (suspend_for>0)
+ asyncContext.setTimeout(suspend_for);
+
if (complete_after>0)
{
TimerTask complete = new TimerTask()
@@ -241,7 +240,6 @@ public class AsyncStressTest extends TestCase
System.err.println(uri+"=="+br.getUri());
System.err.println(asyncContext+"=="+br.getAsyncContinuation());
- System.err.println(((AsyncContinuation)asyncContext).getHistory());
Log.warn(e);
System.exit(1);
}
diff --git a/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationBioFauxTest.java b/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationBioFauxTest.java
new file mode 100644
index 00000000000..141e5e5b766
--- /dev/null
+++ b/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationBioFauxTest.java
@@ -0,0 +1,151 @@
+// ========================================================================
+// Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+
+package org.eclipse.jetty.continuation;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.jetty.continuation.test.ContinuationBase;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.bio.SocketConnector;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.jetty.servlet.Context;
+import org.mortbay.jetty.servlet.FilterHolder;
+import org.mortbay.jetty.servlet.ServletHandler;
+import org.mortbay.jetty.servlet.ServletHolder;
+import org.mortbay.util.IO;
+
+
+public class Jetty6ContinuationBioFauxTest extends ContinuationBase
+{
+ protected Server _server = new Server();
+ protected ServletHandler _servletHandler;
+ protected SocketConnector _socketConnector;
+ FilterHolder _filter;
+
+ protected void setUp() throws Exception
+ {
+ _socketConnector = new SocketConnector();
+ _server.setConnectors(new Connector[]{ _socketConnector });
+ Context servletContext = new Context(Context.NO_SECURITY|Context.NO_SESSIONS);
+ _server.setHandler(servletContext);
+ _servletHandler=servletContext.getServletHandler();
+ ServletHolder holder=new ServletHolder(_servlet);
+ _servletHandler.addServletWithMapping(holder,"/");
+ _filter=_servletHandler.addFilterWithMapping(ContinuationFilter.class,"/*",0);
+
+ _filter.setInitParameter("debug","true");
+ _filter.setInitParameter("faux","true");
+ _server.start();
+
+ _port=_socketConnector.getLocalPort();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ _server.stop();
+ }
+
+ public void testContinuation() throws Exception
+ {
+ doNormal("FauxContinuation");
+ }
+
+ public void testSleep() throws Exception
+ {
+ doSleep();
+ }
+
+ public void testSuspend() throws Exception
+ {
+ doSuspend();
+ }
+
+ public void testSuspendWaitResume() throws Exception
+ {
+ doSuspendWaitResume();
+ }
+
+ public void testSuspendResume() throws Exception
+ {
+ doSuspendResume();
+ }
+
+ public void testSuspendWaitComplete() throws Exception
+ {
+ doSuspendWaitComplete();
+ }
+
+ public void testSuspendComplete() throws Exception
+ {
+ doSuspendComplete();
+ }
+
+ public void testSuspendWaitResumeSuspendWaitResume() throws Exception
+ {
+ doSuspendWaitResumeSuspendWaitResume();
+ }
+
+ public void testSuspendWaitResumeSuspendComplete() throws Exception
+ {
+ doSuspendWaitResumeSuspendComplete();
+ }
+
+ public void testSuspendWaitResumeSuspend() throws Exception
+ {
+ doSuspendWaitResumeSuspend();
+ }
+
+ public void testSuspendTimeoutSuspendResume() throws Exception
+ {
+ doSuspendTimeoutSuspendResume();
+ }
+
+ public void testSuspendTimeoutSuspendComplete() throws Exception
+ {
+ doSuspendTimeoutSuspendComplete();
+ }
+
+ public void testSuspendTimeoutSuspend() throws Exception
+ {
+ doSuspendTimeoutSuspend();
+ }
+
+ public void testSuspendThrowResume() throws Exception
+ {
+ doSuspendThrowResume();
+ }
+
+ public void testSuspendResumeThrow() throws Exception
+ {
+ doSuspendResumeThrow();
+ }
+
+ public void testSuspendThrowComplete() throws Exception
+ {
+ doSuspendThrowComplete();
+ }
+
+ public void testSuspendCompleteThrow() throws Exception
+ {
+ doSuspendCompleteThrow();
+ }
+
+ protected String toString(InputStream in) throws IOException
+ {
+ return IO.toString(in);
+ }
+
+}
diff --git a/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationBioTest.java b/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationBioTest.java
new file mode 100644
index 00000000000..eedbf267fb8
--- /dev/null
+++ b/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationBioTest.java
@@ -0,0 +1,151 @@
+// ========================================================================
+// Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+
+package org.eclipse.jetty.continuation;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.jetty.continuation.test.ContinuationBase;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.bio.SocketConnector;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.jetty.servlet.Context;
+import org.mortbay.jetty.servlet.FilterHolder;
+import org.mortbay.jetty.servlet.ServletHandler;
+import org.mortbay.jetty.servlet.ServletHolder;
+import org.mortbay.util.IO;
+
+
+public class Jetty6ContinuationBioTest extends ContinuationBase
+{
+ protected Server _server = new Server();
+ protected ServletHandler _servletHandler;
+ protected SocketConnector _socketConnector;
+ FilterHolder _filter;
+
+ protected void setUp() throws Exception
+ {
+ _socketConnector = new SocketConnector();
+ _server.setConnectors(new Connector[]{ _socketConnector });
+ Context servletContext = new Context(Context.NO_SECURITY|Context.NO_SESSIONS);
+ _server.setHandler(servletContext);
+ _servletHandler=servletContext.getServletHandler();
+ ServletHolder holder=new ServletHolder(_servlet);
+ _servletHandler.addServletWithMapping(holder,"/");
+ _filter=_servletHandler.addFilterWithMapping(ContinuationFilter.class,"/*",0);
+
+ _filter.setInitParameter("debug","true");
+ //_filter.setInitParameter("faux","false");
+ _server.start();
+
+ _port=_socketConnector.getLocalPort();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ _server.stop();
+ }
+
+ public void testContinuation() throws Exception
+ {
+ doNormal("FauxContinuation");
+ }
+
+ public void testSleep() throws Exception
+ {
+ doSleep();
+ }
+
+ public void testSuspend() throws Exception
+ {
+ doSuspend();
+ }
+
+ public void testSuspendWaitResume() throws Exception
+ {
+ doSuspendWaitResume();
+ }
+
+ public void testSuspendResume() throws Exception
+ {
+ doSuspendResume();
+ }
+
+ public void testSuspendWaitComplete() throws Exception
+ {
+ doSuspendWaitComplete();
+ }
+
+ public void testSuspendComplete() throws Exception
+ {
+ doSuspendComplete();
+ }
+
+ public void testSuspendWaitResumeSuspendWaitResume() throws Exception
+ {
+ doSuspendWaitResumeSuspendWaitResume();
+ }
+
+ public void testSuspendWaitResumeSuspendComplete() throws Exception
+ {
+ doSuspendWaitResumeSuspendComplete();
+ }
+
+ public void testSuspendWaitResumeSuspend() throws Exception
+ {
+ doSuspendWaitResumeSuspend();
+ }
+
+ public void testSuspendTimeoutSuspendResume() throws Exception
+ {
+ doSuspendTimeoutSuspendResume();
+ }
+
+ public void testSuspendTimeoutSuspendComplete() throws Exception
+ {
+ doSuspendTimeoutSuspendComplete();
+ }
+
+ public void testSuspendTimeoutSuspend() throws Exception
+ {
+ doSuspendTimeoutSuspend();
+ }
+
+ public void testSuspendThrowResume() throws Exception
+ {
+ doSuspendThrowResume();
+ }
+
+ public void testSuspendResumeThrow() throws Exception
+ {
+ doSuspendResumeThrow();
+ }
+
+ public void testSuspendThrowComplete() throws Exception
+ {
+ doSuspendThrowComplete();
+ }
+
+ public void testSuspendCompleteThrow() throws Exception
+ {
+ doSuspendCompleteThrow();
+ }
+
+ protected String toString(InputStream in) throws IOException
+ {
+ return IO.toString(in);
+ }
+
+}
diff --git a/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationTest.java b/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationNioFauxTest.java
similarity index 57%
rename from test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationTest.java
rename to test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationNioFauxTest.java
index 3f3e076aa20..660f3196335 100644
--- a/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationTest.java
+++ b/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationNioFauxTest.java
@@ -28,7 +28,7 @@ import org.mortbay.jetty.servlet.ServletHolder;
import org.mortbay.util.IO;
-public class Jetty6ContinuationTest extends ContinuationBase
+public class Jetty6ContinuationNioFauxTest extends ContinuationBase
{
protected Server _server = new Server();
protected ServletHandler _servletHandler;
@@ -39,14 +39,19 @@ public class Jetty6ContinuationTest extends ContinuationBase
protected void setUp() throws Exception
{
_selectChannelConnector = new SelectChannelConnector();
- _socketConnector = new SocketConnector();
- _server.setConnectors(new Connector[]{ _selectChannelConnector,_socketConnector });
+ _server.setConnectors(new Connector[]{ _selectChannelConnector });
Context servletContext = new Context(Context.NO_SECURITY|Context.NO_SESSIONS);
_server.setHandler(servletContext);
_servletHandler=servletContext.getServletHandler();
ServletHolder holder=new ServletHolder(_servlet);
_servletHandler.addServletWithMapping(holder,"/");
_filter=_servletHandler.addFilterWithMapping(ContinuationFilter.class,"/*",0);
+
+ _filter.setInitParameter("debug","true");
+ _filter.setInitParameter("faux","true");
+ _server.start();
+
+ _port=_selectChannelConnector.getLocalPort();
}
protected void tearDown() throws Exception
@@ -54,44 +59,89 @@ public class Jetty6ContinuationTest extends ContinuationBase
_server.stop();
}
- public void testJetty6Nio() throws Exception
+ public void testContinuation() throws Exception
{
- _filter.setInitParameter("debug","true");
- //_filter.setInitParameter("faux","false");
- _server.start();
-
- _port=_selectChannelConnector.getLocalPort();
- doit("Jetty6Continuation");
+ doNormal("FauxContinuation");
+ }
+
+ public void testSleep() throws Exception
+ {
+ doSleep();
}
- public void testFauxNio() throws Exception
+ public void testSuspend() throws Exception
{
- _filter.setInitParameter("debug","true");
- _filter.setInitParameter("faux","true");
- _server.start();
-
- _port=_selectChannelConnector.getLocalPort();
- doit("FauxContinuation");
+ doSuspend();
}
- public void testJetty6Bio() throws Exception
+ public void testSuspendWaitResume() throws Exception
{
- _filter.setInitParameter("debug","true");
- //_filter.setInitParameter("faux","false");
- _server.start();
-
- _port=_socketConnector.getLocalPort();
- doit("FauxContinuation");
+ doSuspendWaitResume();
}
- public void testFauxBio() throws Exception
+ public void testSuspendResume() throws Exception
{
- _filter.setInitParameter("debug","true");
- _filter.setInitParameter("faux","true");
- _server.start();
-
- _port=_socketConnector.getLocalPort();
- doit("FauxContinuation");
+ doSuspendResume();
+ }
+
+ public void testSuspendWaitComplete() throws Exception
+ {
+ doSuspendWaitComplete();
+ }
+
+ public void testSuspendComplete() throws Exception
+ {
+ doSuspendComplete();
+ }
+
+ public void testSuspendWaitResumeSuspendWaitResume() throws Exception
+ {
+ doSuspendWaitResumeSuspendWaitResume();
+ }
+
+ public void testSuspendWaitResumeSuspendComplete() throws Exception
+ {
+ doSuspendWaitResumeSuspendComplete();
+ }
+
+ public void testSuspendWaitResumeSuspend() throws Exception
+ {
+ doSuspendWaitResumeSuspend();
+ }
+
+ public void testSuspendTimeoutSuspendResume() throws Exception
+ {
+ doSuspendTimeoutSuspendResume();
+ }
+
+ public void testSuspendTimeoutSuspendComplete() throws Exception
+ {
+ doSuspendTimeoutSuspendComplete();
+ }
+
+ public void testSuspendTimeoutSuspend() throws Exception
+ {
+ doSuspendTimeoutSuspend();
+ }
+
+ public void testSuspendThrowResume() throws Exception
+ {
+ doSuspendThrowResume();
+ }
+
+ public void testSuspendResumeThrow() throws Exception
+ {
+ doSuspendResumeThrow();
+ }
+
+ public void testSuspendThrowComplete() throws Exception
+ {
+ doSuspendThrowComplete();
+ }
+
+ public void testSuspendCompleteThrow() throws Exception
+ {
+ doSuspendCompleteThrow();
}
protected String toString(InputStream in) throws IOException
diff --git a/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationNioTest.java b/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationNioTest.java
new file mode 100644
index 00000000000..82388785fdb
--- /dev/null
+++ b/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationNioTest.java
@@ -0,0 +1,151 @@
+// ========================================================================
+// Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+
+package org.eclipse.jetty.continuation;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.jetty.continuation.test.ContinuationBase;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.bio.SocketConnector;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.jetty.servlet.Context;
+import org.mortbay.jetty.servlet.FilterHolder;
+import org.mortbay.jetty.servlet.ServletHandler;
+import org.mortbay.jetty.servlet.ServletHolder;
+import org.mortbay.util.IO;
+
+
+public class Jetty6ContinuationNioTest extends ContinuationBase
+{
+ protected Server _server = new Server();
+ protected ServletHandler _servletHandler;
+ protected SelectChannelConnector _selectChannelConnector;
+ FilterHolder _filter;
+
+ protected void setUp() throws Exception
+ {
+ _selectChannelConnector = new SelectChannelConnector();
+ _server.setConnectors(new Connector[]{ _selectChannelConnector });
+ Context servletContext = new Context(Context.NO_SECURITY|Context.NO_SESSIONS);
+ _server.setHandler(servletContext);
+ _servletHandler=servletContext.getServletHandler();
+ ServletHolder holder=new ServletHolder(_servlet);
+ _servletHandler.addServletWithMapping(holder,"/");
+ _filter=_servletHandler.addFilterWithMapping(ContinuationFilter.class,"/*",0);
+
+ _filter.setInitParameter("debug","true");
+ //_filter.setInitParameter("faux","false");
+ _server.start();
+
+ _port=_selectChannelConnector.getLocalPort();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ _server.stop();
+ }
+
+ public void testContinuation() throws Exception
+ {
+ doNormal("Jetty6Continuation");
+ }
+
+ public void testSleep() throws Exception
+ {
+ doSleep();
+ }
+
+ public void testSuspend() throws Exception
+ {
+ doSuspend();
+ }
+
+ public void testSuspendWaitResume() throws Exception
+ {
+ doSuspendWaitResume();
+ }
+
+ public void testSuspendResume() throws Exception
+ {
+ doSuspendResume();
+ }
+
+ public void testSuspendWaitComplete() throws Exception
+ {
+ doSuspendWaitComplete();
+ }
+
+ public void testSuspendComplete() throws Exception
+ {
+ doSuspendComplete();
+ }
+
+ public void testSuspendWaitResumeSuspendWaitResume() throws Exception
+ {
+ doSuspendWaitResumeSuspendWaitResume();
+ }
+
+ public void testSuspendWaitResumeSuspendComplete() throws Exception
+ {
+ doSuspendWaitResumeSuspendComplete();
+ }
+
+ public void testSuspendWaitResumeSuspend() throws Exception
+ {
+ doSuspendWaitResumeSuspend();
+ }
+
+ public void testSuspendTimeoutSuspendResume() throws Exception
+ {
+ doSuspendTimeoutSuspendResume();
+ }
+
+ public void testSuspendTimeoutSuspendComplete() throws Exception
+ {
+ doSuspendTimeoutSuspendComplete();
+ }
+
+ public void testSuspendTimeoutSuspend() throws Exception
+ {
+ doSuspendTimeoutSuspend();
+ }
+
+ public void testSuspendThrowResume() throws Exception
+ {
+ doSuspendThrowResume();
+ }
+
+ public void testSuspendResumeThrow() throws Exception
+ {
+ doSuspendResumeThrow();
+ }
+
+ public void testSuspendThrowComplete() throws Exception
+ {
+ doSuspendThrowComplete();
+ }
+
+ public void testSuspendCompleteThrow() throws Exception
+ {
+ doSuspendCompleteThrow();
+ }
+
+ protected String toString(InputStream in) throws IOException
+ {
+ return IO.toString(in);
+ }
+
+}
diff --git a/test-continuation/src/main/java/org/eclipse/jetty/continuation/test/ContinuationBase.java b/test-continuation/src/main/java/org/eclipse/jetty/continuation/test/ContinuationBase.java
index 5089c0dbb59..0ddb28b707e 100644
--- a/test-continuation/src/main/java/org/eclipse/jetty/continuation/test/ContinuationBase.java
+++ b/test-continuation/src/main/java/org/eclipse/jetty/continuation/test/ContinuationBase.java
@@ -37,122 +37,150 @@ public abstract class ContinuationBase extends TestCase
protected SuspendServlet _servlet=new SuspendServlet();
protected int _port;
- protected void doit(String type) throws Exception
+ protected void doNormal(String type) throws Exception
{
- String response;
-
- response=process(null,null);
+ String response=process(null,null);
assertContains(type,response);
assertContains("NORMAL",response);
assertNotContains("history: onTimeout",response);
assertNotContains("history: onComplete",response);
+ }
- response=process("sleep=200",null);
+ protected void doSleep() throws Exception
+ {
+ String response=process("sleep=200",null);
assertContains("SLEPT",response);
assertNotContains("history: onTimeout",response);
assertNotContains("history: onComplete",response);
-
- response=process("suspend=200",null);
+ }
+
+ protected void doSuspend() throws Exception
+ {
+ String response=process("suspend=200",null);
assertContains("TIMEOUT",response);
assertContains("history: onTimeout",response);
assertContains("history: onComplete",response);
-
- response=process("suspend=200&resume=10",null);
+ }
+
+ protected void doSuspendWaitResume() throws Exception
+ {
+ String response=process("suspend=200&resume=10",null);
assertContains("RESUMED",response);
assertNotContains("history: onTimeout",response);
assertContains("history: onComplete",response);
-
- response=process("suspend=200&resume=0",null);
+ }
+
+ protected void doSuspendResume() throws Exception
+ {
+ String response=process("suspend=200&resume=0",null);
assertContains("RESUMED",response);
assertNotContains("history: onTimeout",response);
assertContains("history: onComplete",response);
-
- response=process("suspend=200&complete=10",null);
+ }
+
+ protected void doSuspendWaitComplete() throws Exception
+ {
+ String response=process("suspend=200&complete=10",null);
assertContains("COMPLETED",response);
assertNotContains("history: onTimeout",response);
assertContains("history: onComplete",response);
-
- response=process("suspend=200&complete=0",null);
+ }
+
+ protected void doSuspendComplete() throws Exception
+ {
+ String response=process("suspend=200&complete=0",null);
assertContains("COMPLETED",response);
assertNotContains("history: onTimeout",response);
assertContains("history: onComplete",response);
-
-
- response=process("suspend=1000&resume=10&suspend2=1000&resume2=10",null);
+ }
+
+ protected void doSuspendWaitResumeSuspendWaitResume() throws Exception
+ {
+ String response=process("suspend=1000&resume=10&suspend2=1000&resume2=10",null);
assertEquals(2,count(response,"history: suspend"));
assertEquals(2,count(response,"history: resume"));
assertEquals(0,count(response,"history: onTimeout"));
assertEquals(1,count(response,"history: onComplete"));
assertContains("RESUMED",response);
-
- response=process("suspend=1000&resume=10&suspend2=1000&resume2=10",null);
- assertEquals(2,count(response,"history: suspend"));
- assertEquals(2,count(response,"history: resume"));
- assertEquals(0,count(response,"history: onTimeout"));
- assertEquals(1,count(response,"history: onComplete"));
- assertContains("RESUMED",response);
-
- response=process("suspend=1000&resume=10&suspend2=1000&complete2=10",null);
+ }
+
+ protected void doSuspendWaitResumeSuspendComplete() throws Exception
+ {
+ String response=process("suspend=1000&resume=10&suspend2=1000&complete2=10",null);
assertEquals(2,count(response,"history: suspend"));
assertEquals(1,count(response,"history: resume"));
assertEquals(0,count(response,"history: onTimeout"));
assertEquals(1,count(response,"history: onComplete"));
assertContains("COMPLETED",response);
-
- response=process("suspend=1000&resume=10&suspend2=10",null);
+ }
+
+ protected void doSuspendWaitResumeSuspend() throws Exception
+ {
+ String response=process("suspend=1000&resume=10&suspend2=10",null);
assertEquals(2,count(response,"history: suspend"));
assertEquals(1,count(response,"history: resume"));
assertEquals(1,count(response,"history: onTimeout"));
assertEquals(1,count(response,"history: onComplete"));
assertContains("TIMEOUT",response);
-
+ }
-
- response=process("suspend=10&suspend2=1000&resume2=10",null);
+ protected void doSuspendTimeoutSuspendResume() throws Exception
+ {
+ String response=process("suspend=10&suspend2=1000&resume2=10",null);
assertEquals(2,count(response,"history: suspend"));
assertEquals(1,count(response,"history: resume"));
assertEquals(1,count(response,"history: onTimeout"));
assertEquals(1,count(response,"history: onComplete"));
assertContains("RESUMED",response);
-
- response=process("suspend=10&suspend2=1000&resume2=10",null);
- assertEquals(2,count(response,"history: suspend"));
- assertEquals(1,count(response,"history: resume"));
- assertEquals(1,count(response,"history: onTimeout"));
- assertEquals(1,count(response,"history: onComplete"));
- assertContains("RESUMED",response);
-
- response=process("suspend=10&suspend2=1000&complete2=10",null);
+ }
+
+ protected void doSuspendTimeoutSuspendComplete() throws Exception
+ {
+ String response=process("suspend=10&suspend2=1000&complete2=10",null);
assertEquals(2,count(response,"history: suspend"));
assertEquals(0,count(response,"history: resume"));
assertEquals(1,count(response,"history: onTimeout"));
assertEquals(1,count(response,"history: onComplete"));
assertContains("COMPLETED",response);
-
- response=process("suspend=10&suspend2=10",null);
+ }
+
+ protected void doSuspendTimeoutSuspend() throws Exception
+ {
+ String response=process("suspend=10&suspend2=10",null);
assertEquals(2,count(response,"history: suspend"));
assertEquals(0,count(response,"history: resume"));
assertEquals(2,count(response,"history: onTimeout"));
assertEquals(1,count(response,"history: onComplete"));
assertContains("TIMEOUT",response);
-
+ }
- response=process("suspend=200&resume=10&undispatch=true",null);
+ protected void doSuspendThrowResume() throws Exception
+ {
+ String response=process("suspend=200&resume=10&undispatch=true",null);
assertContains("RESUMED",response);
assertNotContains("history: onTimeout",response);
assertContains("history: onComplete",response);
-
- response=process("suspend=200&resume=0&undispatch=true",null);
+ }
+
+ protected void doSuspendResumeThrow() throws Exception
+ {
+ String response=process("suspend=200&resume=0&undispatch=true",null);
assertContains("RESUMED",response);
assertNotContains("history: onTimeout",response);
assertContains("history: onComplete",response);
-
- response=process("suspend=200&complete=10&undispatch=true",null);
+ }
+
+ protected void doSuspendThrowComplete() throws Exception
+ {
+ String response=process("suspend=200&complete=10&undispatch=true",null);
assertContains("COMPLETED",response);
assertNotContains("history: onTimeout",response);
assertContains("history: onComplete",response);
-
- response=process("suspend=200&complete=0&undispatch=true",null);
+ }
+
+ protected void doSuspendCompleteThrow() throws Exception
+ {
+ String response=process("suspend=200&complete=0&undispatch=true",null);
assertContains("COMPLETED",response);
assertNotContains("history: onTimeout",response);
assertContains("history: onComplete",response);
@@ -226,7 +254,7 @@ public abstract class ContinuationBase extends TestCase
/* ------------------------------------------------------------ */
protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException
{
- final Continuation continuation = ContinuationSupport.getContinuation(request,response);
+ final Continuation continuation = ContinuationSupport.getContinuation(request);
response.addHeader("history",continuation.getClass().toString());
@@ -436,8 +464,7 @@ public abstract class ContinuationBase extends TestCase
}
- private static ContinuationListener __listener =
- new ContinuationListener()
+ private static ContinuationListener __listener = new ContinuationListener()
{
public void onComplete(Continuation continuation)
{
diff --git a/test-continuation/src/test/java/org/eclipse/jetty/continuation/ContinuationTest.java b/test-continuation/src/test/java/org/eclipse/jetty/continuation/ContinuationTest.java
index 2f697c93633..ef48a45a9c5 100644
--- a/test-continuation/src/test/java/org/eclipse/jetty/continuation/ContinuationTest.java
+++ b/test-continuation/src/test/java/org/eclipse/jetty/continuation/ContinuationTest.java
@@ -44,6 +44,10 @@ public class ContinuationTest extends ContinuationBase
_servletHandler=servletContext.getServletHandler();
ServletHolder holder=new ServletHolder(_servlet);
_servletHandler.addServletWithMapping(holder,"/");
+
+ _server.start();
+ _port=_connector.getLocalPort();
+
}
protected void tearDown() throws Exception
@@ -53,12 +57,90 @@ public class ContinuationTest extends ContinuationBase
public void testContinuation() throws Exception
{
- _server.start();
- _port=_connector.getLocalPort();
-
- doit("AsyncContinuation");
+ doNormal("AsyncContinuation");
}
+ public void testSleep() throws Exception
+ {
+ doSleep();
+ }
+
+ public void testSuspend() throws Exception
+ {
+ doSuspend();
+ }
+
+ public void testSuspendWaitResume() throws Exception
+ {
+ doSuspendWaitResume();
+ }
+
+ public void testSuspendResume() throws Exception
+ {
+ doSuspendResume();
+ }
+
+ public void testSuspendWaitComplete() throws Exception
+ {
+ doSuspendWaitComplete();
+ }
+
+ public void testSuspendComplete() throws Exception
+ {
+ doSuspendComplete();
+ }
+
+ public void testSuspendWaitResumeSuspendWaitResume() throws Exception
+ {
+ doSuspendWaitResumeSuspendWaitResume();
+ }
+
+ public void testSuspendWaitResumeSuspendComplete() throws Exception
+ {
+ doSuspendWaitResumeSuspendComplete();
+ }
+
+ public void testSuspendWaitResumeSuspend() throws Exception
+ {
+ doSuspendWaitResumeSuspend();
+ }
+
+ public void testSuspendTimeoutSuspendResume() throws Exception
+ {
+ doSuspendTimeoutSuspendResume();
+ }
+
+ public void testSuspendTimeoutSuspendComplete() throws Exception
+ {
+ doSuspendTimeoutSuspendComplete();
+ }
+
+ public void testSuspendTimeoutSuspend() throws Exception
+ {
+ doSuspendTimeoutSuspend();
+ }
+
+ public void testSuspendThrowResume() throws Exception
+ {
+ doSuspendThrowResume();
+ }
+
+ public void testSuspendResumeThrow() throws Exception
+ {
+ doSuspendResumeThrow();
+ }
+
+ public void testSuspendThrowComplete() throws Exception
+ {
+ doSuspendThrowComplete();
+ }
+
+ public void testSuspendCompleteThrow() throws Exception
+ {
+ doSuspendCompleteThrow();
+ }
+
+
protected String toString(InputStream in) throws IOException
{
return IO.toString(in);
diff --git a/test-continuation/src/test/java/org/eclipse/jetty/continuation/FauxContinuationTest.java b/test-continuation/src/test/java/org/eclipse/jetty/continuation/FauxContinuationTest.java
index dbf96447313..9820e71c6f0 100644
--- a/test-continuation/src/test/java/org/eclipse/jetty/continuation/FauxContinuationTest.java
+++ b/test-continuation/src/test/java/org/eclipse/jetty/continuation/FauxContinuationTest.java
@@ -43,6 +43,13 @@ public class FauxContinuationTest extends ContinuationBase
_servletHandler=servletContext.getServletHandler();
ServletHolder holder=new ServletHolder(_servlet);
_servletHandler.addServletWithMapping(holder,"/");
+
+ _filter=_servletHandler.addFilterWithMapping(ContinuationFilter.class,"/*",0);
+ _filter.setInitParameter("debug","true");
+ _filter.setInitParameter("faux","true");
+ _server.start();
+ _port=_connector.getLocalPort();
+
}
protected void tearDown() throws Exception
@@ -50,26 +57,92 @@ public class FauxContinuationTest extends ContinuationBase
_server.stop();
}
- public void testFaux() throws Exception
+ public void testContinuation() throws Exception
{
- _filter=_servletHandler.addFilterWithMapping(ContinuationFilter.class,"/*",0);
- _filter.setInitParameter("debug","true");
- _filter.setInitParameter("faux","true");
- _server.start();
- _port=_connector.getLocalPort();
-
- doit("FauxContinuation");
+ doNormal("FauxContinuation");
+ }
+
+ public void testSleep() throws Exception
+ {
+ doSleep();
}
- public void testNoFauxDefaults() throws Exception
+ public void testSuspend() throws Exception
{
- _filter=_servletHandler.addFilterWithMapping(ContinuationFilter.class,"/*",0);
- _filter.setInitParameter("debug","true");
- _server.start();
- _port=_connector.getLocalPort();
-
- doit("AsyncContinuation");
+ doSuspend();
}
+
+ public void testSuspendWaitResume() throws Exception
+ {
+ doSuspendWaitResume();
+ }
+
+ public void testSuspendResume() throws Exception
+ {
+ doSuspendResume();
+ }
+
+ public void testSuspendWaitComplete() throws Exception
+ {
+ doSuspendWaitComplete();
+ }
+
+ public void testSuspendComplete() throws Exception
+ {
+ doSuspendComplete();
+ }
+
+ public void testSuspendWaitResumeSuspendWaitResume() throws Exception
+ {
+ doSuspendWaitResumeSuspendWaitResume();
+ }
+
+ public void testSuspendWaitResumeSuspendComplete() throws Exception
+ {
+ doSuspendWaitResumeSuspendComplete();
+ }
+
+ public void testSuspendWaitResumeSuspend() throws Exception
+ {
+ doSuspendWaitResumeSuspend();
+ }
+
+ public void testSuspendTimeoutSuspendResume() throws Exception
+ {
+ doSuspendTimeoutSuspendResume();
+ }
+
+ public void testSuspendTimeoutSuspendComplete() throws Exception
+ {
+ doSuspendTimeoutSuspendComplete();
+ }
+
+ public void testSuspendTimeoutSuspend() throws Exception
+ {
+ doSuspendTimeoutSuspend();
+ }
+
+ public void testSuspendThrowResume() throws Exception
+ {
+ doSuspendThrowResume();
+ }
+
+ public void testSuspendResumeThrow() throws Exception
+ {
+ doSuspendResumeThrow();
+ }
+
+ public void testSuspendThrowComplete() throws Exception
+ {
+ doSuspendThrowComplete();
+ }
+
+ public void testSuspendCompleteThrow() throws Exception
+ {
+ doSuspendCompleteThrow();
+ }
+
+
protected String toString(InputStream in) throws IOException
{