You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2015/11/23 01:37:44 UTC

incubator-freemarker git commit: (Minor ResponseCharacterEncoding documentation adjustments.)

Repository: incubator-freemarker
Updated Branches:
  refs/heads/2.3-gae 43fd9737a -> 52a618eb5


(Minor ResponseCharacterEncoding documentation adjustments.)


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

Branch: refs/heads/2.3-gae
Commit: 52a618eb5e0ee95f524dd8d68e97a08a1037e1f2
Parents: 43fd973
Author: ddekany <dd...@apache.org>
Authored: Mon Nov 23 01:37:15 2015 +0100
Committer: ddekany <dd...@apache.org>
Committed: Mon Nov 23 01:37:15 2015 +0100

----------------------------------------------------------------------
 .../freemarker/ext/servlet/FreemarkerServlet.java   | 10 ++++++----
 src/manual/book.xml                                 | 16 +++++++++-------
 2 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/52a618eb/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 ae48af6..d745010 100644
--- a/src/main/java/freemarker/ext/servlet/FreemarkerServlet.java
+++ b/src/main/java/freemarker/ext/servlet/FreemarkerServlet.java
@@ -161,8 +161,8 @@ import freemarker.template.utility.StringUtil;
  * the {@value #INIT_PARAM_RESPONSE_CHARACTER_ENCODING} init-param is set to {@value #INIT_PARAM_VALUE_LEGACY} (which is
  * the default of it), the content type may include the charset (as in <tt>"text/html; charset=utf-8"</tt>), in which
  * case that specifies the actual charset of the output. If the the {@value #INIT_PARAM_RESPONSE_CHARACTER_ENCODING}
- * init-param is not set to {@value #INIT_PARAM_VALUE_LEGACY}, then specifying the charset in the content type is not
- * allowed, and will cause servlet initialization error.
+ * init-param is not set to {@value #INIT_PARAM_VALUE_LEGACY}, then specifying the charset in the
+ * {@value #INIT_PARAM_CONTENT_TYPE} init-param is not allowed, and will cause servlet initialization error.
  * </li>
  *
  * <li><strong>{@value #INIT_PARAM_OVERRIDE_RESPONSE_CONTENT_TYPE}</strong> (since 2.3.24): Specifies when we should
@@ -195,7 +195,7 @@ import freemarker.template.utility.StringUtil;
  * or writes it (though very few applications utilize that setting anyway). Also, it sets the charset of the servlet
  * response by adding it to the response content type via calling {@link HttpServletResponse#setContentType(String)} (as
  * that was the only way before Servlet 2.4), not via the more modern
- * {@link HttpServletResponse#setCharacterEncoding(String)} method. Note that the charset of a template almost always
+ * {@link HttpServletResponse#setCharacterEncoding(String)} method. Note that the charset of a template usually
  * comes from {@link Configuration#getDefaultEncoding()} (i.e., from the {@code default_encoding} FreeMarker setting),
  * occasionally from {@link Configuration#getEncoding(Locale)} (when FreeMarker was configured to use different charsets
  * depending on the locale) or even more rarely from {@link Configuration#getTemplateConfigurers()} (when FreeMarker was
@@ -205,7 +205,9 @@ import freemarker.template.utility.StringUtil;
  * template usually just inherits that from the {@link Configuration}), and if that's not set, then reads the source
  * charset of the template, just like {@value #INIT_PARAM_VALUE_LEGACY}. Then it passes the charset acquired this way to
  * {@link HttpServletResponse#setCharacterEncoding(String)} and {@link Environment#setOutputEncoding(String)}. (It
- * doesn't call the legacy {@link HttpServletResponse#setContentType(String)} API to set the charset.)
+ * doesn't call the legacy {@link HttpServletResponse#setContentType(String)} API to set the charset.) (Note that if
+ * the template has a {@code content_type} template attribute (which is deprecated) that specifies a charset, it will be
+ * considered as the output charset of that template.)
  * <li>{@value #INIT_PARAM_VALUE_DO_NOT_SET}: {@link FreemarkerServlet} will not set the {@link HttpServletResponse}
  * "character encoding". It will still call {@link Environment#setOutputEncoding(String)}, so that the running template
  * will be aware of the charset used for the output.

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/52a618eb/src/manual/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/book.xml b/src/manual/book.xml
index bf04cd9..c6f8033 100644
--- a/src/manual/book.xml
+++ b/src/manual/book.xml
@@ -26069,13 +26069,15 @@ TemplateModel x = env.getVariable("x");  // get variable x</programlisting>
 
                 <listitem>
                   <para><literal>ResponseCharacterEncoding</literal>:
-                  Deprecates the old (and quirky) way of specifying the output
-                  charset, which was specifying it in the
-                  <literal>ContentType</literal>, or falling back to using the
-                  template file charset. The possible value are
-                  <literal>legacy</literal> (the default for backward
-                  compatibility), <literal>fromTemplate</literal> (which is
-                  <literal>legacy</literal> without quirks),
+                  Deprecates the old (and quirky) logic of specifying the
+                  output charset, which was putting it into the
+                  <literal>ContentType</literal> init-param after the MIME
+                  type, otherwise falling back to using the template file
+                  charset. The possible values are <literal>legacy</literal>
+                  (the default for backward compatibility),
+                  <literal>fromTemplate</literal> (which is
+                  <literal>legacy</literal> without quirks, and is aware of
+                  the <literal>outputEncoding</literal> setting),
                   <literal>doNotSet</literal> (keeps what the caller has
                   already set in the <literal>ServletRespone</literal>) and
                   <literal>force