« Return to Thread: [jira] Created: (VELTOOLS-115) Improve exception and HTTP error management

[jira] Commented: (VELTOOLS-115) Improve exception and HTTP error management

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View in Thread


    [ https://issues.apache.org/jira/browse/VELTOOLS-115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677671#action_12677671 ]

Antonio Petrelli commented on VELTOOLS-115:
-------------------------------------------

1. You are right that we cannot send an HTTP 500 when the response is committed. The response is committed when you flush the PrintWriter of the response (or the PrintWriter is auto-flushed):
http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletResponse.html#getWriter()
And since the VelocityWriter is used to wrap the response's writer (or better, the writer that is configured through the "bufferOutput" parameter, that could be a StringWriter or the response's writer), that buffer the output itself, then there may be various cases in which the response may be uncommitted.

2. By "including a page error" I mean something like how PageContextImpl of Tomcat does it:
http://svn.eu.apache.org/repos/asf/tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java
See the "doHandlePageException": it tries to forward to the error page, if it fails it includes the error page.

3. I have a suspect though: if the exception is left "popping up" at servlet level, without catching, what happens? Does it handle the exceptions like I depicted here?

> Improve exception and HTTP error management
> -------------------------------------------
>
>                 Key: VELTOOLS-115
>                 URL: https://issues.apache.org/jira/browse/VELTOOLS-115
>             Project: Velocity Tools
>          Issue Type: Improvement
>          Components: VelocityView
>    Affects Versions: 2.0
>         Environment: Servlet container
>            Reporter: Antonio Petrelli
>
> Currently the exception management and missing resources are not satisfactory.
> In particular:
> 1. if an exception happen during rendering a template, an exception stack trace is put inside the result, with an HTTP 200 code;
> 2. if a resource is missing, but it is intercepted by the VelocityViewServlet, it renders with a page with HTTP 200.
> It should be:
> 1. HTTP 500 with error page. If it is not possible (if the response is committed), the error page should be included.
> 2. HTTP 404 with error page.
> In both cases the configuration of the webapp should be considered.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...

 « Return to Thread: [jira] Created: (VELTOOLS-115) Improve exception and HTTP error management