Issue #4264 Revert doError signature

revert the doError signature.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2019-11-07 09:31:52 +11:00
parent b455b8abcc
commit 070d2b235e
1 changed files with 17 additions and 11 deletions

View File

@ -27,11 +27,9 @@ import java.nio.ByteBuffer;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.servlet.RequestDispatcher; import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -95,7 +93,7 @@ public class ErrorHandler extends AbstractHandler
} }
@Override @Override
public void doError(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException public void doError(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
{ {
String cacheControl = getCacheControl(); String cacheControl = getCacheControl();
if (cacheControl != null) if (cacheControl != null)
@ -113,15 +111,23 @@ public class ErrorHandler extends AbstractHandler
{ {
if (errorDispatcher != null) if (errorDispatcher != null)
{ {
errorDispatcher.error(request, response); try
} {
else errorDispatcher.error(request, response);
{ return;
String message = (String)request.getAttribute(Dispatcher.ERROR_MESSAGE); }
if (message == null) catch (ServletException e)
message = baseRequest.getResponse().getReason(); {
generateAcceptableResponse(baseRequest, request, response, response.getStatus(), message); LOG.debug(e);
if (response.isCommitted())
return;
}
} }
String message = (String)request.getAttribute(Dispatcher.ERROR_MESSAGE);
if (message == null)
message = baseRequest.getResponse().getReason();
generateAcceptableResponse(baseRequest, request, response, response.getStatus(), message);
} }
finally finally
{ {