* 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));
} else {
status = 500;
write("<html><body><h3>");
write("Error in application ");
write(appName);
write("</h3>");
write(message);
write("</body></html>");
if (!"true".equalsIgnoreCase(app.getProperty("suppressErrorPage"))) {
write("<html><body><h3>");
write("Error in application ");
write(appName);
write("</h3>");
write(message);
write("</body></html>");
}
}
}

View file

@ -366,19 +366,21 @@ public abstract class AbstractServletClient extends HttpServlet {
response.setStatus(code);
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("Error in application ");
try {
writer.write(getApplication().getName());
} catch (Exception besafe) {
// ignore
writer.write("<html><body><h3>");
writer.write("Error in application ");
try {
writer.write(getApplication().getName());
} catch (Exception besafe) {
// 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) {