ErrorRendererpublic class ErrorRenderer extends Renderer Shows an error page. Since errors are frequently caused by improperly
configured JAR files, XML And XSLT are not used by this class.
If XML and XSLT were used, then the same CLASSPATH issue that caused
the original exception to occur would probably cause this page
to fail as well. |
Fields Summary |
---|
private String | message | private Throwable | throwable |
Constructors Summary |
---|
public ErrorRenderer(Throwable throwable)
this(throwable, throwable.getMessage());
| public ErrorRenderer(String message)
this(null, message);
| public ErrorRenderer(Throwable throwable, String message)
this.throwable = throwable;
this.message = message;
|
Methods Summary |
---|
public void | render(javax.servlet.http.HttpServlet servlet, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
// just show a simple error page for now.
pw.println("<html>");
pw.println("<body>");
pw.println("<p>");
pw.println(this.message);
pw.println("</p>");
if (this.throwable != null) {
pw.println("<pre>");
this.throwable.printStackTrace(pw);
pw.println("</pre>");
}
pw.println("</body></html>");
|
|