freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [06/25] incubator-freemarker git commit: Continued FREEMARKER-1 "Option to not to overwrite response ContentType in FreemarkerServlet": Improved JavaDocs. Added version history entry.
Date Sun, 29 Nov 2015 12:13:12 GMT
Continued FREEMARKER-1 "Option to not to overwrite response ContentType in FreemarkerServlet":
Improved JavaDocs. Added version history entry.


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/3bf80f67
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/3bf80f67
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/3bf80f67

Branch: refs/heads/master
Commit: 3bf80f67fda9fd87539681b90c61701d154362a2
Parents: 9e7f359
Author: ddekany <ddekany@apache.org>
Authored: Sat Oct 17 20:05:05 2015 +0200
Committer: ddekany <ddekany@apache.org>
Committed: Sat Oct 17 20:05:05 2015 +0200

----------------------------------------------------------------------
 .../ext/servlet/FreemarkerServlet.java          | 22 ++++++++++----------
 src/manual/book.xml                             | 14 +++++++++++++
 2 files changed, 25 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3bf80f67/src/main/java/freemarker/ext/servlet/FreemarkerServlet.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/ext/servlet/FreemarkerServlet.java b/src/main/java/freemarker/ext/servlet/FreemarkerServlet.java
index 841c8b1..291df35 100644
--- a/src/main/java/freemarker/ext/servlet/FreemarkerServlet.java
+++ b/src/main/java/freemarker/ext/servlet/FreemarkerServlet.java
@@ -135,19 +135,19 @@ import freemarker.template.utility.StringUtil;
  * HTTP client not to cache the returned page. The default is <tt>false</tt>.</li>
  * 
  * <li><strong>{@value #INIT_PARAM_CONTENT_TYPE}</strong>: The Content-type
HTTP header value used in the HTTP responses
- * (unless <strong>{@value #INIT_PARAM_OVERRIDE_RESPONSE_CONTENT_TYPE}</strong>
is set to {@code false} and the response
- * Content-type is already set by the time {@link FreemarkerServlet} is invoked). Defaults
to <tt>"text/html"</tt>. The
- * value may include the charset (e.g. <tt>"text/html; charset=ISO-8859-1"</tt>).
If the charset is not specified in
- * this init-param, then the charset (encoding) of the actual template file will be used
(both in the response HTTP
- * header and for encoding the output stream). Note that this setting can be overridden on
a per-template basis by
- * specifying a custom attribute named <tt>content_type</tt> in the <tt>attributes</tt>
parameter of the
+ * (unless {@value #INIT_PARAM_OVERRIDE_RESPONSE_CONTENT_TYPE} is set to {@code false} and
the response
+ * {@code contentType} is already set by the time {@link FreemarkerServlet} is invoked).
Defaults to
+ * <tt>"text/html"</tt>. The value may include the charset (e.g. <tt>"text/html;
charset=utf-8"</tt>). If the charset is
+ * not specified in this init-param, then the charset (encoding) of the actual template file
will be used (both in the
+ * response HTTP header and for encoding the output stream). Note that this setting can be
overridden on a per-template
+ * basis by specifying a custom attribute named <tt>content_type</tt> in the
<tt>attributes</tt> parameter of the
  * <tt>&lt;#ftl&gt;</tt> directive.</li>
  *
- * <li><strong>{@value #INIT_PARAM_OVERRIDE_RESPONSE_CONTENT_TYPE}</strong>
(since 2.3.24): If set to {@code true}
- * (which is the default), the Content-type HTTP header of the response is always set to
the value of the
- * <strong>{@value #INIT_PARAM_CONTENT_TYPE}</strong> setting. If set to {@code
false}, {@link FreemarkerServlet} will
- * only set the Content-type HTTP response header if it isn't already set when {@link FreemarkerServlet}
is invoked.
- * Thus, {@code false} allows you to specify the Content-type before forwarding to {@link
FreemarkerServlet}.</li>
+ * <li><strong>{@value #INIT_PARAM_OVERRIDE_RESPONSE_CONTENT_TYPE}</strong>
(since 2.3.24): Specifies if we should
+ * always set the {@code contentType} in the {@link HttpServletResponse} to the value of
the
+ * {@value #INIT_PARAM_CONTENT_TYPE} init-param (or to its default, {@code text/html}), or
only if it wasn't already set
+ * (i.e., {@link HttpServletResponse#getContentType()} returns {@code null}). The default
is {@code true}. Setting this
+ * to {@code false} allows you to specify the content type before forwarding to {@link FreemarkerServlet}.</li>
  *
  * <li><strong>{@value #INIT_PARAM_BUFFER_SIZE}</strong>: Sets the size
of the output buffer in bytes, or if "KB" or
  * "MB" is written after the number (like {@code <param-value>256 KB</param-value>})
then in kilobytes or megabytes.

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3bf80f67/src/manual/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/book.xml b/src/manual/book.xml
index da26c70..58bfc7a 100644
--- a/src/manual/book.xml
+++ b/src/manual/book.xml
@@ -26038,6 +26038,20 @@ TemplateModel x = env.getVariable("x");  // get variable x</programlisting>
             </listitem>
 
             <listitem>
+              <para>New <literal>FreemarkerServlet</literal> init-param:
+              <literal>OverrideResponseContentType</literal>. This specifies
+              if we should always set the <literal>contentType</literal> in
+              the <literal>HttpServletResponse</literal> (to the value of the
+              to the value of the <literal>ContentType</literal> init-param),
+              or only if it wasn't already set. The default is
+              <literal>true</literal>, which gives the backward compatible
+              behavior. Now that this init-param exists, you can disable this
+              behavior, so the <literal>contentType</literal> you have
+              specified before forwarding to
+              <literal>FreemarkerServlet</literal> wins.</para>
+            </listitem>
+
+            <listitem>
               <para>Added
               <literal>freemarker.cache.ByteArrayTemplateLoader</literal>,
               which is similar to <literal>StringTemplateLoader</literal>, but


Mime
View raw message