* Issue #4265 Remove doError The doError method and the ErrorDispatchHandler class were hang overs from when we needed to dispatch into a context to get sendError called, which would then generate the error page. Now sendError doesn't do any generation, rather it changes state that arranges either for a minimal error page to be generated or an ERROR dispatch to a real handler/servlet to generate the error page. Thus the ErrorDispatchHandler and doError methods can now be removed. Signed-off-by: Greg Wilkins <gregw@webtide.com> * Issue #4265 Remove doError Moved the error page dispatching logic back to the ErrorHandler class to assist with backwards compatibility Signed-off-by: Greg Wilkins <gregw@webtide.com> * Issue #4265 Remove doError Moved the error page dispatching logic back to the ErrorHandler class to assist with backwards compatibility Signed-off-by: Greg Wilkins <gregw@webtide.com> * Issue #4265 doError Updates from review. Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
9cede68b35
commit
869c3b51ce
|
@ -80,10 +80,10 @@ public class JDK9ALPNTest
|
|||
@Test
|
||||
public void testClientNotSupportingALPNServerSpeaksDefaultProtocol() throws Exception
|
||||
{
|
||||
startServer(new AbstractHandler.ErrorDispatchHandler()
|
||||
startServer(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
}
|
||||
|
@ -122,10 +122,10 @@ public class JDK9ALPNTest
|
|||
@Test
|
||||
public void testClientSupportingALPNServerSpeaksNegotiatedProtocol() throws Exception
|
||||
{
|
||||
startServer(new AbstractHandler.ErrorDispatchHandler()
|
||||
startServer(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
}
|
||||
|
|
|
@ -26,10 +26,10 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||
|
||||
public class EmptyServerHandler extends AbstractHandler.ErrorDispatchHandler
|
||||
public class EmptyServerHandler extends AbstractHandler
|
||||
{
|
||||
@Override
|
||||
protected final void doNonErrorHandle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public final void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
jettyRequest.setHandled(true);
|
||||
service(target, jettyRequest, request, response);
|
||||
|
|
|
@ -535,10 +535,10 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ExchangeIsComplete_OnlyWhenBothRequestAndResponseAreComplete(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler.ErrorDispatchHandler()
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setContentLength(0);
|
||||
|
|
|
@ -26,10 +26,10 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||
|
||||
public class EmptyServerHandler extends AbstractHandler.ErrorDispatchHandler
|
||||
public class EmptyServerHandler extends AbstractHandler
|
||||
{
|
||||
@Override
|
||||
protected final void doNonErrorHandle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public final void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
jettyRequest.setHandled(true);
|
||||
service(target, jettyRequest, request, response);
|
||||
|
|
|
@ -49,7 +49,7 @@ public class HttpServiceErrorPageErrorHandler extends ErrorPageErrorHandler
|
|||
@Override
|
||||
public void handle(String target, Request baseRequest,
|
||||
HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException
|
||||
throws IOException, ServletException
|
||||
{
|
||||
if (HttpServiceErrorHandlerHelper.getCustomErrorHandler() != null)
|
||||
{
|
||||
|
|
|
@ -51,7 +51,6 @@ import org.eclipse.jetty.io.QuietException;
|
|||
import org.eclipse.jetty.server.HttpChannelState.Action;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.server.handler.ErrorHandler;
|
||||
import org.eclipse.jetty.server.handler.ErrorHandler.ErrorPageMapper;
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.SharedBlockingCallback.Blocker;
|
||||
|
@ -372,8 +371,6 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
|
|||
{
|
||||
if (!_request.hasMetaData())
|
||||
throw new IllegalStateException("state=" + _state);
|
||||
_request.setHandled(false);
|
||||
_response.reopen();
|
||||
|
||||
dispatch(DispatcherType.REQUEST, () ->
|
||||
{
|
||||
|
@ -391,9 +388,6 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
|
|||
|
||||
case ASYNC_DISPATCH:
|
||||
{
|
||||
_request.setHandled(false);
|
||||
_response.reopen();
|
||||
|
||||
dispatch(DispatcherType.ASYNC,() -> getServer().handleAsync(this));
|
||||
break;
|
||||
}
|
||||
|
@ -407,9 +401,7 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
|
|||
try
|
||||
{
|
||||
// Get ready to send an error response
|
||||
_request.setHandled(false);
|
||||
_response.resetContent();
|
||||
_response.reopen();
|
||||
|
||||
// the following is needed as you cannot trust the response code and reason
|
||||
// as those could have been modified after calling sendError
|
||||
|
@ -426,20 +418,11 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
|
|||
break;
|
||||
}
|
||||
|
||||
// Look for an error page dispatcher
|
||||
String errorPage = (errorHandler instanceof ErrorPageMapper) ? ((ErrorPageMapper)errorHandler).getErrorPage(_request) : null;
|
||||
Dispatcher errorDispatcher = errorPage != null ? (Dispatcher)context.getRequestDispatcher(errorPage) : null;
|
||||
if (errorDispatcher == null)
|
||||
dispatch(DispatcherType.ERROR,() ->
|
||||
{
|
||||
// Allow ErrorHandler to generate response
|
||||
errorHandler.handle(null, _request, _request, _response);
|
||||
_request.setHandled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do the error page dispatch
|
||||
dispatch(DispatcherType.ERROR,() -> errorDispatcher.error(_request, _response));
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
|
@ -557,6 +540,8 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
|
|||
{
|
||||
try
|
||||
{
|
||||
_request.setHandled(false);
|
||||
_response.reopen();
|
||||
_request.setDispatcherType(type);
|
||||
_combinedListener.onBeforeDispatch(_request);
|
||||
dispatchable.dispatch();
|
||||
|
|
|
@ -66,11 +66,7 @@ public abstract class AbstractHandler extends ContainerLifeCycle implements Hand
|
|||
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}
|
||||
*
|
||||
* Deprecated error page generation
|
||||
* @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
|
||||
|
@ -81,16 +77,14 @@ public abstract class AbstractHandler extends ContainerLifeCycle implements Hand
|
|||
* 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
|
||||
* @see ErrorDispatchHandler for a convenience class that calls this method.
|
||||
*/
|
||||
@Deprecated
|
||||
protected void doError(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
Object o = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
|
||||
int code = (o instanceof Integer) ? ((Integer)o).intValue() : (o != null ? Integer.parseInt(o.toString()) : 500);
|
||||
o = request.getAttribute(RequestDispatcher.ERROR_MESSAGE);
|
||||
String reason = o != null ? o.toString() : null;
|
||||
|
||||
response.sendError(code, reason);
|
||||
response.setStatus(code);
|
||||
baseRequest.setHandled(true);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -147,7 +141,9 @@ public abstract class AbstractHandler extends ContainerLifeCycle implements Hand
|
|||
* {@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
|
||||
* @deprecated This class is no longer required as ERROR dispatch is only done if there is an error page target.
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract static class ErrorDispatchHandler extends AbstractHandler
|
||||
{
|
||||
@Override
|
||||
|
@ -174,6 +170,7 @@ public abstract class AbstractHandler extends ContainerLifeCycle implements Hand
|
|||
* @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
|
||||
*/
|
||||
@Deprecated
|
||||
protected abstract void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.nio.charset.Charset;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
@ -82,26 +83,45 @@ public class ErrorHandler extends AbstractHandler
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jetty.server.server.Handler#handle(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, int)
|
||||
*/
|
||||
@Override
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
// TODO inline this and remove method in jetty-10
|
||||
doError(target, baseRequest, request, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doError(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void doError(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
String cacheControl = getCacheControl();
|
||||
if (cacheControl != null)
|
||||
response.setHeader(HttpHeader.CACHE_CONTROL.asString(), cacheControl);
|
||||
|
||||
String message = (String)request.getAttribute(Dispatcher.ERROR_MESSAGE);
|
||||
if (message == null)
|
||||
message = baseRequest.getResponse().getReason();
|
||||
generateAcceptableResponse(baseRequest, request, response, response.getStatus(), message);
|
||||
// Look for an error page dispatcher
|
||||
// This logic really should be in ErrorPageErrorHandler, but some implementations extend ErrorHandler
|
||||
// and implement ErrorPageMapper directly, so we do this here in the base class.
|
||||
String errorPage = (this instanceof ErrorPageMapper) ? ((ErrorPageMapper)this).getErrorPage(request) : null;
|
||||
ContextHandler.Context context = baseRequest.getErrorContext();
|
||||
Dispatcher errorDispatcher = (errorPage != null && context != null)
|
||||
? (Dispatcher)context.getRequestDispatcher(errorPage) : null;
|
||||
|
||||
try
|
||||
{
|
||||
if (errorDispatcher != null)
|
||||
{
|
||||
errorDispatcher.error(request, response);
|
||||
}
|
||||
else
|
||||
{
|
||||
String message = (String)request.getAttribute(Dispatcher.ERROR_MESSAGE);
|
||||
if (message == null)
|
||||
message = baseRequest.getResponse().getReason();
|
||||
generateAcceptableResponse(baseRequest, request, response, response.getStatus(), message);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -104,7 +104,7 @@ public abstract class AbstractHttpTest
|
|||
}
|
||||
}
|
||||
|
||||
protected class ThrowExceptionOnDemandHandler extends AbstractHandler.ErrorDispatchHandler
|
||||
protected class ThrowExceptionOnDemandHandler extends AbstractHandler
|
||||
{
|
||||
private final boolean throwException;
|
||||
private volatile Throwable failure;
|
||||
|
@ -115,7 +115,7 @@ public abstract class AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (throwException)
|
||||
throw new TestCommitException();
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.eclipse.jetty.util.log.Logger;
|
|||
* Dumps GET and POST requests.
|
||||
* Useful for testing and debugging.
|
||||
*/
|
||||
public class DumpHandler extends AbstractHandler.ErrorDispatchHandler
|
||||
public class DumpHandler extends AbstractHandler
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(DumpHandler.class);
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class DumpHandler extends AbstractHandler.ErrorDispatchHandler
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (!isStarted())
|
||||
return;
|
||||
|
|
|
@ -271,10 +271,10 @@ public class HttpChannelEventTest
|
|||
assertTrue(latch.await(5, TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
private static class TestHandler extends AbstractHandler.ErrorDispatchHandler
|
||||
private static class TestHandler extends AbstractHandler
|
||||
{
|
||||
@Override
|
||||
protected final void doNonErrorHandle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public final void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
jettyRequest.setHandled(true);
|
||||
handle(request, response);
|
||||
|
|
|
@ -1219,11 +1219,11 @@ public class HttpConnectionTest
|
|||
final String longstr = str;
|
||||
final CountDownLatch checkError = new CountDownLatch(1);
|
||||
server.stop();
|
||||
server.setHandler(new AbstractHandler.ErrorDispatchHandler()
|
||||
server.setHandler(new AbstractHandler()
|
||||
{
|
||||
@SuppressWarnings("unused")
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(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());
|
||||
|
|
|
@ -126,7 +126,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(contextAttribute) == null)
|
||||
{
|
||||
|
@ -140,7 +140,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
asyncContext.complete();
|
||||
});
|
||||
}
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(contextAttribute) == null)
|
||||
{
|
||||
|
@ -215,7 +215,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
});
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(contextAttribute) == null)
|
||||
{
|
||||
|
@ -296,7 +296,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
});
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -354,7 +354,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(contextAttribute) == null)
|
||||
{
|
||||
|
@ -379,7 +379,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
});
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -437,7 +437,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(contextAttribute) == null)
|
||||
{
|
||||
|
@ -460,7 +460,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
});
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -520,7 +520,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(contextAttribute) == null)
|
||||
{
|
||||
|
@ -546,7 +546,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
});
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -607,7 +607,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(contextAttribute) == null)
|
||||
{
|
||||
|
@ -632,7 +632,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
});
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -689,7 +689,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(contextAttribute) == null)
|
||||
{
|
||||
|
@ -714,7 +714,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
});
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -772,7 +772,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(contextAttribute) == null)
|
||||
{
|
||||
|
@ -797,7 +797,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
});
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -850,7 +850,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(contextAttribute) == null)
|
||||
{
|
||||
|
@ -875,7 +875,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
});
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -930,7 +930,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, final HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (request.getAttribute(contextAttribute) == null)
|
||||
{
|
||||
|
@ -955,7 +955,7 @@ public class HttpManyWaysToAsyncCommitTest extends AbstractHttpTest
|
|||
});
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,10 +84,10 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(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.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,10 +125,10 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,11 +167,11 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.getWriter().write("foobar");
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,12 +214,12 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.getWriter().write("foobar");
|
||||
response.flushBuffer();
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,11 +259,11 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.flushBuffer();
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -305,13 +305,13 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(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.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -384,12 +384,12 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setBufferSize(4);
|
||||
response.getWriter().write("foobar");
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -401,13 +401,13 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(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.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -419,7 +419,7 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setBufferSize(8);
|
||||
|
@ -429,7 +429,7 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
response.getWriter().write("fo");
|
||||
response.getWriter().write("ob");
|
||||
response.getWriter().write("ar");
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -558,12 +558,12 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setContentLength(3);
|
||||
response.getWriter().write("foo");
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -603,13 +603,13 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(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.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -649,12 +649,12 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.getWriter().write("foo");
|
||||
response.setContentLength(3);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -694,12 +694,12 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.getWriter().write("foobar");
|
||||
response.setContentLength(3);
|
||||
super.doNonErrorHandle(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -283,10 +283,10 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
|||
@Test
|
||||
public void testExceptionThrownInHandler() throws Exception
|
||||
{
|
||||
configureServer(new AbstractHandler.ErrorDispatchHandler()
|
||||
configureServer(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
throw new QuietServletException("TEST handler exception");
|
||||
}
|
||||
|
@ -314,10 +314,10 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
|||
{
|
||||
final AtomicBoolean fourBytesRead = new AtomicBoolean(false);
|
||||
final AtomicBoolean earlyEOFException = new AtomicBoolean(false);
|
||||
configureServer(new AbstractHandler.ErrorDispatchHandler()
|
||||
configureServer(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
int contentLength = request.getContentLength();
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.io.PrintWriter;
|
|||
import java.net.Socket;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
@ -212,7 +211,7 @@ public class HttpServerTestFixture
|
|||
}
|
||||
}
|
||||
|
||||
protected static class ReadExactHandler extends AbstractHandler.ErrorDispatchHandler
|
||||
protected static class ReadExactHandler extends AbstractHandler
|
||||
{
|
||||
private int expected;
|
||||
|
||||
|
@ -227,7 +226,7 @@ public class HttpServerTestFixture
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
int len = expected < 0 ? request.getContentLength() : expected;
|
||||
|
@ -247,16 +246,6 @@ public class HttpServerTestFixture
|
|||
response.setContentLength(reply.length());
|
||||
response.getOutputStream().write(reply.getBytes(StandardCharsets.ISO_8859_1));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doError(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
System.err.println("ERROR: " + request.getAttribute(RequestDispatcher.ERROR_MESSAGE));
|
||||
Throwable th = (Throwable)request.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
|
||||
if (th != null)
|
||||
th.printStackTrace();
|
||||
super.doError(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
protected static class ReadHandler extends AbstractHandler
|
||||
|
|
|
@ -204,10 +204,10 @@ public class OptionalSslConnectionTest
|
|||
}
|
||||
}
|
||||
|
||||
private static class EmptyServerHandler extends AbstractHandler.ErrorDispatchHandler
|
||||
private static class EmptyServerHandler extends AbstractHandler
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
jettyRequest.setHandled(true);
|
||||
}
|
||||
|
|
|
@ -1857,14 +1857,14 @@ public class RequestTest
|
|||
boolean check(HttpServletRequest request, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
||||
private class RequestHandler extends AbstractHandler.ErrorDispatchHandler
|
||||
private class RequestHandler extends AbstractHandler
|
||||
{
|
||||
private RequestTester _checker;
|
||||
@SuppressWarnings("unused")
|
||||
private String _content;
|
||||
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
((Request)request).setHandled(true);
|
||||
|
||||
|
|
|
@ -152,10 +152,10 @@ public class ServerConnectorTimeoutTest extends ConnectorTimeoutTest
|
|||
public void testHttpWriteIdleTimeout() throws Exception
|
||||
{
|
||||
_httpConfiguration.setIdleTimeout(500);
|
||||
configureServer(new AbstractHandler.ErrorDispatchHandler()
|
||||
configureServer(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
IO.copy(request.getInputStream(), response.getOutputStream());
|
||||
|
|
|
@ -72,9 +72,9 @@ public class ServletWriterTest
|
|||
char[] chars = new char[128 * 1024 * 1024];
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
AtomicReference<Thread> serverThreadRef = new AtomicReference<>();
|
||||
start(chars.length, new AbstractHandler.ErrorDispatchHandler() {
|
||||
start(chars.length, new AbstractHandler() {
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
serverThreadRef.set(Thread.currentThread());
|
||||
jettyRequest.setHandled(true);
|
||||
|
|
|
@ -468,10 +468,10 @@ public class NcsaRequestLogTest
|
|||
{
|
||||
setup(logType);
|
||||
_server.setRequestLog(_log);
|
||||
AbstractHandler.ErrorDispatchHandler wrapper = new AbstractHandler.ErrorDispatchHandler()
|
||||
AbstractHandler wrapper = new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException
|
||||
{
|
||||
testHandler.handle(target, baseRequest, request, response);
|
||||
|
@ -484,10 +484,11 @@ public class NcsaRequestLogTest
|
|||
ErrorHandler errorHandler = new ErrorHandler()
|
||||
{
|
||||
@Override
|
||||
public void doError(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException
|
||||
{
|
||||
errors.add(baseRequest.getRequestURI());
|
||||
super.doError(target, baseRequest, request, response);
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
};
|
||||
_server.addBean(errorHandler);
|
||||
|
@ -502,10 +503,10 @@ public class NcsaRequestLogTest
|
|||
{
|
||||
setup(logType);
|
||||
_server.setRequestLog(_log);
|
||||
AbstractHandler.ErrorDispatchHandler wrapper = new AbstractHandler.ErrorDispatchHandler()
|
||||
AbstractHandler wrapper = new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException
|
||||
{
|
||||
testHandler.handle(target, baseRequest, request, response);
|
||||
|
|
|
@ -66,10 +66,10 @@ public class SSLReadEOFAfterResponseTest
|
|||
|
||||
String content = "the quick brown fox jumped over the lazy dog";
|
||||
byte[] bytes = content.getBytes(StandardCharsets.UTF_8);
|
||||
server.setHandler(new AbstractHandler.ErrorDispatchHandler()
|
||||
server.setHandler(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
// First: read the whole content.
|
||||
InputStream input = request.getInputStream();
|
||||
|
|
|
@ -128,10 +128,10 @@ public class SniSslConnectionFactoryTest
|
|||
new HttpConnectionFactory(_httpsConfiguration));
|
||||
_server.addConnector(https);
|
||||
|
||||
_server.setHandler(new AbstractHandler.ErrorDispatchHandler()
|
||||
_server.setHandler(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setStatus(200);
|
||||
|
|
|
@ -48,10 +48,10 @@ public class UnixSocketProxyServer
|
|||
if (Files.exists(socket))
|
||||
Files.delete(socket);
|
||||
|
||||
server.setHandler(new AbstractHandler.ErrorDispatchHandler()
|
||||
server.setHandler(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
int l = 0;
|
||||
if (request.getContentLength() != 0)
|
||||
|
|
|
@ -46,10 +46,10 @@ public class UnixSocketServer
|
|||
if (Files.exists(socket))
|
||||
Files.delete(socket);
|
||||
|
||||
server.setHandler(new AbstractHandler.ErrorDispatchHandler()
|
||||
server.setHandler(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
int l = 0;
|
||||
if (request.getContentLength() != 0)
|
||||
|
|
|
@ -102,10 +102,10 @@ public class UnixSocketTest
|
|||
connector.setUnixSocket(sockFile.toString());
|
||||
server.addConnector(connector);
|
||||
|
||||
server.setHandler(new AbstractHandler.ErrorDispatchHandler()
|
||||
server.setHandler(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
int l = 0;
|
||||
if (request.getContentLength() != 0)
|
||||
|
|
|
@ -26,10 +26,10 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||
|
||||
public class EmptyServerHandler extends AbstractHandler.ErrorDispatchHandler
|
||||
public class EmptyServerHandler extends AbstractHandler
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
jettyRequest.setHandled(true);
|
||||
service(target, jettyRequest, request, response);
|
||||
|
|
|
@ -742,10 +742,10 @@ public class HttpClientContinueTest extends AbstractTest<TransportScenario>
|
|||
public void test_NoExpect_Respond100Continue(Transport transport) throws Exception
|
||||
{
|
||||
init(transport);
|
||||
scenario.start(new AbstractHandler.ErrorDispatchHandler()
|
||||
scenario.start(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
jettyRequest.setHandled(true);
|
||||
// Force a 100 Continue response.
|
||||
|
|
|
@ -497,10 +497,10 @@ public class HttpClientStreamTest extends AbstractTest<TransportScenario>
|
|||
public void testInputStreamContentProviderThrowingWhileReading(Transport transport) throws Exception
|
||||
{
|
||||
init(transport);
|
||||
scenario.start(new AbstractHandler.ErrorDispatchHandler()
|
||||
scenario.start(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
IO.copy(request.getInputStream(), response.getOutputStream());
|
||||
|
|
|
@ -79,10 +79,10 @@ public class HttpTrailersTest extends AbstractTest<TransportScenario>
|
|||
{
|
||||
String trailerName = "Trailer";
|
||||
String trailerValue = "value";
|
||||
scenario.start(new AbstractHandler.ErrorDispatchHandler()
|
||||
scenario.start(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
jettyRequest.setHandled(true);
|
||||
|
||||
|
@ -118,10 +118,10 @@ public class HttpTrailersTest extends AbstractTest<TransportScenario>
|
|||
public void testEmptyRequestTrailers(Transport transport) throws Exception
|
||||
{
|
||||
init(transport);
|
||||
scenario.start(new AbstractHandler.ErrorDispatchHandler()
|
||||
scenario.start(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
jettyRequest.setHandled(true);
|
||||
|
||||
|
@ -167,10 +167,10 @@ public class HttpTrailersTest extends AbstractTest<TransportScenario>
|
|||
{
|
||||
String trailerName = "Trailer";
|
||||
String trailerValue = "value";
|
||||
scenario.start(new AbstractHandler.ErrorDispatchHandler()
|
||||
scenario.start(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
jettyRequest.setHandled(true);
|
||||
|
||||
|
@ -212,10 +212,10 @@ public class HttpTrailersTest extends AbstractTest<TransportScenario>
|
|||
public void testEmptyResponseTrailers(Transport transport) throws Exception
|
||||
{
|
||||
init(transport);
|
||||
scenario.start(new AbstractHandler.ErrorDispatchHandler()
|
||||
scenario.start(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
jettyRequest.setHandled(true);
|
||||
|
||||
|
@ -257,10 +257,10 @@ public class HttpTrailersTest extends AbstractTest<TransportScenario>
|
|||
String trailerName = "Trailer";
|
||||
String trailerValue = "value";
|
||||
init(transport);
|
||||
scenario.start(new AbstractHandler.ErrorDispatchHandler()
|
||||
scenario.start(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
jettyRequest.setHandled(true);
|
||||
|
||||
|
|
|
@ -426,10 +426,10 @@ public class ServerTimeoutsTest extends AbstractTest<TransportScenario>
|
|||
long blockingTimeout = 2 * idleTimeout;
|
||||
scenario.httpConfig.setBlockingTimeout(blockingTimeout);
|
||||
CountDownLatch handlerLatch = new CountDownLatch(1);
|
||||
scenario.start(new AbstractHandler.ErrorDispatchHandler()
|
||||
scenario.start(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -487,10 +487,10 @@ public class ServerTimeoutsTest extends AbstractTest<TransportScenario>
|
|||
{
|
||||
init(transport);
|
||||
CountDownLatch handlerLatch = new CountDownLatch(1);
|
||||
scenario.start(new AbstractHandler.ErrorDispatchHandler()
|
||||
scenario.start(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
AsyncContext asyncContext = request.startAsync();
|
||||
|
@ -551,10 +551,10 @@ public class ServerTimeoutsTest extends AbstractTest<TransportScenario>
|
|||
init(transport);
|
||||
|
||||
CountDownLatch handlerLatch = new CountDownLatch(1);
|
||||
scenario.start(new AbstractHandler.ErrorDispatchHandler()
|
||||
scenario.start(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
AsyncContext asyncContext = request.startAsync();
|
||||
|
@ -619,10 +619,10 @@ public class ServerTimeoutsTest extends AbstractTest<TransportScenario>
|
|||
scenario.requestLog.clear();
|
||||
scenario.httpConfig.setMinRequestDataRate(bytesPerSecond);
|
||||
CountDownLatch handlerLatch = new CountDownLatch(1);
|
||||
scenario.start(new AbstractHandler.ErrorDispatchHandler()
|
||||
scenario.start(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -683,10 +683,10 @@ public class ServerTimeoutsTest extends AbstractTest<TransportScenario>
|
|||
int bytesPerSecond = 20;
|
||||
scenario.httpConfig.setMinRequestDataRate(bytesPerSecond);
|
||||
CountDownLatch handlerLatch = new CountDownLatch(1);
|
||||
scenario.start(new AbstractHandler.ErrorDispatchHandler()
|
||||
scenario.start(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
ServletInputStream input = request.getInputStream();
|
||||
|
@ -762,10 +762,10 @@ public class ServerTimeoutsTest extends AbstractTest<TransportScenario>
|
|||
long idleTimeout = 3 * httpIdleTimeout;
|
||||
scenario.httpConfig.setIdleTimeout(httpIdleTimeout);
|
||||
CountDownLatch handlerLatch = new CountDownLatch(1);
|
||||
scenario.start(new AbstractHandler.ErrorDispatchHandler()
|
||||
scenario.start(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
AsyncContext asyncContext = request.startAsync();
|
||||
|
@ -946,7 +946,7 @@ public class ServerTimeoutsTest extends AbstractTest<TransportScenario>
|
|||
assertTrue(clientLatch.await(15, TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
private static class BlockingReadHandler extends AbstractHandler.ErrorDispatchHandler
|
||||
private static class BlockingReadHandler extends AbstractHandler
|
||||
{
|
||||
private final CountDownLatch handlerLatch;
|
||||
|
||||
|
@ -956,7 +956,7 @@ public class ServerTimeoutsTest extends AbstractTest<TransportScenario>
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
ServletInputStream input = request.getInputStream();
|
||||
|
|
Loading…
Reference in New Issue