Issue Details (XML | Word | Printable)

Key: WW-1808
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Jasper Rosenberg
Votes: 2
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Struts 2

Support Freemarker template_exception_handler=rethrow

Created: 13/Mar/07 02:49 PM   Updated: 17/Jul/09 07:02 PM
Return to search
Component/s: Plugin - Tags
Affects Version/s: 2.0.6
Fix Version/s: 2.1.0

Issue Links:
Reference
 

Flags: Patch


 Description  « Hide
If you set in freemarker.properties, the property:
template_exception_handler=rethrow

Then you do not want the FreemarkerResult to output to the Writer unless you know the template processed cleanly (so you can handle the exception and go to a nice error page rather than being stuck with half rendered template output).

My suggestion is to add a new parameter to FreemarkerResult, something like "writeCompleted" which defaults to false and, if true, renders the template into a String buffer, writing the result to the actual Writer only if it succeeded.

Something like:

// Process the template
Writer writer = getWriter();
if (getWriteCompleted()) {
    CharArrayWriter charArrayWriter = new CharArrayWriter();
    template.process(model, charArrayWriter);
    charArrayWriter.flush();
    charArrayWriter.writeTo(writer);
} else {
    template.process(model, writer);
}

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Ted Husted made changes - 19/Mar/07 09:29 PM
Field Original Value New Value
Flags [Patch]
Fix Version/s 2.1.0 [ 21794 ]
Musachy Barroso made changes - 27/Jun/07 03:30 AM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Jeff Turner made changes - 09/Aug/07 07:23 AM
Workflow Struts [ 41113 ] Struts - editable closed status [ 44329 ]
Antonio Petrelli made changes - 08/Jan/09 08:58 AM
Workflow Struts - editable closed status [ 44329 ] Struts - editable closed status (temporary) [ 48649 ]
Antonio Petrelli made changes - 08/Jan/09 09:06 AM
Workflow Struts - editable closed status (temporary) [ 48649 ] Struts - editable closed status [ 51806 ]
Jasper Rosenberg made changes - 17/Jul/09 07:02 PM
Link This issue relates to WW-3195 [ WW-3195 ]