Issue #1077
Removed concrete handle from AbstractHandler
Added AbstractHandler.ErrorDispatchHandler
cleanup context listeners
Removed vanity inlining of ScopeHandler methods
Squashed commit of the following:
commit 0f3619ac1101707de476ad9b7f7394e8de18d95f
Author: Greg Wilkins <gregw@webtide.com>
Date: Tue Nov 8 10:59:55 2016 +1100
Issue #1077
Removed concrete handle from AbstractHandler
Added AbstractHandler.ErrorDispatchHandler
commit 0876fee0334b9f43297f28fc4b855f447b7ee73f
Merge: 5eabad2 7716ada
Author: Greg Wilkins <gregw@webtide.com>
Date: Tue Nov 8 08:48:53 2016 +1100
Merge branch 'jetty-9.4.x' into jetty-9.4.x-issue-1077
commit 5eabad29a5c4d893e204cb403a1d276ea3b15281
Author: Greg Wilkins <gregw@webtide.com>
Date: Mon Nov 7 21:15:40 2016 +1100
Issue #1077 cleanup context listeners
commit 9edf91a386aa20a3c0af86a634b4b3dbbc8e1092
Author: Greg Wilkins <gregw@webtide.com>
Date: Mon Nov 7 18:08:01 2016 +1100
Issue #1077 Removed vanity inlining of ScopeHandler methods
This commit is contained in:
parent
7716ada9dd
commit
a7048a325a
|
@ -28,16 +28,27 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.HttpChannel;
|
||||
import org.eclipse.jetty.server.HttpConnection;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.Response;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** AbstractHandler.
|
||||
* <p>A convenience implementation of {@link Handler} that uses the
|
||||
* {@link ContainerLifeCycle} to provide:<ul>
|
||||
* <li>start/stop behavior
|
||||
* <li>a bean container
|
||||
* <li>basic {@link Dumpable} support
|
||||
* <li>a {@link Server} reference
|
||||
* <li>optional error dispatch handling
|
||||
* </ul>
|
||||
*/
|
||||
@ManagedObject("Jetty Handler")
|
||||
public abstract class AbstractHandler extends ContainerLifeCycle implements Handler
|
||||
|
@ -46,29 +57,39 @@ public abstract class AbstractHandler extends ContainerLifeCycle implements Hand
|
|||
|
||||
private Server _server;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public AbstractHandler()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (baseRequest.getDispatcherType()==DispatcherType.ERROR)
|
||||
doError(target,baseRequest,request,response);
|
||||
else
|
||||
doHandle(target,baseRequest,request,response);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
protected void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public abstract void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException;
|
||||
|
||||
/**
|
||||
* Convenience method to generate error page.
|
||||
* <p>This method can be called from {@link #handle(String, Request, HttpServletRequest, HttpServletResponse)} when an {@link DispatcherType#ERROR} dispatch
|
||||
* is detected and an error page needs to be generated by calling {@link HttpServletResponse#sendError(int, String)} with the appropriate code and reason,
|
||||
* which are taken from {@link HttpServletRequest#getAttribute(String)} for {@link RequestDispatcher#ERROR_STATUS_CODE} and {@link RequestDispatcher#ERROR_MESSAGE}
|
||||
* @see ErrorDispatchHandler for a conveniance class that calls this method.
|
||||
* @param target
|
||||
* The target of the request - either a URI or a name.
|
||||
* @param baseRequest
|
||||
* The original unwrapped request object.
|
||||
* @param request
|
||||
* The request either as the {@link Request} object or a wrapper of that request. The
|
||||
* <code>{@link HttpConnection#getCurrentConnection()}.{@link HttpConnection#getHttpChannel() getHttpChannel()}.{@link HttpChannel#getRequest() getRequest()}</code>
|
||||
* method can be used access the Request object if required.
|
||||
* @param response
|
||||
* The response as the {@link Response} object or a wrapper of that request. The
|
||||
* <code>{@link HttpConnection#getCurrentConnection()}.{@link HttpConnection#getHttpChannel() getHttpChannel()}.{@link HttpChannel#getResponse() getResponse()}</code>
|
||||
* method can be used access the Response object if required.
|
||||
* @throws IOException
|
||||
* if unable to handle the request or response processing
|
||||
* @throws ServletException
|
||||
* if unable to handle the request or response due to underlying servlet issue
|
||||
*/
|
||||
protected void doError(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
Object o = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
|
||||
|
@ -79,7 +100,6 @@ public abstract class AbstractHandler extends ContainerLifeCycle implements Hand
|
|||
response.sendError(code,reason);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* @see org.eclipse.thread.LifeCycle#start()
|
||||
*/
|
||||
|
@ -93,7 +113,6 @@ public abstract class AbstractHandler extends ContainerLifeCycle implements Hand
|
|||
super.doStart();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* @see org.eclipse.thread.LifeCycle#stop()
|
||||
*/
|
||||
|
@ -105,7 +124,6 @@ public abstract class AbstractHandler extends ContainerLifeCycle implements Hand
|
|||
super.doStop();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void setServer(Server server)
|
||||
{
|
||||
|
@ -116,14 +134,12 @@ public abstract class AbstractHandler extends ContainerLifeCycle implements Hand
|
|||
_server=server;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public Server getServer()
|
||||
{
|
||||
return _server;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void destroy()
|
||||
{
|
||||
|
@ -132,11 +148,52 @@ public abstract class AbstractHandler extends ContainerLifeCycle implements Hand
|
|||
super.destroy();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void dumpThis(Appendable out) throws IOException
|
||||
{
|
||||
out.append(toString()).append(" - ").append(getState()).append('\n');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* An extension of AbstractHandler that handles {@link DispatcherType#ERROR} dispatches.
|
||||
* <p>
|
||||
* {@link DispatcherType#ERROR} dispatches are handled by calling the {@link #doError(String, Request, HttpServletRequest, HttpServletResponse)}
|
||||
* method. All other dispatches are passed to the abstract {@link #doNonErrorHandle(String, Request, HttpServletRequest, HttpServletResponse)}
|
||||
* method, which should be implemented with specific handler behavior
|
||||
*
|
||||
*/
|
||||
public static abstract class ErrorDispatchHandler extends AbstractHandler
|
||||
{
|
||||
@Override
|
||||
public final void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (baseRequest.getDispatcherType()==DispatcherType.ERROR)
|
||||
doError(target,baseRequest,request,response);
|
||||
else
|
||||
doNonErrorHandle(target,baseRequest,request,response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by {@link #handle(String, Request, HttpServletRequest, HttpServletResponse)}
|
||||
* for all non-{@link DispatcherType#ERROR} dispatches.
|
||||
* @param target
|
||||
* The target of the request - either a URI or a name.
|
||||
* @param baseRequest
|
||||
* The original unwrapped request object.
|
||||
* @param request
|
||||
* The request either as the {@link Request} object or a wrapper of that request. The
|
||||
* <code>{@link HttpConnection#getCurrentConnection()}.{@link HttpConnection#getHttpChannel() getHttpChannel()}.{@link HttpChannel#getRequest() getRequest()}</code>
|
||||
* method can be used access the Request object if required.
|
||||
* @param response
|
||||
* The response as the {@link Response} object or a wrapper of that request. The
|
||||
* <code>{@link HttpConnection#getCurrentConnection()}.{@link HttpConnection#getHttpChannel() getHttpChannel()}.{@link HttpChannel#getResponse() getResponse()}</code>
|
||||
* method can be used access the Response object if required.
|
||||
* @throws IOException
|
||||
* if unable to handle the request or response processing
|
||||
* @throws ServletException
|
||||
* if unable to handle the request or response due to underlying servlet issue
|
||||
*/
|
||||
protected abstract void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1127,16 +1127,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("context={}|{}|{} @ {}",baseRequest.getContextPath(),baseRequest.getServletPath(), baseRequest.getPathInfo(),this);
|
||||
|
||||
// start manual inline of nextScope(target,baseRequest,request,response);
|
||||
if (never())
|
||||
nextScope(target,baseRequest,request,response);
|
||||
else if (_nextScope != null)
|
||||
_nextScope.doScope(target,baseRequest,request,response);
|
||||
else if (_outerScope != null)
|
||||
_outerScope.doHandle(target,baseRequest,request,response);
|
||||
else
|
||||
doHandle(target,baseRequest,request,response);
|
||||
// end manual inline (pathentic attempt to reduce stack depth)
|
||||
nextScope(target,baseRequest,request,response);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -1159,7 +1150,41 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
protected void requestInitialized(Request baseRequest, HttpServletRequest request)
|
||||
{
|
||||
// Handle the REALLY SILLY request events!
|
||||
if (!_servletRequestAttributeListeners.isEmpty())
|
||||
for (ServletRequestAttributeListener l :_servletRequestAttributeListeners)
|
||||
baseRequest.addEventListener(l);
|
||||
|
||||
if (!_servletRequestListeners.isEmpty())
|
||||
{
|
||||
final ServletRequestEvent sre = new ServletRequestEvent(_scontext,request);
|
||||
for (ServletRequestListener l : _servletRequestListeners)
|
||||
l.requestInitialized(sre);
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
protected void requestDestroyed(Request baseRequest, HttpServletRequest request)
|
||||
{
|
||||
// Handle more REALLY SILLY request events!
|
||||
if (!_servletRequestListeners.isEmpty())
|
||||
{
|
||||
final ServletRequestEvent sre = new ServletRequestEvent(_scontext,request);
|
||||
for (int i=_servletRequestListeners.size();i-->0;)
|
||||
_servletRequestListeners.get(i).requestDestroyed(sre);
|
||||
}
|
||||
|
||||
if (!_servletRequestAttributeListeners.isEmpty())
|
||||
{
|
||||
for (int i=_servletRequestAttributeListeners.size();i-->0;)
|
||||
baseRequest.removeEventListener(_servletRequestAttributeListeners.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.handler.ScopedHandler#doHandle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest,
|
||||
|
@ -1173,19 +1198,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
try
|
||||
{
|
||||
if (new_context)
|
||||
{
|
||||
// Handle the REALLY SILLY request events!
|
||||
if (!_servletRequestAttributeListeners.isEmpty())
|
||||
for (ServletRequestAttributeListener l :_servletRequestAttributeListeners)
|
||||
baseRequest.addEventListener(l);
|
||||
|
||||
if (!_servletRequestListeners.isEmpty())
|
||||
{
|
||||
final ServletRequestEvent sre = new ServletRequestEvent(_scontext,request);
|
||||
for (ServletRequestListener l : _servletRequestListeners)
|
||||
l.requestInitialized(sre);
|
||||
}
|
||||
}
|
||||
requestInitialized(baseRequest,request);
|
||||
|
||||
switch(dispatch)
|
||||
{
|
||||
|
@ -1203,50 +1216,24 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
if (Boolean.TRUE.equals(baseRequest.getAttribute(Dispatcher.__ERROR_DISPATCH)))
|
||||
break;
|
||||
|
||||
Object error = request.getAttribute(Dispatcher.ERROR_STATUS_CODE);
|
||||
// We can just call sendError here. If there is no error page, then one will
|
||||
// We can just call doError here. If there is no error page, then one will
|
||||
// be generated. If there is an error page, then a RequestDispatcher will be
|
||||
// used to route the request through appropriate filters etc.
|
||||
response.sendError((error instanceof Integer)?((Integer)error).intValue():500);
|
||||
doError(target,baseRequest,request,response);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// start manual inline of nextHandle(target,baseRequest,request,response);
|
||||
// noinspection ConstantIfStatement
|
||||
if (never())
|
||||
nextHandle(target,baseRequest,request,response);
|
||||
else if (_nextScope != null && _nextScope == _handler)
|
||||
_nextScope.doHandle(target,baseRequest,request,response);
|
||||
else if (_handler != null)
|
||||
_handler.handle(target,baseRequest,request,response);
|
||||
// end manual inline
|
||||
nextHandle(target,baseRequest,request,response);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Handle more REALLY SILLY request events!
|
||||
if (new_context)
|
||||
{
|
||||
if (!_servletRequestListeners.isEmpty())
|
||||
{
|
||||
final ServletRequestEvent sre = new ServletRequestEvent(_scontext,request);
|
||||
for (int i=_servletRequestListeners.size();i-->0;)
|
||||
_servletRequestListeners.get(i).requestDestroyed(sre);
|
||||
}
|
||||
|
||||
if (!_servletRequestAttributeListeners.isEmpty())
|
||||
{
|
||||
for (int i=_servletRequestAttributeListeners.size();i-->0;)
|
||||
baseRequest.removeEventListener(_servletRequestAttributeListeners.get(i));
|
||||
}
|
||||
}
|
||||
requestDestroyed(baseRequest,request);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param request A request that is applicable to the scope, or null
|
||||
* @param reason An object that indicates the reason the scope is being entered.
|
||||
|
|
|
@ -74,6 +74,12 @@ public class ErrorHandler extends AbstractHandler
|
|||
*/
|
||||
@Override
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
doError(target,baseRequest,request,response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doError(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
String method = request.getMethod();
|
||||
if (!HttpMethod.GET.is(method) && !HttpMethod.POST.is(method) && !HttpMethod.HEAD.is(method))
|
||||
|
|
|
@ -129,7 +129,7 @@ public abstract class ScopedHandler extends HandlerWrapper
|
|||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** ------------------------------------------------------------ */
|
||||
/*
|
||||
*/
|
||||
@Override
|
||||
|
@ -145,22 +145,23 @@ public abstract class ScopedHandler extends HandlerWrapper
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
/**
|
||||
* Scope the handler
|
||||
* <p>Derived implementations should call {@link #nextScope(String, Request, HttpServletRequest, HttpServletResponse)}
|
||||
*/
|
||||
public abstract void doScope(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException;
|
||||
public void doScope(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException
|
||||
{
|
||||
nextScope(target,baseRequest,request,response);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
/**
|
||||
* Scope the handler
|
||||
*/
|
||||
public final void nextScope(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException
|
||||
{
|
||||
// this method has been manually inlined in several locations, but
|
||||
// is called protected by an if(never()), so your IDE can find those
|
||||
// locations if this code is changed.
|
||||
if (_nextScope!=null)
|
||||
_nextScope.doScope(target,baseRequest,request, response);
|
||||
else if (_outerScope!=null)
|
||||
|
@ -170,8 +171,9 @@ public abstract class ScopedHandler extends HandlerWrapper
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
/**
|
||||
* Do the handler work within the scope.
|
||||
* <p>Derived implementations should call {@link #nextHandle(String, Request, HttpServletRequest, HttpServletResponse)}
|
||||
*/
|
||||
public abstract void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException;
|
||||
|
@ -182,19 +184,9 @@ public abstract class ScopedHandler extends HandlerWrapper
|
|||
*/
|
||||
public final void nextHandle(String target, final Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
// this method has been manually inlined in several locations, but
|
||||
// is called protected by an if(never()), so your IDE can find those
|
||||
// locations if this code is changed.
|
||||
if (_nextScope!=null && _nextScope==_handler)
|
||||
_nextScope.doHandle(target,baseRequest,request, response);
|
||||
else if (_handler!=null)
|
||||
_handler.handle(target,baseRequest, request, response);
|
||||
super.handle(target,baseRequest,request,response);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
protected boolean never()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1581,14 +1581,7 @@ public class SessionHandler extends ScopedHandler
|
|||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
// start manual inline of nextHandle(target,baseRequest,request,response);
|
||||
if (never())
|
||||
nextHandle(target,baseRequest,request,response);
|
||||
else if (_nextScope != null && _nextScope == _handler)
|
||||
_nextScope.doHandle(target,baseRequest,request,response);
|
||||
else if (_handler != null)
|
||||
_handler.handle(target,baseRequest,request,response);
|
||||
// end manual inline
|
||||
nextHandle(target,baseRequest,request,response);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -128,7 +128,7 @@ public abstract class AbstractHttpTest
|
|||
}
|
||||
}
|
||||
|
||||
protected class ThrowExceptionOnDemandHandler extends AbstractHandler
|
||||
protected class ThrowExceptionOnDemandHandler extends AbstractHandler.ErrorDispatchHandler
|
||||
{
|
||||
private final boolean throwException;
|
||||
private volatile Throwable failure;
|
||||
|
@ -138,14 +138,8 @@ public abstract class AbstractHttpTest
|
|||
this.throwException = throwException;
|
||||
}
|
||||
|
||||
@Override final
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
super.handle(target,baseRequest,request,response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (throwException)
|
||||
throw new TestCommitException();
|
||||
|
|
|
@ -38,15 +38,11 @@ import org.eclipse.jetty.server.handler.AbstractHandler;
|
|||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Dump request handler.
|
||||
* Dumps GET and POST requests.
|
||||
* Useful for testing and debugging.
|
||||
*
|
||||
* @version $Id: DumpHandler.java,v 1.14 2005/08/13 00:01:26 gregwilkins Exp $
|
||||
*
|
||||
*/
|
||||
public class DumpHandler extends AbstractHandler
|
||||
public class DumpHandler extends AbstractHandler.ErrorDispatchHandler
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(DumpHandler.class);
|
||||
|
||||
|
@ -61,12 +57,8 @@ public class DumpHandler extends AbstractHandler
|
|||
this.label=label;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* @see org.eclipse.jetty.server.server.Handler#handle(java.lang.String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, int)
|
||||
*/
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (!isStarted())
|
||||
return;
|
||||
|
|
|
@ -857,10 +857,10 @@ public class HttpConnectionTest
|
|||
final CountDownLatch checkError = new CountDownLatch(1);
|
||||
String response = null;
|
||||
server.stop();
|
||||
server.setHandler(new DumpHandler()
|
||||
server.setHandler(new AbstractHandler.ErrorDispatchHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setHeader(HttpHeader.CONTENT_TYPE.toString(),MimeTypes.Type.TEXT_HTML.toString());
|
||||
|
|
|
@ -84,7 +84,7 @@ public class HttpManyWaysToAsyncCommitBadBehaviourTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
final CyclicBarrier resumeBarrier = new CyclicBarrier(1);
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(CONTEXT_ATTRIBUTE) == null)
|
||||
{
|
||||
|
@ -118,7 +118,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
}).run();
|
||||
}
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(CONTEXT_ATTRIBUTE) == null)
|
||||
{
|
||||
|
@ -177,7 +177,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}).run();
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(CONTEXT_ATTRIBUTE) == null)
|
||||
{
|
||||
|
@ -243,7 +243,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}).run();
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(CONTEXT_ATTRIBUTE) == null)
|
||||
{
|
||||
|
@ -315,7 +315,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}).run();
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(CONTEXT_ATTRIBUTE) == null)
|
||||
{
|
||||
|
@ -384,7 +384,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}).run();
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -426,7 +426,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(CONTEXT_ATTRIBUTE) == null)
|
||||
{
|
||||
|
@ -456,7 +456,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}).run();
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -501,7 +501,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(CONTEXT_ATTRIBUTE) == null)
|
||||
{
|
||||
|
@ -530,7 +530,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}).run();
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -573,7 +573,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(CONTEXT_ATTRIBUTE) == null)
|
||||
{
|
||||
|
@ -602,7 +602,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}).run();
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -646,7 +646,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(CONTEXT_ATTRIBUTE) == null)
|
||||
{
|
||||
|
@ -675,7 +675,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}).run();
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -714,7 +714,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(CONTEXT_ATTRIBUTE) == null)
|
||||
{
|
||||
|
@ -743,7 +743,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}).run();
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -783,7 +783,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(CONTEXT_ATTRIBUTE) == null)
|
||||
{
|
||||
|
@ -812,7 +812,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}).run();
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,10 +86,10 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(false); // not needed, but lets be explicit about what the test does
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,10 +126,10 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,11 +166,11 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.getWriter().write("foobar");
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,12 +211,12 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.getWriter().write("foobar");
|
||||
response.flushBuffer();
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,11 +254,11 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.flushBuffer();
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -299,13 +299,13 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.getWriter().write("foo");
|
||||
response.flushBuffer();
|
||||
response.getWriter().write("bar");
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -374,12 +374,12 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setBufferSize(4);
|
||||
response.getWriter().write("foobar");
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -391,13 +391,13 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setBufferSize(8);
|
||||
response.getWriter().write("fo");
|
||||
response.getWriter().write("obarfoobar");
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -409,7 +409,7 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setBufferSize(8);
|
||||
|
@ -419,7 +419,7 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
response.getWriter().write("fo");
|
||||
response.getWriter().write("ob");
|
||||
response.getWriter().write("ar");
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -520,12 +520,12 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setContentLength(3);
|
||||
response.getWriter().write("foo");
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -563,13 +563,13 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setContentLength(3);
|
||||
// Only "foo" will get written and "bar" will be discarded
|
||||
response.getWriter().write("foobar");
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -607,12 +607,12 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.getWriter().write("foo");
|
||||
response.setContentLength(3);
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -650,12 +650,12 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.getWriter().write("foobar");
|
||||
response.setContentLength(3);
|
||||
super.doHandle(target, baseRequest, request, response);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -269,10 +269,10 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
|||
@Test
|
||||
public void testExceptionThrownInHandler() throws Exception
|
||||
{
|
||||
configureServer(new AbstractHandler()
|
||||
configureServer(new AbstractHandler.ErrorDispatchHandler()
|
||||
{
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
throw new QuietServletException("TEST handler exception");
|
||||
}
|
||||
|
@ -300,10 +300,10 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
|||
{
|
||||
final AtomicBoolean fourBytesRead = new AtomicBoolean(false);
|
||||
final AtomicBoolean earlyEOFException = new AtomicBoolean(false);
|
||||
configureServer(new AbstractHandler()
|
||||
configureServer(new AbstractHandler.ErrorDispatchHandler()
|
||||
{
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
int contentLength = request.getContentLength();
|
||||
|
|
|
@ -1494,14 +1494,14 @@ public class RequestTest
|
|||
boolean check(HttpServletRequest request,HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
||||
private class RequestHandler extends AbstractHandler
|
||||
private class RequestHandler extends AbstractHandler.ErrorDispatchHandler
|
||||
{
|
||||
private RequestTester _checker;
|
||||
@SuppressWarnings("unused")
|
||||
private String _content;
|
||||
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
((Request)request).setHandled(true);
|
||||
|
||||
|
|
|
@ -99,10 +99,10 @@ public class SniSslConnectionFactoryTest
|
|||
new HttpConnectionFactory(_https_config));
|
||||
_server.addConnector(https);
|
||||
|
||||
_server.setHandler(new AbstractHandler()
|
||||
_server.setHandler(new AbstractHandler.ErrorDispatchHandler()
|
||||
{
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setStatus(200);
|
||||
|
|
|
@ -478,16 +478,7 @@ public class ServletHandler extends ScopedHandler
|
|||
old_scope=baseRequest.getUserIdentityScope();
|
||||
baseRequest.setUserIdentityScope(servlet_holder);
|
||||
|
||||
// start manual inline of nextScope(target,baseRequest,request,response);
|
||||
if (never())
|
||||
nextScope(target,baseRequest,request,response);
|
||||
else if (_nextScope!=null)
|
||||
_nextScope.doScope(target,baseRequest,request, response);
|
||||
else if (_outerScope!=null)
|
||||
_outerScope.doHandle(target,baseRequest,request, response);
|
||||
else
|
||||
doHandle(target,baseRequest,request, response);
|
||||
// end manual inline (pathentic attempt to reduce stack depth)
|
||||
nextScope(target,baseRequest,request,response);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -41,12 +41,11 @@ public class UnixSocketServer
|
|||
UnixSocketConnector connector = new UnixSocketConnector(server,proxy,http);
|
||||
server.addConnector(connector);
|
||||
|
||||
server.setHandler(new AbstractHandler()
|
||||
server.setHandler(new AbstractHandler.ErrorDispatchHandler()
|
||||
{
|
||||
|
||||
@Override
|
||||
protected void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setStatus(200);
|
||||
|
|
|
@ -495,12 +495,11 @@ public class ServerTimeoutsTest extends AbstractTest
|
|||
int bytesPerSecond = 20;
|
||||
httpConfig.setMinRequestDataRate(bytesPerSecond);
|
||||
CountDownLatch handlerLatch = new CountDownLatch(1);
|
||||
start(new AbstractHandler()
|
||||
start(new AbstractHandler.ErrorDispatchHandler()
|
||||
{
|
||||
@Override
|
||||
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
|
@ -518,6 +517,7 @@ public class ServerTimeoutsTest extends AbstractTest
|
|||
throw x;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
DeferredContentProvider contentProvider = new DeferredContentProvider();
|
||||
|
|
Loading…
Reference in New Issue