serge <serge <at> mydsl.com> writes:
> When I use StringRepresentation everything works as expected. When I switch to
> TemplateRepresentation the page is rendered, but the browser keeps loading and
> loading. I also noticed that content-length is not set in the header (whereas
> if I use StringRepresentation it's set as well as charset=ISO-8859-1 in
> content
> type):
If in TemplateRepresentation on line 113 the Writer is close()'d, it behaves as
expected.
/**
* Writes the datum as a stream of bytes.
*
* @param outputStream
* The stream to use when writing.
*/
public void write(OutputStream outputStream) throws IOException {
Writer tmplWriter = null;
try {
Template template = config.getTemplate(templateName);
if (getCharacterSet() != null) {
tmplWriter = new BufferedWriter(new OutputStreamWriter(
outputStream, getCharacterSet().getName()));
} else {
tmplWriter = new BufferedWriter(new OutputStreamWriter(
outputStream, template.getEncoding()));
}
template.process(getDataModel(), tmplWriter);
tmplWriter.flush(); ////////// <================== close()=========
} catch (TemplateException te) {
throw new IOException("Template processing error "
+ te.getMessage());
}
}