protected void outputDefaultErrorPage(Context context, Throwable exception) { if (this.revealStackTrace) { context.print("<html>"); context.print("<head><title>Internal error</title>"); context.print("<style>"); context.print("body { background-color: white; color: black; }"); context.print("p { font-family: Arial, Helvetica, Sans-serif; font-size: 12px; }"); context.print( "h2 { font-family: Arial, Helvetica, Sans-serif; font-size: 14px; font-weight: bold; }"); context.print("pre { font-size: 9px; }"); context.print("</style>"); context.print("</head>"); context.print("<body>"); context.print("<!-- BasicExceptionHandler -->"); context.print("<h2>Internal error</h2>"); context.print("<p>An exception was caught by the application infrastructure:</p>"); context.print("<p><pre>"); context.print(convertStackTraceToString(exception)); context.print(""); context.print("</pre></p>"); if ((exception instanceof ServletException)) { ServletException servletException = (ServletException) exception; if (servletException.getRootCause() != null) { context.print("<p>Root cause:</p>"); context.print("<p><pre>"); context.print(convertStackTraceToString(servletException.getRootCause())); context.print(""); context.print("</pre></p>"); } else { context.print("<p>No root cause provided.</p>"); } } context.print("</body>"); context.print("</html>"); } else { context.print("<html><head>"); context.print("<title>Server Error</title>"); context.print("<style>"); context.print("body { background-color: white; color: black; }"); context.print( "p, div { color: white; font-family: Tahoma, Verdana, Arial, Helvetica, Sans-serif; font-size: 14px; }"); context.print(".container { border: 8px solid #777777; width: 350px; }"); context.print( ".banner { background: #D06060; color: white; font-weight: bold; padding: 4px }"); context.print(".text { background: #777777; padding: 4px; }"); context.print("</style>"); context.print("</head><body>"); context.print("<!-- BasicExceptionHandler -->"); context.print("<div class=\"container\">"); context.print("<div class=\"banner\">Please bear with us...</div>"); context.print( "<div class=\"text\">We're sorry, our web site is not able to process your request correctly at this time. Please try again at a later time. If this situation persists, please get in touch with our customer service or technical support staff.</div>"); context.print("</div>"); context.print("<!--"); context.print(convertStackTraceToString(exception)); if ((exception instanceof ServletException)) { ServletException servletException = (ServletException) exception; context.print("Root cause:"); context.print(convertStackTraceToString(servletException.getRootCause())); } context.print("-->"); context.print("</body></html>"); } }