[
https://issues.apache.org/jira/browse/FREEMARKER-59?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16050413#comment-16050413
]
Daniel Dekany commented on FREEMARKER-59:
-----------------------------------------
{{getOutputStream()}} is for writing binary responses, so I don't understand
why WebLogic does that. Is it possible that it thinks that the included
resource is binary? At very least we should throw an exception when
{{getOutputStream()}} is called, because in fact it can't be correctly
implement over a {{Writer}}. It's impossible to translate an arbitrary binary
to characters, unless something guarantees that the the binary actually only
contains characters encoding with a known charset. {{ServletOutputStream()}}
(note that it's not just {{OutputStream}} either) doesn't tell anything about
the charset, at least not in the JavaDoc-s. (It's funny BTW because then the
result of {{out.print("blah")}} is undefined. Jetty for example throws
exception if there's a non-US-ASCII character in the input. Clearly this part
of the Servlet API was designed hastily. Anyway, we aren't affected by
{{out.print(String)}}, just saying...)
> include_page directive does not work in weblogic
> ------------------------------------------------
>
> Key: FREEMARKER-59
> URL: https://issues.apache.org/jira/browse/FREEMARKER-59
> Project: Apache Freemarker
> Issue Type: Improvement
> Components: engine, jsp
> Affects Versions: 2.3.24-incubating, 2.3.25-incubating, 2.3.26-incubating
> Environment: java 8 / weblogic 12.2.1.2
> Reporter: Dawid van der Merwe
> Labels: newbie
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> The include_page directive implemented in freemarker.ext.servlet.IncludePage
> does not handle jsp includes correctly in weblogic 12c (only version tested).
> This seems to be because the HttpServletResponseWrapper (wrappedResponse)
> created on IncludePage.java (line 105) only overrides getWriter() and not
> getOutputStream(). Weblogic jsp's seem to write to the response's servlet
> output stream and not its writer.
> The effect is that the output of the jsp is written directly to the
> response's output and not to the freemarker environment's output.
> I corrected the behaviour by also overriding getOutputStream() and using
> commons-io's WriterOutputStream to convert the stream's bytes.
> I can provide my (hasty) patch if required.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)