You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Anonymous (JIRA)" <ji...@apache.org> on 2007/12/17 08:07:34 UTC
[jira] Updated: (WW-218) Make ServletDispatcher return a HTTP 500
Internal Server Error instead of printing the stack trace
[ https://issues.apache.org/struts/browse/WW-218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Resolution: Implemented (was: Fixed)
Status: Resolved (was: Closed)
> Make ServletDispatcher return a HTTP 500 Internal Server Error instead of printing the stack trace
> --------------------------------------------------------------------------------------------------
>
> Key: WW-218
> URL: https://issues.apache.org/struts/browse/WW-218
> Project: Struts 2
> Issue Type: Improvement
> Components: Dispatch Filter
> Affects Versions: WW 2.0-beta1
> Reporter: Cameron Braid
> Assignee: Patrick Lightbody
> Fix For: WW 2.0-beta1
>
> Attachments: ServletDispatcher-http500error.patch
>
>
> I suggest that the ServletDispatcher is modified using the attached patch to change the default exception handeling to be more inline with the servlet spec.
> I would like to be able to provide my own error page, and currently there is no easy way to do this. (if any way at all?)
> I suggest that the servlet dispatched :
> a) places the exception in the request to make it availible to the error page
> b) sends a http 500 error
> Once this patch has been accepted the user can do the following:
> a) add an exception handler JSP (or any other servlet) in webl.xml
> <error-page>
> <error-code>500</error-code>
> <location>/WEB-INF/views/error/error.jsp</location>
> </error-page>
> b) create the error handler /WEB-INF/views/error/error.jsp
> <%@ page isErrorPage="true" %>
> <%@ page import="java.io.*" %>
> <h4 onclick="error.style.display='block';">Error</h4>
> <p>
> there was an unexpected error processing your request
> </p>
> <div id='error' style="display:none">
> <pre>
> <%
> if (exception != null)
> {
> StringWriter sw = new StringWriter();
> PrintWriter pw = new PrintWriter(sw);
> exception.printStackTrace(pw);
> out.print(sw);
> sw.close();
> pw.close();
> }
> %>
> </pre>
> </div>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.