
| Key: |
WW-1808
|
| Type: |
Improvement
|
| Status: |
Resolved
|
| Resolution: |
Fixed
|
| Priority: |
Minor
|
| Assignee: |
Unassigned
|
| Reporter: |
Jasper Rosenberg
|
| Votes: |
2
|
| Watchers: |
2
|
|
If you were logged in you would be able to see more operations.
|
|
|
|
Issue Links:
|
Reference
|
|
This issue relates to:
|
|
WW-3195
When FreemarkerResult isn't writing directly to Response, s.action tag is broken
|
|
|
|
|
|
|
|
|
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);
}
|
|
Description
|
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);
} |
Show » |
|