From 41d9db8d5263e11985cb5ab360442f2ca26383e3 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 24 Sep 2012 11:24:35 -0700 Subject: [PATCH] 390256: Remove Jetty6 Support --- .../jetty/ant/WebApplicationProxyImpl.java | 2 +- jetty-continuation/pom.xml | 35 -- .../continuation/ContinuationFilter.java | 20 +- .../continuation/ContinuationSupport.java | 48 +- .../continuation/Jetty6Continuation.java | 266 ----------- test-continuation-jetty6/pom.xml | 81 ---- .../jetty/continuation/ContinuationBase.java | 428 ------------------ .../continuation/FauxContinuationTest.java | 83 ---- .../Jetty6ContinuationBioFauxTest.java | 156 ------- .../Jetty6ContinuationBioTest.java | 156 ------- .../Jetty6ContinuationNioFauxTest.java | 157 ------- .../Jetty6ContinuationNioTest.java | 157 ------- .../jetty/continuation/TestProxyServer.java | 57 --- 13 files changed, 9 insertions(+), 1637 deletions(-) delete mode 100644 jetty-continuation/src/main/java/org/eclipse/jetty/continuation/Jetty6Continuation.java delete mode 100644 test-continuation-jetty6/pom.xml delete mode 100644 test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/ContinuationBase.java delete mode 100644 test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/FauxContinuationTest.java delete mode 100644 test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationBioFauxTest.java delete mode 100644 test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationBioTest.java delete mode 100644 test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationNioFauxTest.java delete mode 100644 test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationNioTest.java delete mode 100644 test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/TestProxyServer.java diff --git a/jetty-ant/src/main/java/org/eclipse/jetty/ant/WebApplicationProxyImpl.java b/jetty-ant/src/main/java/org/eclipse/jetty/ant/WebApplicationProxyImpl.java index 7d46f997e8d..91331e77da4 100644 --- a/jetty-ant/src/main/java/org/eclipse/jetty/ant/WebApplicationProxyImpl.java +++ b/jetty-ant/src/main/java/org/eclipse/jetty/ant/WebApplicationProxyImpl.java @@ -83,7 +83,7 @@ public class WebApplicationProxyImpl implements WebApplicationProxy /** List of classpath files. */ private List classPathFiles; - /** Jetty6 Web Application Context. */ + /** Jetty Web Application Context. */ private WebAppContext webAppContext; /** Extra scan targets. */ diff --git a/jetty-continuation/pom.xml b/jetty-continuation/pom.xml index 0aa1fd6d1ba..c7f97b81f32 100644 --- a/jetty-continuation/pom.xml +++ b/jetty-continuation/pom.xml @@ -22,37 +22,9 @@ manifest - - - javax.servlet.*;version="2.6.0",org.mortbay.log.*;version="[6.1,7)";resolution:=optional,org.mortbay.util.ajax.*;version="[6.1,7)";resolution:=optional,* - - - - org.apache.maven.plugins - maven-jar-plugin - - - artifact-jar - - jar - - - - test-jar - - test-jar - - - - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - org.codehaus.mojo findbugs-maven-plugin @@ -66,13 +38,6 @@ org.eclipse.jetty.orbit javax.servlet - 3.0.0.v201112011016 - provided - - - org.mortbay.jetty - jetty-util - 6.1.26 provided diff --git a/jetty-continuation/src/main/java/org/eclipse/jetty/continuation/ContinuationFilter.java b/jetty-continuation/src/main/java/org/eclipse/jetty/continuation/ContinuationFilter.java index 35de9d9c93b..e05898b31ae 100644 --- a/jetty-continuation/src/main/java/org/eclipse/jetty/continuation/ContinuationFilter.java +++ b/jetty-continuation/src/main/java/org/eclipse/jetty/continuation/ContinuationFilter.java @@ -33,15 +33,14 @@ import javax.servlet.ServletResponse; /** *

ContinuationFilter must be applied to servlet paths that make use of * the asynchronous features provided by {@link Continuation} APIs, but that - * are deployed in servlet containers that are neither Jetty (>= 7) nor a + * are deployed in servlet containers that are a * compliant Servlet 3.0 container.

*

The following init parameters may be used to configure the filter (these are mostly for testing):

*
*
debug
Boolean controlling debug output
- *
jetty6
Boolean to force use of Jetty 6 continuations
*
faux
Boolean to force use of faux continuations
*
- *

If the servlet container is not Jetty (either 6 or 7) nor a Servlet 3 + *

If the servlet container is not Jetty 7+ nor a Servlet 3 * container, then "faux" continuations will be used.

*

Faux continuations will just put the thread that called {@link Continuation#suspend()} * in wait, and will notify that thread when {@link Continuation#resume()} or @@ -54,7 +53,6 @@ public class ContinuationFilter implements Filter static boolean _initialized; static boolean __debug; // shared debug status private boolean _faux; - private boolean _jetty6; private boolean _filtered; ServletContext _context; private boolean _debug; @@ -69,25 +67,17 @@ public class ContinuationFilter implements Filter if (_debug) __debug=true; - param=filterConfig.getInitParameter("jetty6"); - if (param==null) - param=filterConfig.getInitParameter("partial"); - if (param!=null) - _jetty6=Boolean.parseBoolean(param); - else - _jetty6=ContinuationSupport.__jetty6 && !jetty_7_or_greater; - + param=filterConfig.getInitParameter("partial"); param=filterConfig.getInitParameter("faux"); if (param!=null) _faux=Boolean.parseBoolean(param); else - _faux=!(jetty_7_or_greater || _jetty6 || _context.getMajorVersion()>=3); + _faux=!(jetty_7_or_greater || _context.getMajorVersion()>=3); - _filtered=_faux||_jetty6; + _filtered=_faux; if (_debug) _context.log("ContinuationFilter "+ " jetty="+jetty_7_or_greater+ - " jetty6="+_jetty6+ " faux="+_faux+ " filtered="+_filtered+ " servlet3="+ContinuationSupport.__servlet3); diff --git a/jetty-continuation/src/main/java/org/eclipse/jetty/continuation/ContinuationSupport.java b/jetty-continuation/src/main/java/org/eclipse/jetty/continuation/ContinuationSupport.java index fa1a549fc53..f4b6a370e35 100644 --- a/jetty-continuation/src/main/java/org/eclipse/jetty/continuation/ContinuationSupport.java +++ b/jetty-continuation/src/main/java/org/eclipse/jetty/continuation/ContinuationSupport.java @@ -23,20 +23,17 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletRequestWrapper; import javax.servlet.ServletResponse; -/* ------------------------------------------------------------ */ -/** ContinuationSupport. +/** + * ContinuationSupport. * * Factory class for accessing Continuation instances, which with either be - * native to the container (jetty >= 6), a servlet 3.0 or a faux continuation. - * + * a servlet 3.0 or a faux continuation. */ public class ContinuationSupport { - static final boolean __jetty6; static final boolean __servlet3; static final Class __waitingContinuation; static final Constructor __newServlet3Continuation; - static final Constructor __newJetty6Continuation; static { boolean servlet3Support=false; @@ -59,27 +56,6 @@ public class ContinuationSupport __newServlet3Continuation=s3cc; } - boolean jetty6Support=false; - Constructorj6cc=null; - try - { - Class jetty6ContinuationClass = ContinuationSupport.class.getClassLoader().loadClass("org.mortbay.util.ajax.Continuation"); - boolean jetty6=jetty6ContinuationClass!=null; - if (jetty6) - { - Class j6c = ContinuationSupport.class.getClassLoader().loadClass("org.eclipse.jetty.continuation.Jetty6Continuation").asSubclass(Continuation.class); - j6cc=j6c.getConstructor(ServletRequest.class, jetty6ContinuationClass); - jetty6Support=true; - } - } - catch (Exception e) - {} - finally - { - __jetty6=jetty6Support; - __newJetty6Continuation=j6cc; - } - Class waiting=null; try { @@ -128,24 +104,6 @@ public class ContinuationSupport } } - if (__jetty6) - { - Object c=request.getAttribute("org.mortbay.jetty.ajax.Continuation"); - try - { - if (c==null || __waitingContinuation==null || __waitingContinuation.isInstance(c)) - continuation=new FauxContinuation(request); - else - continuation= __newJetty6Continuation.newInstance(request,c); - request.setAttribute(Continuation.ATTRIBUTE,continuation); - return continuation; - } - catch(Exception e) - { - throw new RuntimeException(e); - } - } - throw new IllegalStateException("!(Jetty || Servlet 3.0 || ContinuationFilter)"); } diff --git a/jetty-continuation/src/main/java/org/eclipse/jetty/continuation/Jetty6Continuation.java b/jetty-continuation/src/main/java/org/eclipse/jetty/continuation/Jetty6Continuation.java deleted file mode 100644 index d9f95c3d725..00000000000 --- a/jetty-continuation/src/main/java/org/eclipse/jetty/continuation/Jetty6Continuation.java +++ /dev/null @@ -1,266 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 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.util.ArrayList; -import java.util.List; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.ServletResponseWrapper; - -import org.mortbay.log.Log; -import org.mortbay.log.Logger; - -/* ------------------------------------------------------------ */ -/** - * This implementation of Continuation is used by {@link ContinuationSupport} - * when it detects that the application is deployed in a jetty-6 server. - * This continuation requires the {@link ContinuationFilter} to be deployed. - */ -public class Jetty6Continuation implements ContinuationFilter.FilteredContinuation -{ - private static final Logger LOG = Log.getLogger(Jetty6Continuation.class.getName()); - - // Exception reused for all continuations - // Turn on debug in ContinuationFilter to see real stack trace. - private final static ContinuationThrowable __exception = new ContinuationThrowable(); - - private final ServletRequest _request; - private ServletResponse _response; - private final org.mortbay.util.ajax.Continuation _j6Continuation; - - private Throwable _retry; - private int _timeout; - private boolean _initial=true; - private volatile boolean _completed=false; - private volatile boolean _resumed=false; - private volatile boolean _expired=false; - private boolean _responseWrapped=false; - private List _listeners; - - public Jetty6Continuation(ServletRequest request, org.mortbay.util.ajax.Continuation continuation) - { - if (!ContinuationFilter._initialized) - { - LOG.warn("!ContinuationFilter installed",null,null); - throw new IllegalStateException("!ContinuationFilter installed"); - } - _request=request; - _j6Continuation=continuation; - } - - public void addContinuationListener(final ContinuationListener listener) - { - if (_listeners==null) - _listeners=new ArrayList(); - _listeners.add(listener); - } - - public void complete() - { - synchronized(this) - { - if (_resumed) - throw new IllegalStateException(); - _completed=true; - if (_j6Continuation.isPending()) - _j6Continuation.resume(); - } - } - - /* ------------------------------------------------------------ */ - /** - * @see org.eclipse.jetty.continuation.Continuation#getAttribute(java.lang.String) - */ - public Object getAttribute(String name) - { - return _request.getAttribute(name); - } - - /* ------------------------------------------------------------ */ - /** - * @see org.eclipse.jetty.continuation.Continuation#removeAttribute(java.lang.String) - */ - public void removeAttribute(String name) - { - _request.removeAttribute(name); - } - - /* ------------------------------------------------------------ */ - /** - * @see org.eclipse.jetty.continuation.Continuation#setAttribute(java.lang.String, java.lang.Object) - */ - public void setAttribute(String name, Object attribute) - { - _request.setAttribute(name,attribute); - } - - /* ------------------------------------------------------------ */ - public ServletResponse getServletResponse() - { - return _response; - } - - /* ------------------------------------------------------------ */ - public boolean isExpired() - { - return _expired; - } - - /* ------------------------------------------------------------ */ - public boolean isInitial() - { - return _initial; - } - - /* ------------------------------------------------------------ */ - public boolean isResumed() - { - return _resumed; - } - - /* ------------------------------------------------------------ */ - public boolean isSuspended() - { - return _retry!=null; - } - - /* ------------------------------------------------------------ */ - public void resume() - { - synchronized(this) - { - if (_completed) - throw new IllegalStateException(); - _resumed=true; - if (_j6Continuation.isPending()) - _j6Continuation.resume(); - } - } - - /* ------------------------------------------------------------ */ - public void setTimeout(long timeoutMs) - { - _timeout=(timeoutMs>Integer.MAX_VALUE)?Integer.MAX_VALUE:(int)timeoutMs; - } - - /* ------------------------------------------------------------ */ - /** - * @see org.eclipse.jetty.continuation.Continuation#suspend(javax.servlet.ServletResponse) - */ - public void suspend(ServletResponse response) - { - try - { - _response=response; - _responseWrapped=_response instanceof ServletResponseWrapper; - _resumed=false; - _expired=false; - _completed=false; - _j6Continuation.suspend(_timeout); - } - catch(Throwable retry) - { - _retry=retry; - } - } - - /* ------------------------------------------------------------ */ - public void suspend() - { - try - { - _response=null; - _responseWrapped=false; - _resumed=false; - _expired=false; - _completed=false; - _j6Continuation.suspend(_timeout); - } - catch(Throwable retry) - { - _retry=retry; - } - } - - /* ------------------------------------------------------------ */ - public boolean isResponseWrapped() - { - return _responseWrapped; - } - - /* ------------------------------------------------------------ */ - /** - * @see org.eclipse.jetty.continuation.Continuation#undispatch() - */ - public void undispatch() - { - if (isSuspended()) - { - if (ContinuationFilter.__debug) - throw new ContinuationThrowable(); - throw __exception; - } - throw new IllegalStateException("!suspended"); - } - - /* ------------------------------------------------------------ */ - public boolean enter(ServletResponse response) - { - _response=response; - _expired=!_j6Continuation.isResumed(); - - if (_initial) - return true; - - _j6Continuation.reset(); - - if (_expired) - { - if (_listeners!=null) - { - for (ContinuationListener l: _listeners) - l.onTimeout(this); - } - } - - return !_completed; - } - - /* ------------------------------------------------------------ */ - public boolean exit() - { - _initial=false; - - Throwable th=_retry; - _retry=null; - if (th instanceof Error) - throw (Error)th; - if (th instanceof RuntimeException) - throw (RuntimeException)th; - - if (_listeners!=null) - { - for (ContinuationListener l: _listeners) - l.onComplete(this); - } - - return true; - } -} diff --git a/test-continuation-jetty6/pom.xml b/test-continuation-jetty6/pom.xml deleted file mode 100644 index 2448370e096..00000000000 --- a/test-continuation-jetty6/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - org.eclipse.jetty - jetty-project - 8.1.0-SNAPSHOT - - 4.0.0 - test-continuation-jetty6 - jar - Test :: Continuation - (Jetty 6) - Asynchronous API - - - - org.apache.maven.plugins - maven-deploy-plugin - - - true - - - - - - - org.eclipse.jetty.toolchain - jetty-test-helper - test - - - org.mortbay.jetty - servlet-api - 2.5-20081211 - test - - - org.eclipse.jetty - jetty-servlet - ${project.version} - test - - - ${servlet.spec.groupId} - ${servlet.spec.artifactId} - - - - - org.eclipse.jetty - test-continuation - ${project.version} - test - - - ${servlet.spec.groupId} - ${servlet.spec.artifactId} - - - - - org.mortbay.jetty - jetty - 6.1.26 - jar - test - - - servlet-api-2.5 - org.mortbay.jetty - - - - - org.eclipse.jetty - jetty-servlets - ${project.version} - jar - test - - - diff --git a/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/ContinuationBase.java b/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/ContinuationBase.java deleted file mode 100644 index b61f7326a09..00000000000 --- a/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/ContinuationBase.java +++ /dev/null @@ -1,428 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 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 java.net.Socket; -import java.util.Timer; -import java.util.TimerTask; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import junit.framework.TestCase; - - - -public abstract class ContinuationBase extends TestCase -{ - protected SuspendServlet _servlet=new SuspendServlet(); - protected int _port; - - protected void doit(String type) throws Exception - { - String response; - - response=process(null,null); - assertContains(type,response); - assertContains("NORMAL",response); - assertNotContains("history: onTimeout",response); - assertNotContains("history: onComplete",response); - - response=process("sleep=200",null); - assertContains("SLEPT",response); - assertNotContains("history: onTimeout",response); - assertNotContains("history: onComplete",response); - - response=process("suspend=200",null); - assertContains("TIMEOUT",response); - assertContains("history: onTimeout",response); - assertContains("history: onComplete",response); - - 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); - assertContains("RESUMED",response); - assertNotContains("history: onTimeout",response); - assertContains("history: onComplete",response); - - 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); - assertContains("COMPLETED",response); - assertNotContains("history: onTimeout",response); - assertContains("history: onComplete",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&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); - 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); - 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); - 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); - 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); - 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); - - } - - - private int count(String responses,String substring) - { - int count=0; - int i=responses.indexOf(substring); - while (i>=0) - { - count++; - i=responses.indexOf(substring,i+substring.length()); - } - - return count; - } - - protected void assertContains(String content,String response) - { - assertEquals("HTTP/1.1 200 OK",response.substring(0,15)); - if (response.indexOf(content,15)<0) - { - System.err.println(content+" NOT IN '"+response+"'"); - assertTrue(false); - } - } - - protected void assertNotContains(String content,String response) - { - assertEquals("HTTP/1.1 200 OK",response.substring(0,15)); - if (response.indexOf(content,15)>=0) - { - System.err.println(content+" IS IN '"+response+"'"); - assertTrue(false); - } - } - - public synchronized String process(String query,String content) throws Exception - { - String request = "GET /"; - - if (query!=null) - request+="?"+query; - request+=" HTTP/1.1\r\n"+ - "Host: localhost\r\n"+ - "Connection: close\r\n"; - if (content!=null) - request+="Content-Length: "+content.length()+"\r\n"; - request+="\r\n" + content; - - Socket socket = new Socket("localhost",_port); - socket.getOutputStream().write(request.getBytes("UTF-8")); - - String response = toString(socket.getInputStream()); - return response; - } - - - protected abstract String toString(InputStream in) throws IOException; - - - private static class SuspendServlet extends HttpServlet - { - private Timer _timer=new Timer(); - - public SuspendServlet() - {} - - /* ------------------------------------------------------------ */ - protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException - { - final Continuation continuation = ContinuationSupport.getContinuation(request,response); - - response.addHeader("history",continuation.getClass().toString()); - - int read_before=0; - long sleep_for=-1; - long suspend_for=-1; - long suspend2_for=-1; - long resume_after=-1; - long resume2_after=-1; - long complete_after=-1; - long complete2_after=-1; - - if (request.getParameter("read")!=null) - read_before=Integer.parseInt(request.getParameter("read")); - if (request.getParameter("sleep")!=null) - sleep_for=Integer.parseInt(request.getParameter("sleep")); - if (request.getParameter("suspend")!=null) - suspend_for=Integer.parseInt(request.getParameter("suspend")); - if (request.getParameter("suspend2")!=null) - suspend2_for=Integer.parseInt(request.getParameter("suspend2")); - if (request.getParameter("resume")!=null) - resume_after=Integer.parseInt(request.getParameter("resume")); - if (request.getParameter("resume2")!=null) - resume2_after=Integer.parseInt(request.getParameter("resume2")); - if (request.getParameter("complete")!=null) - complete_after=Integer.parseInt(request.getParameter("complete")); - if (request.getParameter("complete2")!=null) - complete2_after=Integer.parseInt(request.getParameter("complete2")); - - if (continuation.isInitial()) - { - if (read_before>0) - { - byte[] buf=new byte[read_before]; - request.getInputStream().read(buf); - } - else if (read_before<0) - { - InputStream in = request.getInputStream(); - int b=in.read(); - while(b!=-1) - b=in.read(); - } - - if (suspend_for>=0) - { - if (suspend_for>0) - continuation.setTimeout(suspend_for); - continuation.addContinuationListener(__listener); - ((HttpServletResponse)continuation.getServletResponse()).addHeader("history","suspend"); - continuation.suspend(); - - if (complete_after>0) - { - TimerTask complete = new TimerTask() - { - public void run() - { - try - { - response.setStatus(200); - response.getOutputStream().println("COMPLETED\n"); - continuation.complete(); - } - catch(Exception e) - { - e.printStackTrace(); - } - } - }; - synchronized (_timer) - { - _timer.schedule(complete,complete_after); - } - } - else if (complete_after==0) - { - response.setStatus(200); - response.getOutputStream().println("COMPLETED\n"); - continuation.complete(); - } - else if (resume_after>0) - { - TimerTask resume = new TimerTask() - { - public void run() - { - ((HttpServletResponse)continuation.getServletResponse()).addHeader("history","resume"); - continuation.resume(); - } - }; - synchronized (_timer) - { - _timer.schedule(resume,resume_after); - } - } - else if (resume_after==0) - { - ((HttpServletResponse)continuation.getServletResponse()).addHeader("history","resume"); - continuation.resume(); - } - } - else if (sleep_for>=0) - { - try - { - Thread.sleep(sleep_for); - } - catch (InterruptedException e) - { - e.printStackTrace(); - } - response.setStatus(200); - response.getOutputStream().println("SLEPT\n"); - } - else - { - response.setStatus(200); - response.getOutputStream().println("NORMAL\n"); - } - } - else if (suspend2_for>=0 && request.getAttribute("2nd")==null) - { - request.setAttribute("2nd","cycle"); - - if (suspend2_for>0) - continuation.setTimeout(suspend2_for); - // continuation.addContinuationListener(__listener); - ((HttpServletResponse)continuation.getServletResponse()).addHeader("history","suspend"); - continuation.suspend(); - - if (complete2_after>0) - { - TimerTask complete = new TimerTask() - { - public void run() - { - try - { - response.setStatus(200); - response.getOutputStream().println("COMPLETED\n"); - continuation.complete(); - } - catch(Exception e) - { - e.printStackTrace(); - } - } - }; - synchronized (_timer) - { - _timer.schedule(complete,complete2_after); - } - } - else if (complete2_after==0) - { - response.setStatus(200); - response.getOutputStream().println("COMPLETED\n"); - continuation.complete(); - } - else if (resume2_after>0) - { - TimerTask resume = new TimerTask() - { - public void run() - { - ((HttpServletResponse)continuation.getServletResponse()).addHeader("history","resume"); - continuation.resume(); - } - }; - synchronized (_timer) - { - _timer.schedule(resume,resume2_after); - } - } - else if (resume2_after==0) - { - ((HttpServletResponse)continuation.getServletResponse()).addHeader("history","resume"); - continuation.resume(); - } - return; - } - else if (continuation.isExpired()) - { - response.setStatus(200); - response.getOutputStream().println("TIMEOUT\n"); - } - else if (continuation.isResumed()) - { - response.setStatus(200); - response.getOutputStream().println("RESUMED\n"); - } - else - { - response.setStatus(200); - response.getOutputStream().println("unknown???\n"); - } - } - } - - - - private static ContinuationListener __listener = - new ContinuationListener() - { - public void onComplete(Continuation continuation) - { - ((HttpServletResponse)continuation.getServletResponse()).addHeader("history","onComplete"); - } - - public void onTimeout(Continuation continuation) - { - ((HttpServletResponse)continuation.getServletResponse()).addHeader("history","onTimeout"); - continuation.resume(); - } - - }; -} diff --git a/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/FauxContinuationTest.java b/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/FauxContinuationTest.java deleted file mode 100644 index 236f0428d1c..00000000000 --- a/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/FauxContinuationTest.java +++ /dev/null @@ -1,83 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 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 javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; - -import org.mortbay.jetty.Connector; -import org.mortbay.jetty.Server; -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 FauxContinuationTest extends ContinuationBase -{ - protected Server _server = new Server(); - protected ServletHandler _servletHandler; - protected SelectChannelConnector _connector; - FilterHolder _filter; - - protected void setUp() throws Exception - { - _connector = new SelectChannelConnector(); - _server.setConnectors(new Connector[]{ _connector }); - 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); - } - - protected void tearDown() throws Exception - { - _server.stop(); - } - - public void testFaux() throws Exception - { - _filter.setInitParameter("debug","true"); - _filter.setInitParameter("faux","true"); - _server.start(); - _port=_connector.getLocalPort(); - - doit("FauxContinuation"); - } - - - - protected String toString(InputStream in) throws IOException - { - return IO.toString(in); - } -} 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 deleted file mode 100644 index 2820c47372e..00000000000 --- a/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationBioFauxTest.java +++ /dev/null @@ -1,156 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 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 deleted file mode 100644 index 2c8883adb29..00000000000 --- a/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationBioTest.java +++ /dev/null @@ -1,156 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 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/Jetty6ContinuationNioFauxTest.java b/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationNioFauxTest.java deleted file mode 100644 index c1211f4a897..00000000000 --- a/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationNioFauxTest.java +++ /dev/null @@ -1,157 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 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 Jetty6ContinuationNioFauxTest extends ContinuationBase -{ - protected Server _server = new Server(); - protected ServletHandler _servletHandler; - protected SelectChannelConnector _selectChannelConnector; - protected SocketConnector _socketConnector; - 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","true"); - _server.start(); - - _port=_selectChannelConnector.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/Jetty6ContinuationNioTest.java b/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationNioTest.java deleted file mode 100644 index c06299cb3ec..00000000000 --- a/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/Jetty6ContinuationNioTest.java +++ /dev/null @@ -1,157 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 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; - - @Override - 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"); - _server.start(); - - _port=_selectChannelConnector.getLocalPort(); - } - - @Override - 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(); - } - - @Override - protected String toString(InputStream in) throws IOException - { - return IO.toString(in); - } - -} diff --git a/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/TestProxyServer.java b/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/TestProxyServer.java deleted file mode 100644 index 61f68039a5d..00000000000 --- a/test-continuation-jetty6/src/test/java/org/eclipse/jetty/continuation/TestProxyServer.java +++ /dev/null @@ -1,57 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 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 org.eclipse.jetty.servlets.ProxyServlet; -import org.junit.Ignore; -import org.mortbay.jetty.Connector; -import org.mortbay.jetty.Server; -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; - -@Ignore("Not a test case") -public class TestProxyServer -{ - public static void main(String[] args) throws Exception - { - Server server = new Server(); - SelectChannelConnector selectChannelConnector = new SelectChannelConnector(); - server.setConnectors(new Connector[]{ selectChannelConnector }); - selectChannelConnector.setPort(8080); - - Context servletContext = new Context(Context.NO_SECURITY|Context.NO_SESSIONS); - server.setHandler(servletContext); - ServletHandler servletHandler=servletContext.getServletHandler(); - - - ServletHolder proxy=new ServletHolder(ProxyServlet.Transparent.class); - servletHandler.addServletWithMapping(proxy,"/ws/*"); - proxy.setInitParameter("ProxyTo","http://www.webtide.com"); - proxy.setInitParameter("Prefix","/ws"); - - FilterHolder filter=servletHandler.addFilterWithMapping(ContinuationFilter.class,"/*",0); - filter.setInitParameter("debug","true"); - - server.start(); - server.join(); - } -}