detect no ContinuationFilter

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1103 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2009-11-27 02:43:54 +00:00
parent 604a2ae23f
commit 5416ec325c
3 changed files with 12 additions and 2 deletions

View File

@ -26,6 +26,7 @@ import javax.servlet.ServletResponse;
*/
public class ContinuationFilter implements Filter
{
static boolean _initialized;
static boolean __debug; // shared debug status
private boolean _faux;
private boolean _jetty6;
@ -65,6 +66,7 @@ public class ContinuationFilter implements Filter
" faux="+_faux+
" filtered="+_filtered+
" servlet3="+ContinuationSupport.__servlet3);
_initialized=true;
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException

View File

@ -7,6 +7,8 @@ import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.ServletResponseWrapper;
import org.mortbay.log.Log;
/* ------------------------------------------------------------ */
@ -36,6 +38,11 @@ public class Jetty6Continuation implements ContinuationFilter.FilteredContinuati
public Jetty6Continuation(ServletRequest request, org.mortbay.util.ajax.Continuation continuation)
{
if (!ContinuationFilter._initialized)
{
Log.warn("!ContinuationFilter installed");
throw new IllegalStateException("!ContinuationFilter installed");
}
_request=request;
_j6Continuation=continuation;
}

View File

@ -35,6 +35,7 @@ public class Jetty6ContinuationNioTest extends ContinuationBase
protected SelectChannelConnector _selectChannelConnector;
FilterHolder _filter;
@Override
protected void setUp() throws Exception
{
_selectChannelConnector = new SelectChannelConnector();
@ -45,14 +46,13 @@ public class Jetty6ContinuationNioTest extends ContinuationBase
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();
}
@Override
protected void tearDown() throws Exception
{
_server.stop();
@ -143,6 +143,7 @@ public class Jetty6ContinuationNioTest extends ContinuationBase
doSuspendCompleteThrow();
}
@Override
protected String toString(InputStream in) throws IOException
{
return IO.toString(in);