* 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,12 +541,14 @@ public final class ResponseTrans extends Writer implements Serializable {
writeXmlRpcError(new RuntimeException(message)); writeXmlRpcError(new RuntimeException(message));
} else { } else {
status = 500; status = 500;
write("<html><body><h3>"); if (!"true".equalsIgnoreCase(app.getProperty("suppressErrorPage"))) {
write("Error in application "); write("<html><body><h3>");
write(appName); write("Error in application ");
write("</h3>"); write(appName);
write(message); write("</h3>");
write("</body></html>"); write(message);
write("</body></html>");
}
} }
} }

View file

@ -366,19 +366,21 @@ public abstract class AbstractServletClient extends HttpServlet {
response.setStatus(code); response.setStatus(code);
response.setContentType("text/html"); response.setContentType("text/html");
Writer writer = response.getWriter(); if (!"true".equalsIgnoreCase(getApplication().getProperty("suppressErrorPage"))) {
Writer writer = response.getWriter();
writer.write("<html><body><h3>"); writer.write("<html><body><h3>");
writer.write("Error in application "); writer.write("Error in application ");
try { try {
writer.write(getApplication().getName()); writer.write(getApplication().getName());
} catch (Exception besafe) { } catch (Exception besafe) {
// ignore // ignore
}
writer.write("</h3>");
writer.write(message);
writer.write("</body></html>");
writer.flush();
} }
writer.write("</h3>");
writer.write(message);
writer.write("</body></html>");
writer.flush();
} }
void sendRedirect(HttpServletRequest req, HttpServletResponse res, String url) { void sendRedirect(HttpServletRequest req, HttpServletResponse res, String url) {