* Implement suppressErrorPage property to allow error pages

for low level errors to be suppressed:

    suppressErrorPage = true
This commit is contained in:
hns 2007-11-05 14:03:02 +00:00
parent a21d31830e
commit 1650407241
2 changed files with 21 additions and 17 deletions

View file

@ -541,6 +541,7 @@ public final class ResponseTrans extends Writer implements Serializable {
writeXmlRpcError(new RuntimeException(message)); writeXmlRpcError(new RuntimeException(message));
} else { } else {
status = 500; status = 500;
if (!"true".equalsIgnoreCase(app.getProperty("suppressErrorPage"))) {
write("<html><body><h3>"); write("<html><body><h3>");
write("Error in application "); write("Error in application ");
write(appName); write(appName);
@ -549,6 +550,7 @@ public final class ResponseTrans extends Writer implements Serializable {
write("</body></html>"); write("</body></html>");
} }
} }
}
public void writeXmlRpcResponse(Object result) { public void writeXmlRpcResponse(Object result) {
try { try {

View file

@ -366,6 +366,7 @@ public abstract class AbstractServletClient extends HttpServlet {
response.setStatus(code); response.setStatus(code);
response.setContentType("text/html"); response.setContentType("text/html");
if (!"true".equalsIgnoreCase(getApplication().getProperty("suppressErrorPage"))) {
Writer writer = response.getWriter(); Writer writer = response.getWriter();
writer.write("<html><body><h3>"); writer.write("<html><body><h3>");
@ -380,6 +381,7 @@ public abstract class AbstractServletClient extends HttpServlet {
writer.write("</body></html>"); writer.write("</body></html>");
writer.flush(); writer.flush();
} }
}
void sendRedirect(HttpServletRequest req, HttpServletResponse res, String url) { void sendRedirect(HttpServletRequest req, HttpServletResponse res, String url) {
String location = url; String location = url;