diff src/org/eclipse/jetty/server/Response.java @ 911:cab5830e1ab0

remove ErrorHandler
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 08 Oct 2016 21:37:13 -0600
parents df84a1741687
children 5ee36654b383
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/Response.java	Sat Oct 08 21:30:32 2016 -0600
+++ b/src/org/eclipse/jetty/server/Response.java	Sat Oct 08 21:37:13 2016 -0600
@@ -46,7 +46,6 @@
 import org.eclipse.jetty.http.MimeTypes;
 import org.eclipse.jetty.io.BufferCache.CachedBuffer;
 import org.eclipse.jetty.server.handler.ContextHandler;
-import org.eclipse.jetty.server.handler.ErrorHandler;
 import org.eclipse.jetty.util.ByteArrayISO8859Writer;
 import org.eclipse.jetty.util.QuotedStringTokenizer;
 import org.eclipse.jetty.util.StringUtil;
@@ -247,63 +246,47 @@
 		{
 			Request request = _connection.getRequest();
 
-			ErrorHandler error_handler = null;
-			ContextHandler.Context context = request.getContext();
-			if (context!=null)
-				error_handler=context.getContextHandler().getErrorHandler();
-			if (error_handler==null)
-				error_handler = _connection.getConnector().server.getBean(ErrorHandler.class);
-			if (error_handler!=null)
+			setHeader(HttpHeaders.CACHE_CONTROL, "must-revalidate,no-cache,no-store");
+			setContentType(MimeTypes.TEXT_HTML_8859_1);
+			ByteArrayISO8859Writer writer= new ByteArrayISO8859Writer(2048);
+			if (message != null)
 			{
-				request.setAttribute(RequestDispatcher.ERROR_STATUS_CODE,new Integer(code));
-				request.setAttribute(RequestDispatcher.ERROR_MESSAGE, message);
-				request.setAttribute(RequestDispatcher.ERROR_REQUEST_URI, request.getRequestURI());
-				error_handler.handle(null,_connection.getRequest(),_connection.getRequest(),this );
+				message= StringUtil.replace(message, "&", "&amp;");
+				message= StringUtil.replace(message, "<", "&lt;");
+				message= StringUtil.replace(message, ">", "&gt;");
 			}
-			else
+			String uri= request.getRequestURI();
+			if (uri!=null)
 			{
-				setHeader(HttpHeaders.CACHE_CONTROL, "must-revalidate,no-cache,no-store");
-				setContentType(MimeTypes.TEXT_HTML_8859_1);
-				ByteArrayISO8859Writer writer= new ByteArrayISO8859Writer(2048);
-				if (message != null)
-				{
-					message= StringUtil.replace(message, "&", "&amp;");
-					message= StringUtil.replace(message, "<", "&lt;");
-					message= StringUtil.replace(message, ">", "&gt;");
-				}
-				String uri= request.getRequestURI();
-				if (uri!=null)
-				{
-					uri= StringUtil.replace(uri, "&", "&amp;");
-					uri= StringUtil.replace(uri, "<", "&lt;");
-					uri= StringUtil.replace(uri, ">", "&gt;");
-				}
+				uri= StringUtil.replace(uri, "&", "&amp;");
+				uri= StringUtil.replace(uri, "<", "&lt;");
+				uri= StringUtil.replace(uri, ">", "&gt;");
+			}
 
-				writer.write("<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=ISO-8859-1\"/>\n");
-				writer.write("<title>Error ");
-				writer.write(Integer.toString(code));
-				writer.write(' ');
-				if (message==null)
-					message=HttpStatus.getMessage(code);
-				writer.write(message);
-				writer.write("</title>\n</head>\n<body>\n<h2>HTTP ERROR: ");
-				writer.write(Integer.toString(code));
-				writer.write("</h2>\n<p>Problem accessing ");
-				writer.write(uri);
-				writer.write(". Reason:\n<pre>    ");
-				writer.write(message);
-				writer.write("</pre>");
-				writer.write("</p>\n<hr /><i><small>Powered by Jetty://</small></i>");
+			writer.write("<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=ISO-8859-1\"/>\n");
+			writer.write("<title>Error ");
+			writer.write(Integer.toString(code));
+			writer.write(' ');
+			if (message==null)
+				message=HttpStatus.getMessage(code);
+			writer.write(message);
+			writer.write("</title>\n</head>\n<body>\n<h2>HTTP ERROR: ");
+			writer.write(Integer.toString(code));
+			writer.write("</h2>\n<p>Problem accessing ");
+			writer.write(uri);
+			writer.write(". Reason:\n<pre>    ");
+			writer.write(message);
+			writer.write("</pre>");
+			writer.write("</p>\n<hr /><i><small>Powered by Jetty://</small></i>");
 
-				for (int i= 0; i < 20; i++)
-					writer.write("\n                                                ");
-				writer.write("\n</body>\n</html>\n");
+			for (int i= 0; i < 20; i++)
+				writer.write("\n                                                ");
+			writer.write("\n</body>\n</html>\n");
 
-				writer.flush();
-				setContentLength(writer.size());
-				writer.writeTo(getOutputStream());
-				writer.destroy();
-			}
+			writer.flush();
+			setContentLength(writer.size());
+			writer.writeTo(getOutputStream());
+			writer.destroy();
 		}
 		else if (code!=SC_PARTIAL_CONTENT)
 		{