freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [12/25] incubator-freemarker git commit: Made the default of the "OverrideResponseContentType" FreemarkerServlet init-param overrideable via subclassing.
Date Sun, 29 Nov 2015 12:13:18 GMT
Made the default of the "OverrideResponseContentType" FreemarkerServlet init-param overrideable
via subclassing.


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

Branch: refs/heads/master
Commit: 4ba67367821a553693287ac39d4d6527f295f3de
Parents: 064d12e
Author: ddekany <ddekany@apache.org>
Authored: Sun Oct 25 16:48:19 2015 +0100
Committer: ddekany <ddekany@apache.org>
Committed: Sun Oct 25 16:48:19 2015 +0100

----------------------------------------------------------------------
 .../freemarker/ext/servlet/FreemarkerServlet.java    | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4ba67367/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 c344bb4..f7731ee 100644
--- a/src/main/java/freemarker/ext/servlet/FreemarkerServlet.java
+++ b/src/main/java/freemarker/ext/servlet/FreemarkerServlet.java
@@ -400,7 +400,6 @@ public class FreemarkerServlet extends HttpServlet {
      * @since 2.3.22
      */
     public static final String META_INF_TLD_LOCATION_CLEAR = "clear";
-    
 
     public static final String KEY_REQUEST = "Request";
     public static final String KEY_INCLUDE = "include_page";
@@ -459,7 +458,8 @@ public class FreemarkerServlet extends HttpServlet {
     @SuppressFBWarnings(value="SE_BAD_FIELD", justification="Not investing into making this
Servlet serializable")
     private ObjectWrapper wrapper;
     private String contentType;
-    private OverrideResponseContentType overrideResponseContentType = OverrideResponseContentType.ALWAYS;
+    private OverrideResponseContentType overrideResponseContentType = initParamValueToEnum(
+            getDefaultOverrideResponseContentType(), OverrideResponseContentType.values());
     private ResponseCharacterEncoding responseCharacterEncoding = ResponseCharacterEncoding.LEGACY;
     private boolean contentTypeContainsCharset;
     private List/*<MetaInfTldSource>*/ metaInfTldSources;
@@ -1364,6 +1364,17 @@ public class FreemarkerServlet extends HttpServlet {
     }
 
     /**
+     * Returns the default value of the {@value #INIT_PARAM_OVERRIDE_RESPONSE_CONTENT_TYPE}
Servlet init-param.
+     * The method inherited from {@link FreemarkerServlet} returns {@value #INIT_PARAM_VALUE_ALWAYS};
subclasses my
+     * override this.
+     * 
+     * @since 2.3.24
+     */
+    protected String getDefaultOverrideResponseContentType() {
+        return INIT_PARAM_VALUE_ALWAYS;
+    }
+
+    /**
      * If the parameter "nocache" was set to true, generate a set of headers
      * that will advise the HTTP client not to cache the returned page.
      */


Mime
View raw message