[jira] [Commented] (FREEMARKER-1) Option to not to overwrite response ContentType in FreemarkerServlet

2015-10-17 Thread Woonsan Ko (JIRA)

[ 
https://issues.apache.org/jira/browse/FREEMARKER-1?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14962138#comment-14962138
 ] 

Woonsan Ko commented on FREEMARKER-1:
-

Both totally make sense to me! Thanks a lot for caring about the cases I didn't 
think about!

Cheers,

Woonsan

> Option to not to overwrite response ContentType in FreemarkerServlet
> 
>
> Key: FREEMARKER-1
> URL: https://issues.apache.org/jira/browse/FREEMARKER-1
> Project: Apache Freemarker
>  Issue Type: Improvement
>Reporter: Woonsan Ko
>Assignee: Daniel Dekany
>Priority: Minor
>
> FreemarkerServlet doesn't have to set response ContentType by default. 
> Especially when a controller in an MVC framework sets the response 
> ContentType, it's better to not set the response ContentType again by the 
> default ContentType setting in FreemarkerServlet according to servlet 
> specification (SRV.5.2 and SRV.14.2.22.1):
> {quote}
> Servlet programmers are responsible for ensuring that the Content-Type header 
> is appropriately set in the response object for the content the servlet is 
> generating. The HTTP 1.1 specification does not require that this header be 
> set in an HTTP response. Servlet containers must not set a default content 
> type when the servlet programmer does not set the type.
> {quote}
> {quote}
> ServletResponse#getContentType() should "Returns the content type used for 
> the MIME body sent in this response. The content type proper must have been 
> specified using setContentType(String) before the response is committed. If 
> no content type has been specified, this method returns null. If a content 
> type has been specified and a character encoding has been explicitly or 
> implicitly specified as described in getCharacterEncoding() , the charset 
> parameter is included in the string returned. If no character encoding has 
> been specified, the charset parameter is omitted.
> Returns: a String specifying the content type, for example, text/html; 
> charset=UTF-8, or null
> Since: 2.4
> {quote}
> So, optionally, if #getContentType() returns null, then FreemarkerServlet can 
> detect that the Content-Type was never set before.
> Actually, frameworks or containers don't have to set Content-Type if 
> programmers don't. However, I think setting Content-Type header in the 
> framework level (freemarker servlet in this case) to a reasonable default 
> value seems fine.
> Daniels's remarks/suggestions on this in the old ML:
> {quote}
> The contentType matter... thanks for looking after these! So then, 
> FreemarkerServlet surely should set the HttpServletResponse contentType when 
> it's still null. OTOH there should be an option to only set it then (if it's 
> not null), not always as it happens now. So then the "ContetType" init-param 
> remains as is, and we add a new init-param, "OverrideResponseContentType" 
> (better name?), whose default is true for backward compatibility, but this 
> default can be changed to false by extending FreemarkerServlet. WDYT?
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


incubator-freemarker git commit: Continued FREEMARKER-1 "Option to not to overwrite response ContentType in FreemarkerServlet": Improved JavaDocs. Added version history entry.

2015-10-17 Thread ddekany
Repository: incubator-freemarker
Updated Branches:
  refs/heads/2.3-gae 9e7f359a1 -> 3bf80f67f


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/2.3-gae
Commit: 3bf80f67fda9fd87539681b90c61701d154362a2
Parents: 9e7f359
Author: ddekany 
Authored: Sat Oct 17 20:05:05 2015 +0200
Committer: ddekany 
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 
false.
  * 
  * {@value #INIT_PARAM_CONTENT_TYPE}: The Content-type 
HTTP header value used in the HTTP responses
- * (unless {@value 
#INIT_PARAM_OVERRIDE_RESPONSE_CONTENT_TYPE} is set to {@code false} 
and the response
- * Content-type is already set by the time {@link FreemarkerServlet} is 
invoked). Defaults to "text/html". The
- * value may include the charset (e.g. "text/html; 
charset=ISO-8859-1"). 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 content_type in the 
attributes 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
+ * "text/html". The value may include the charset (e.g. 
"text/html; charset=utf-8"). 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 content_type in the 
attributes parameter of the
  * <#ftl> directive.
  *
- * {@value #INIT_PARAM_OVERRIDE_RESPONSE_CONTENT_TYPE} 
(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
- * {@value #INIT_PARAM_CONTENT_TYPE} 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}.
+ * {@value #INIT_PARAM_OVERRIDE_RESPONSE_CONTENT_TYPE} 
(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}.
  *
  * {@value #INIT_PARAM_BUFFER_SIZE}: Sets the size of the 
output buffer in bytes, or if "KB" or
  * "MB" is written after the number (like {@code 256 
KB}) 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
 
 
 
+  New FreemarkerServlet init-param:
+  OverrideResponseContentType. This spec

[jira] [Comment Edited] (FREEMARKER-1) Option to not to overwrite response ContentType in FreemarkerServlet

2015-10-17 Thread Daniel Dekany (JIRA)

[ 
https://issues.apache.org/jira/browse/FREEMARKER-1?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14962007#comment-14962007
 ] 

Daniel Dekany edited comment on FREEMARKER-1 at 10/17/15 5:44 PM:
--

Another change I did: {{<#ftl attributes=\{ 'content_type': 'text/plain' \}>}} 
wins even if content type overriding is disabled. Because, if someone cares to 
specify the content type right in the template, he certainly does it because 
that particular template really has a content of that content type.


was (Author: ddekany):
Another change I did: <#ftl attributes={ 'content_type': 'text/plain' }> wins 
even if content type overriding is disabled. Because, if someone cares to 
specify the content type right in the template, he certainly does it because 
that particular template really has a content of that content type.

> Option to not to overwrite response ContentType in FreemarkerServlet
> 
>
> Key: FREEMARKER-1
> URL: https://issues.apache.org/jira/browse/FREEMARKER-1
> Project: Apache Freemarker
>  Issue Type: Improvement
>Reporter: Woonsan Ko
>Assignee: Daniel Dekany
>Priority: Minor
>
> FreemarkerServlet doesn't have to set response ContentType by default. 
> Especially when a controller in an MVC framework sets the response 
> ContentType, it's better to not set the response ContentType again by the 
> default ContentType setting in FreemarkerServlet according to servlet 
> specification (SRV.5.2 and SRV.14.2.22.1):
> {quote}
> Servlet programmers are responsible for ensuring that the Content-Type header 
> is appropriately set in the response object for the content the servlet is 
> generating. The HTTP 1.1 specification does not require that this header be 
> set in an HTTP response. Servlet containers must not set a default content 
> type when the servlet programmer does not set the type.
> {quote}
> {quote}
> ServletResponse#getContentType() should "Returns the content type used for 
> the MIME body sent in this response. The content type proper must have been 
> specified using setContentType(String) before the response is committed. If 
> no content type has been specified, this method returns null. If a content 
> type has been specified and a character encoding has been explicitly or 
> implicitly specified as described in getCharacterEncoding() , the charset 
> parameter is included in the string returned. If no character encoding has 
> been specified, the charset parameter is omitted.
> Returns: a String specifying the content type, for example, text/html; 
> charset=UTF-8, or null
> Since: 2.4
> {quote}
> So, optionally, if #getContentType() returns null, then FreemarkerServlet can 
> detect that the Content-Type was never set before.
> Actually, frameworks or containers don't have to set Content-Type if 
> programmers don't. However, I think setting Content-Type header in the 
> framework level (freemarker servlet in this case) to a reasonable default 
> value seems fine.
> Daniels's remarks/suggestions on this in the old ML:
> {quote}
> The contentType matter... thanks for looking after these! So then, 
> FreemarkerServlet surely should set the HttpServletResponse contentType when 
> it's still null. OTOH there should be an option to only set it then (if it's 
> not null), not always as it happens now. So then the "ContetType" init-param 
> remains as is, and we add a new init-param, "OverrideResponseContentType" 
> (better name?), whose default is true for backward compatibility, but this 
> default can be changed to false by extending FreemarkerServlet. WDYT?
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Comment Edited] (FREEMARKER-1) Option to not to overwrite response ContentType in FreemarkerServlet

2015-10-17 Thread Daniel Dekany (JIRA)

[ 
https://issues.apache.org/jira/browse/FREEMARKER-1?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14962007#comment-14962007
 ] 

Daniel Dekany edited comment on FREEMARKER-1 at 10/17/15 5:44 PM:
--

Another change I did: {{<#ftl attributes=\{ 'content_type': '...' \}>}} wins 
even if content type overriding is disabled. Because, if someone cares to 
specify the content type right in the template, he certainly does it because 
that particular template really has a content of that content type.


was (Author: ddekany):
Another change I did: {{<#ftl attributes=\{ 'content_type': 'text/plain' \}>}} 
wins even if content type overriding is disabled. Because, if someone cares to 
specify the content type right in the template, he certainly does it because 
that particular template really has a content of that content type.

> Option to not to overwrite response ContentType in FreemarkerServlet
> 
>
> Key: FREEMARKER-1
> URL: https://issues.apache.org/jira/browse/FREEMARKER-1
> Project: Apache Freemarker
>  Issue Type: Improvement
>Reporter: Woonsan Ko
>Assignee: Daniel Dekany
>Priority: Minor
>
> FreemarkerServlet doesn't have to set response ContentType by default. 
> Especially when a controller in an MVC framework sets the response 
> ContentType, it's better to not set the response ContentType again by the 
> default ContentType setting in FreemarkerServlet according to servlet 
> specification (SRV.5.2 and SRV.14.2.22.1):
> {quote}
> Servlet programmers are responsible for ensuring that the Content-Type header 
> is appropriately set in the response object for the content the servlet is 
> generating. The HTTP 1.1 specification does not require that this header be 
> set in an HTTP response. Servlet containers must not set a default content 
> type when the servlet programmer does not set the type.
> {quote}
> {quote}
> ServletResponse#getContentType() should "Returns the content type used for 
> the MIME body sent in this response. The content type proper must have been 
> specified using setContentType(String) before the response is committed. If 
> no content type has been specified, this method returns null. If a content 
> type has been specified and a character encoding has been explicitly or 
> implicitly specified as described in getCharacterEncoding() , the charset 
> parameter is included in the string returned. If no character encoding has 
> been specified, the charset parameter is omitted.
> Returns: a String specifying the content type, for example, text/html; 
> charset=UTF-8, or null
> Since: 2.4
> {quote}
> So, optionally, if #getContentType() returns null, then FreemarkerServlet can 
> detect that the Content-Type was never set before.
> Actually, frameworks or containers don't have to set Content-Type if 
> programmers don't. However, I think setting Content-Type header in the 
> framework level (freemarker servlet in this case) to a reasonable default 
> value seems fine.
> Daniels's remarks/suggestions on this in the old ML:
> {quote}
> The contentType matter... thanks for looking after these! So then, 
> FreemarkerServlet surely should set the HttpServletResponse contentType when 
> it's still null. OTOH there should be an option to only set it then (if it's 
> not null), not always as it happens now. So then the "ContetType" init-param 
> remains as is, and we add a new init-param, "OverrideResponseContentType" 
> (better name?), whose default is true for backward compatibility, but this 
> default can be changed to false by extending FreemarkerServlet. WDYT?
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (FREEMARKER-1) Option to not to overwrite response ContentType in FreemarkerServlet

2015-10-17 Thread Daniel Dekany (JIRA)

[ 
https://issues.apache.org/jira/browse/FREEMARKER-1?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14962007#comment-14962007
 ] 

Daniel Dekany commented on FREEMARKER-1:


Another change I did: <#ftl attributes={ 'content_type': 'text/plain' }> wins 
even if content type overriding is disabled. Because, if someone cares to 
specify the content type right in the template, he certainly does it because 
that particular template really has a content of that content type.

> Option to not to overwrite response ContentType in FreemarkerServlet
> 
>
> Key: FREEMARKER-1
> URL: https://issues.apache.org/jira/browse/FREEMARKER-1
> Project: Apache Freemarker
>  Issue Type: Improvement
>Reporter: Woonsan Ko
>Assignee: Daniel Dekany
>Priority: Minor
>
> FreemarkerServlet doesn't have to set response ContentType by default. 
> Especially when a controller in an MVC framework sets the response 
> ContentType, it's better to not set the response ContentType again by the 
> default ContentType setting in FreemarkerServlet according to servlet 
> specification (SRV.5.2 and SRV.14.2.22.1):
> {quote}
> Servlet programmers are responsible for ensuring that the Content-Type header 
> is appropriately set in the response object for the content the servlet is 
> generating. The HTTP 1.1 specification does not require that this header be 
> set in an HTTP response. Servlet containers must not set a default content 
> type when the servlet programmer does not set the type.
> {quote}
> {quote}
> ServletResponse#getContentType() should "Returns the content type used for 
> the MIME body sent in this response. The content type proper must have been 
> specified using setContentType(String) before the response is committed. If 
> no content type has been specified, this method returns null. If a content 
> type has been specified and a character encoding has been explicitly or 
> implicitly specified as described in getCharacterEncoding() , the charset 
> parameter is included in the string returned. If no character encoding has 
> been specified, the charset parameter is omitted.
> Returns: a String specifying the content type, for example, text/html; 
> charset=UTF-8, or null
> Since: 2.4
> {quote}
> So, optionally, if #getContentType() returns null, then FreemarkerServlet can 
> detect that the Content-Type was never set before.
> Actually, frameworks or containers don't have to set Content-Type if 
> programmers don't. However, I think setting Content-Type header in the 
> framework level (freemarker servlet in this case) to a reasonable default 
> value seems fine.
> Daniels's remarks/suggestions on this in the old ML:
> {quote}
> The contentType matter... thanks for looking after these! So then, 
> FreemarkerServlet surely should set the HttpServletResponse contentType when 
> it's still null. OTOH there should be an option to only set it then (if it's 
> not null), not always as it happens now. So then the "ContetType" init-param 
> remains as is, and we add a new init-param, "OverrideResponseContentType" 
> (better name?), whose default is true for backward compatibility, but this 
> default can be changed to false by extending FreemarkerServlet. WDYT?
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


incubator-freemarker git commit: Continued FREEMARKER-1 "Option to not to overwrite response ContentType in FreemarkerServlet": <#ftl attributes={ 'content_type': 'text/plain' }> wins even if content

2015-10-17 Thread ddekany
Repository: incubator-freemarker
Updated Branches:
  refs/heads/2.3-gae 64ec04bf8 -> 9e7f359a1


Continued FREEMARKER-1 "Option to not to overwrite response ContentType in 
FreemarkerServlet": <#ftl attributes={ 'content_type': 'text/plain' }> wins 
even if content type overriding is disabled.


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

Branch: refs/heads/2.3-gae
Commit: 9e7f359a164112c813377a654fcd361405c5edd4
Parents: 64ec04b
Author: ddekany 
Authored: Sat Oct 17 19:41:13 2015 +0200
Committer: ddekany 
Committed: Sat Oct 17 19:41:13 2015 +0200

--
 .../ext/servlet/FreemarkerServlet.java  | 10 +++
 .../ext/servlet/FreemarkerServletTest.java  | 29 
 .../freemarker/ext/servlet/contentTypeAttr.ftl  | 20 ++
 3 files changed, 54 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9e7f359a/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 929bde4..841c8b1 100644
--- a/src/main/java/freemarker/ext/servlet/FreemarkerServlet.java
+++ b/src/main/java/freemarker/ext/servlet/FreemarkerServlet.java
@@ -725,11 +725,11 @@ public class FreemarkerServlet extends HttpServlet {
 "Unexpected error when loading template " + 
StringUtil.jQuoteNoXSS(templatePath) + ".", e);
 }
 
-if (overrideResponseContentType || response.getContentType() == null) {
-Object attrContentType = 
template.getCustomAttribute("content_type");
-if (attrContentType != null) {
-response.setContentType(attrContentType.toString());
-} else {
+Object attrContentType = template.getCustomAttribute("content_type");
+if (attrContentType != null) {
+response.setContentType(attrContentType.toString());
+} else {
+if (overrideResponseContentType || response.getContentType() == 
null) {
 if (noCharsetInContentType) {
 response.setContentType(contentType + "; charset=" + 
template.getEncoding());
 } else {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9e7f359a/src/test/java/freemarker/ext/servlet/FreemarkerServletTest.java
--
diff --git a/src/test/java/freemarker/ext/servlet/FreemarkerServletTest.java 
b/src/test/java/freemarker/ext/servlet/FreemarkerServletTest.java
index 20ac78d..9239ee0 100644
--- a/src/test/java/freemarker/ext/servlet/FreemarkerServletTest.java
+++ b/src/test/java/freemarker/ext/servlet/FreemarkerServletTest.java
@@ -169,6 +169,35 @@ public class FreemarkerServletTest {
 assertEquals(HttpServletResponse.SC_OK, response.getStatus());
 assertTrue(response.getContentType().contains("text/css"));
 }
+
+@Test
+public void 
testContentTypeInitParams_ftlAttrAlwaysWins_DefaultOverriding() throws 
ServletException, IOException {
+MockHttpServletRequest request = 
createMockHttpServletRequest(servletContext, "/contentTypeAttr.ftl");
+MockHttpServletResponse response = new MockHttpServletResponse();
+response.setContentType("application/json");
+assertEquals("application/json", response.getContentType());
+
+createFreemarkerServlet().doGet(request, response);
+LOG.debug("response content: " + response.getContentAsString());
+
+assertEquals(HttpServletResponse.SC_OK, response.getStatus());
+assertEquals("text/plain", response.getContentType());
+}
+
+@Test
+public void testContentTypeInitParams_ftlAttrAlwaysWins_NoOverriding() 
throws ServletException, IOException {
+MockHttpServletRequest request = 
createMockHttpServletRequest(servletContext, "/contentTypeAttr.ftl");
+MockHttpServletResponse response = new MockHttpServletResponse();
+response.setContentType("application/json");
+assertEquals("application/json", response.getContentType());
+
+
createFreemarkerServlet(FreemarkerServlet.INIT_PARAM_OVERRIDE_RESPONSE_CONTENT_TYPE,
 "false")
+.doGet(request, response);
+LOG.debug("response content: " + response.getContentAsString());
+
+assertEquals(HttpServletResponse.SC_OK, response.getStatus());
+assertEquals("text/plain", response.getContentType());
+}
 
 private Freema

incubator-freemarker git commit: Continued FREEMARKER-1 "Option to not to overwrite response ContentType in FreemarkerServlet": More tests

2015-10-17 Thread ddekany
Repository: incubator-freemarker
Updated Branches:
  refs/heads/2.3-gae fe08488da -> 64ec04bf8


Continued FREEMARKER-1 "Option to not to overwrite response ContentType in 
FreemarkerServlet": More tests


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

Branch: refs/heads/2.3-gae
Commit: 64ec04bf8d53a260905a174876bba434d2a13eaf
Parents: fe08488
Author: ddekany 
Authored: Sat Oct 17 19:28:01 2015 +0200
Committer: ddekany 
Committed: Sat Oct 17 19:28:01 2015 +0200

--
 .../ext/servlet/FreemarkerServletTest.java  | 112 ++-
 1 file changed, 83 insertions(+), 29 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/64ec04bf/src/test/java/freemarker/ext/servlet/FreemarkerServletTest.java
--
diff --git a/src/test/java/freemarker/ext/servlet/FreemarkerServletTest.java 
b/src/test/java/freemarker/ext/servlet/FreemarkerServletTest.java
index bf2ef8a..20ac78d 100644
--- a/src/test/java/freemarker/ext/servlet/FreemarkerServletTest.java
+++ b/src/test/java/freemarker/ext/servlet/FreemarkerServletTest.java
@@ -26,13 +26,13 @@ import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletResponse;
 
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.springframework.mock.web.MockHttpServletRequest;
 import org.springframework.mock.web.MockHttpServletResponse;
 import org.springframework.mock.web.MockServletConfig;
 import org.springframework.mock.web.MockServletContext;
+import org.springframework.util.Assert;
 
 import freemarker.log.Logger;
 
@@ -42,49 +42,50 @@ public class FreemarkerServletTest {
 
 private static final String TEST_TEMPLATE_PATH = 
"classpath:freemarker/ext/servlet";
 
-private FreemarkerServlet freemarkerServlet;
-
 private MockServletContext servletContext;
-private MockServletConfig servletConfig;
 
 @Before
 public void setUp() throws ServletException, IOException {
 servletContext = new MockServletContext();
 servletContext.setContextPath("/");
+}
 
-servletConfig = new MockServletConfig(servletContext);
-
servletConfig.addInitParameter(FreemarkerServlet.INIT_PARAM_TEMPLATE_PATH, 
TEST_TEMPLATE_PATH);
+@Test
+public void 
testContentTypeInitParams_withNoResponseContentType_DefaultOverriding() throws 
ServletException, IOException {
+MockHttpServletRequest request = 
createMockHttpServletRequest(servletContext, "/foo.ftl");
+MockHttpServletResponse response = new MockHttpServletResponse();
+assertNull(response.getContentType());
 
-freemarkerServlet = new FreemarkerServlet();
-freemarkerServlet.init(servletConfig);
-}
+createFreemarkerServlet().doGet(request, response);
+LOG.debug("response content: " + response.getContentAsString());
 
-@After
-public void tearDown() {
-freemarkerServlet.destroy();
+assertEquals(HttpServletResponse.SC_OK, response.getStatus());
+
assertTrue(response.getContentType().contains(FreemarkerServlet.DEFAULT_CONTENT_TYPE));
 }
 
 @Test
-public void 
testContentTypeInitParams_withNoResponseContentType_ByDefault() throws 
ServletException, IOException {
+public void 
testContentTypeInitParams_withNoResponseContentType_DefaultOverriding2() throws 
ServletException, IOException {
 MockHttpServletRequest request = 
createMockHttpServletRequest(servletContext, "/foo.ftl");
 MockHttpServletResponse response = new MockHttpServletResponse();
 assertNull(response.getContentType());
 
-freemarkerServlet.doGet(request, response);
+createFreemarkerServlet(
+FreemarkerServlet.INIT_PARAM_CONTENT_TYPE, "text/css")
+.doGet(request, response);
 LOG.debug("response content: " + response.getContentAsString());
 
 assertEquals(HttpServletResponse.SC_OK, response.getStatus());
-
assertTrue(response.getContentType().contains(FreemarkerServlet.DEFAULT_CONTENT_TYPE));
+assertTrue(response.getContentType().contains("text/css"));
 }
 
 @Test
-public void testContentTypeInitParams_withResponseContentType_ByDefault() 
throws ServletException, IOException {
+public void 
testContentTypeInitParams_withResponseContentType_DefaultOverriding() throws 
ServletException, IOException {
 MockHttpServletRequest request = 
createMockHttpServletRequest(servletContext, "/foo.ftl");
 MockHttpServletRespon

[jira] [Commented] (FREEMARKER-1) Option to not to overwrite response ContentType in FreemarkerServlet

2015-10-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/FREEMARKER-1?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14961990#comment-14961990
 ] 

ASF GitHub Bot commented on FREEMARKER-1:
-

Github user asfgit closed the pull request at:

https://github.com/apache/incubator-freemarker/pull/5


> Option to not to overwrite response ContentType in FreemarkerServlet
> 
>
> Key: FREEMARKER-1
> URL: https://issues.apache.org/jira/browse/FREEMARKER-1
> Project: Apache Freemarker
>  Issue Type: Improvement
>Reporter: Woonsan Ko
>Assignee: Daniel Dekany
>Priority: Minor
>
> FreemarkerServlet doesn't have to set response ContentType by default. 
> Especially when a controller in an MVC framework sets the response 
> ContentType, it's better to not set the response ContentType again by the 
> default ContentType setting in FreemarkerServlet according to servlet 
> specification (SRV.5.2 and SRV.14.2.22.1):
> {quote}
> Servlet programmers are responsible for ensuring that the Content-Type header 
> is appropriately set in the response object for the content the servlet is 
> generating. The HTTP 1.1 specification does not require that this header be 
> set in an HTTP response. Servlet containers must not set a default content 
> type when the servlet programmer does not set the type.
> {quote}
> {quote}
> ServletResponse#getContentType() should "Returns the content type used for 
> the MIME body sent in this response. The content type proper must have been 
> specified using setContentType(String) before the response is committed. If 
> no content type has been specified, this method returns null. If a content 
> type has been specified and a character encoding has been explicitly or 
> implicitly specified as described in getCharacterEncoding() , the charset 
> parameter is included in the string returned. If no character encoding has 
> been specified, the charset parameter is omitted.
> Returns: a String specifying the content type, for example, text/html; 
> charset=UTF-8, or null
> Since: 2.4
> {quote}
> So, optionally, if #getContentType() returns null, then FreemarkerServlet can 
> detect that the Content-Type was never set before.
> Actually, frameworks or containers don't have to set Content-Type if 
> programmers don't. However, I think setting Content-Type header in the 
> framework level (freemarker servlet in this case) to a reasonable default 
> value seems fine.
> Daniels's remarks/suggestions on this in the old ML:
> {quote}
> The contentType matter... thanks for looking after these! So then, 
> FreemarkerServlet surely should set the HttpServletResponse contentType when 
> it's still null. OTOH there should be an option to only set it then (if it's 
> not null), not always as it happens now. So then the "ContetType" init-param 
> remains as is, and we add a new init-param, "OverrideResponseContentType" 
> (better name?), whose default is true for backward compatibility, but this 
> default can be changed to false by extending FreemarkerServlet. WDYT?
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] incubator-freemarker pull request: FREEMARKER-1 adding OverrideRes...

2015-10-17 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/incubator-freemarker/pull/5


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[2/3] incubator-freemarker git commit: Merge remote-tracking branch 'FREEMARKER-1-option-overrideResponseContentType' into 2.3-gae

2015-10-17 Thread ddekany
Merge remote-tracking branch 'FREEMARKER-1-option-overrideResponseContentType' 
into 2.3-gae

FREEMARKER-1: Adding OverrideResponseContentType init param in FreemarkerServlet
GitHub pull request #5


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

Branch: refs/heads/2.3-gae
Commit: 3ab293ad12e1aaf2e2bededcd3540884d35f9fae
Parents: 0256df5 e89dbfc
Author: ddekany 
Authored: Sat Oct 17 17:44:28 2015 +0200
Committer: ddekany 
Committed: Sat Oct 17 17:48:10 2015 +0200

--
 .classpath  |   2 +
 ivy.xml |  10 +-
 .../ext/servlet/FreemarkerServlet.java  |  37 --
 .../ext/servlet/FreemarkerServletTest.java  | 124 +++
 .../resources/freemarker/ext/servlet/foo.ftl|  19 +++
 5 files changed, 181 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3ab293ad/.classpath
--

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3ab293ad/ivy.xml
--



[3/3] incubator-freemarker git commit: Continued FREEMARKER-1 "Option to not to overwrite response ContentType in FreemarkerServlet": Always set response Content-type header when it's null.

2015-10-17 Thread ddekany
Continued FREEMARKER-1 "Option to not to overwrite response ContentType in 
FreemarkerServlet": Always set response Content-type header when it's null.


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

Branch: refs/heads/2.3-gae
Commit: fe08488da50e12dfcb8a5c600417a391df218d26
Parents: 3ab293a
Author: ddekany 
Authored: Sat Oct 17 19:07:08 2015 +0200
Committer: ddekany 
Committed: Sat Oct 17 19:07:08 2015 +0200

--
 .../ext/servlet/FreemarkerServlet.java  | 59 ++--
 .../ext/servlet/FreemarkerServletTest.java  | 19 +++
 2 files changed, 49 insertions(+), 29 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/fe08488d/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 776a884..929bde4 100644
--- a/src/main/java/freemarker/ext/servlet/FreemarkerServlet.java
+++ b/src/main/java/freemarker/ext/servlet/FreemarkerServlet.java
@@ -88,9 +88,9 @@ import freemarker.template.utility.StringUtil;
  * <#assign tiles=JspTaglibs["/WEB-INF/struts-tiles.tld"]>.
  * 
  * A custom directive named {@code include_page} allows you to include the 
output of another servlet resource from
- * your servlet container, just as if you used {@code 
ServletRequest.getRequestDispatcher(path).include()}:
- * {@code <@include_page path="/myWebapp/somePage.jsp"/>}. You can also pass 
parameters to the newly included page by
- * passing a hash named {@code params}:
+ * your servlet container, just as if you used {@code 
ServletRequest.getRequestDispatcher(path).include()}: {@code 
+ * <@include_page path="/myWebapp/somePage.jsp"/>}. You can also pass 
parameters to the newly included page by passing a
+ * hash named {@code params}:
  * <@include_page path="/myWebapp/somePage.jsp" params= lang: "en", 
q="5"}/>. By default, the request
  * parameters of the original request (the one being processed by 
FreemarkerServlet) are also inherited by the include.
  * You can explicitly control this inheritance using the {@code 
inherit_params} parameter:
@@ -116,15 +116,15 @@ import freemarker.template.utility.StringUtil;
  * you want to load templates from the specified package accessible through 
the Thread Context Class Loader of the
  * thread that initializes this servlet.
  * If {@code incompatible_improvements} is set to 2.3.22 (or higher), you can 
specify multiple comma separated locations
- * inside square brackets, like: {@code [ WEB-INF/templates, 
classpath:com/example/myapp/templates ]}.
- * This internally creates a {@link MultiTemplateLoader}. Note again that if 
{@code incompatible_improvements} isn't
- * set to at least 2.3.22, the initial {@code [} has no special meaning, and 
so this feature is unavailable.
+ * inside square brackets, like: {@code [ WEB-INF/templates, 
classpath:com/example/myapp/templates ]}. This internally
+ * creates a {@link MultiTemplateLoader}. Note again that if {@code 
incompatible_improvements} isn't set to at least
+ * 2.3.22, the initial {@code [} has no special meaning, and so this feature 
is unavailable.
  * Any of the above can have a {@code ?setting(name=value, ...)} postfix to 
set the JavaBeans properties of the
  * {@link TemplateLoader} created. For example,
- * {@code /templates?settings(attemptFileAccess=false, 
URLConnectionUsesCaches=true)}
- * calls {@link WebappTemplateLoader#setAttemptFileAccess(boolean)}
- * and {@link WebappTemplateLoader#setURLConnectionUsesCaches(Boolean)} to 
tune the {@link WebappTemplateLoader}. 
- * For backward compatibility (not recommended!), you can use the {@code 
class://} prefix, like in
+ * {@code /templates?settings(attemptFileAccess=false, 
URLConnectionUsesCaches=true)} calls
+ * {@link WebappTemplateLoader#setAttemptFileAccess(boolean)} and
+ * {@link WebappTemplateLoader#setURLConnectionUsesCaches(Boolean)} to tune 
the {@link WebappTemplateLoader}. For
+ * backward compatibility (not recommended!), you can use the {@code class://} 
prefix, like in
  * class://com/example/templates format, which is similar to {@code 
classpath:}, except that it uses the
  * defining class loader of this servlet's class. This can cause template not 
found errors, if that class (in
  * {@code freemarer.jar} usually) is not local to the web application, while 
the templates are.
@@ -134,17 +134,20 @@ import freemarker.template.utility.StringUtil;
  * {@value #INIT_PARAM_NO_CACHE}: If set to t

[1/3] incubator-freemarker git commit: FREEMARKER-1 adding OverrideResponseContentType init param in FreemarketServlet

2015-10-17 Thread ddekany
Repository: incubator-freemarker
Updated Branches:
  refs/heads/2.3-gae 0256df536 -> fe08488da


FREEMARKER-1 adding OverrideResponseContentType init param in FreemarketServlet


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

Branch: refs/heads/2.3-gae
Commit: e89dbfce5f2d2274653062dfd6911a62c354c39b
Parents: 0eccad5
Author: Woonsan Ko 
Authored: Mon Oct 12 22:31:16 2015 +0900
Committer: Woonsan Ko 
Committed: Mon Oct 12 22:31:16 2015 +0900

--
 .classpath  |   2 +
 ivy.xml |  10 +-
 .../ext/servlet/FreemarkerServlet.java  |  37 --
 .../ext/servlet/FreemarkerServletTest.java  | 124 +++
 .../resources/freemarker/ext/servlet/foo.ftl|  19 +++
 5 files changed, 181 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e89dbfce/.classpath
--
diff --git a/.classpath b/.classpath
index ad83438..0716ff4 100644
--- a/.classpath
+++ b/.classpath
@@ -54,5 +54,7 @@



+   
+   

 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e89dbfce/ivy.xml
--
diff --git a/ivy.xml b/ivy.xml
index f81c3c3..bf21fb6 100644
--- a/ivy.xml
+++ b/ivy.xml
@@ -4,6 +4,7 @@
 
 
+
 ]>
 
   
@@ -141,7 +142,14 @@
   
   
 
-
+
+
+  
+
+
+  
+
+
 
 
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e89dbfce/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 83eb14c..776a884 100644
--- a/src/main/java/freemarker/ext/servlet/FreemarkerServlet.java
+++ b/src/main/java/freemarker/ext/servlet/FreemarkerServlet.java
@@ -140,7 +140,12 @@ import freemarker.template.utility.StringUtil;
  * actual template file will be used (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 content_type in the
  * attributes parameter of the <#ftl> directive.
- * 
+ *
+ * {@value #INIT_PARAM_OVERRIDE_RESPONSE_CONTENT_TYPE} 
(since 2.4.0): If set to true, overrides the ContentType
+ * of the response by using either {@value 
#INIT_PARAM_CONTENT_TYPE} parameter setting or other
+ * information (see the description of {@value 
#INIT_PARAM_CONTENT_TYPE} for detail). The default
+ * value is false.
+ *
  * {@value #INIT_PARAM_BUFFER_SIZE}: Sets the size of the 
output buffer in bytes, or if "KB" or
  * "MB" is written after the number (like {@code 256 
KB}) then in kilobytes or megabytes.
  * This corresponds to {@link HttpServletResponse#setBufferSize(int)}. If the 
{@link HttpServletResponse} state doesn't
@@ -273,6 +278,13 @@ public class FreemarkerServlet extends HttpServlet {
 
 /**
  * Init-param name - see the {@link FreemarkerServlet} class documentation 
about the init-params.
+ *
+ * @since 2.3.24
+ */
+public static final String INIT_PARAM_OVERRIDE_RESPONSE_CONTENT_TYPE = 
"OverrideResponseContentType";
+
+/**
+ * Init-param name - see the {@link FreemarkerServlet} class documentation 
about the init-params.
  * 
  * @since 2.3.22
  */
@@ -314,7 +326,7 @@ public class FreemarkerServlet extends HttpServlet {
 private static final String 
DEPR_INITPARAM_TEMPLATE_EXCEPTION_HANDLER_IGNORE = "ignore";
 private static final String DEPR_INITPARAM_DEBUG = "debug";
 
-private static final String DEFAULT_CONTENT_TYPE = "text/html";
+static final String DEFAULT_CONTENT_TYPE = "text/html";
 
 /**
  * When set, the items defined in it will be added after those coming from 
the
@@ -412,6 +424,7 @@ 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 boolean overrideResponseContentType = true;
 private boolean noCharsetInContentType;
 private List/**/ metaInfTldSources;
 private List/**/ classpathTlds;
@@ -557,6 +570,8 @@ public class FreemarkerServlet extends HttpServlet {
 debug = StringUtil.getYesNo(value);
 

[jira] [Commented] (FREEMARKER-1) Option to not to overwrite response ContentType in FreemarkerServlet

2015-10-17 Thread Daniel Dekany (JIRA)

[ 
https://issues.apache.org/jira/browse/FREEMARKER-1?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14961981#comment-14961981
 ] 

Daniel Dekany commented on FREEMARKER-1:


Seems you don't set the response Content-type header even if it was null. Is 
that deliberate? I think it should be set then. I will do that for now, but 
tell me if you disagree.

> Option to not to overwrite response ContentType in FreemarkerServlet
> 
>
> Key: FREEMARKER-1
> URL: https://issues.apache.org/jira/browse/FREEMARKER-1
> Project: Apache Freemarker
>  Issue Type: Improvement
>Reporter: Woonsan Ko
>Assignee: Daniel Dekany
>Priority: Minor
>
> FreemarkerServlet doesn't have to set response ContentType by default. 
> Especially when a controller in an MVC framework sets the response 
> ContentType, it's better to not set the response ContentType again by the 
> default ContentType setting in FreemarkerServlet according to servlet 
> specification (SRV.5.2 and SRV.14.2.22.1):
> {quote}
> Servlet programmers are responsible for ensuring that the Content-Type header 
> is appropriately set in the response object for the content the servlet is 
> generating. The HTTP 1.1 specification does not require that this header be 
> set in an HTTP response. Servlet containers must not set a default content 
> type when the servlet programmer does not set the type.
> {quote}
> {quote}
> ServletResponse#getContentType() should "Returns the content type used for 
> the MIME body sent in this response. The content type proper must have been 
> specified using setContentType(String) before the response is committed. If 
> no content type has been specified, this method returns null. If a content 
> type has been specified and a character encoding has been explicitly or 
> implicitly specified as described in getCharacterEncoding() , the charset 
> parameter is included in the string returned. If no character encoding has 
> been specified, the charset parameter is omitted.
> Returns: a String specifying the content type, for example, text/html; 
> charset=UTF-8, or null
> Since: 2.4
> {quote}
> So, optionally, if #getContentType() returns null, then FreemarkerServlet can 
> detect that the Content-Type was never set before.
> Actually, frameworks or containers don't have to set Content-Type if 
> programmers don't. However, I think setting Content-Type header in the 
> framework level (freemarker servlet in this case) to a reasonable default 
> value seems fine.
> Daniels's remarks/suggestions on this in the old ML:
> {quote}
> The contentType matter... thanks for looking after these! So then, 
> FreemarkerServlet surely should set the HttpServletResponse contentType when 
> it's still null. OTOH there should be an option to only set it then (if it's 
> not null), not always as it happens now. So then the "ContetType" init-param 
> remains as is, and we add a new init-param, "OverrideResponseContentType" 
> (better name?), whose default is true for backward compatibility, but this 
> default can be changed to false by extending FreemarkerServlet. WDYT?
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Assigned] (FREEMARKER-1) Option to not to overwrite response ContentType in FreemarkerServlet

2015-10-17 Thread Daniel Dekany (JIRA)

 [ 
https://issues.apache.org/jira/browse/FREEMARKER-1?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Dekany reassigned FREEMARKER-1:
--

Assignee: Daniel Dekany

> Option to not to overwrite response ContentType in FreemarkerServlet
> 
>
> Key: FREEMARKER-1
> URL: https://issues.apache.org/jira/browse/FREEMARKER-1
> Project: Apache Freemarker
>  Issue Type: Improvement
>Reporter: Woonsan Ko
>Assignee: Daniel Dekany
>Priority: Minor
>
> FreemarkerServlet doesn't have to set response ContentType by default. 
> Especially when a controller in an MVC framework sets the response 
> ContentType, it's better to not set the response ContentType again by the 
> default ContentType setting in FreemarkerServlet according to servlet 
> specification (SRV.5.2 and SRV.14.2.22.1):
> {quote}
> Servlet programmers are responsible for ensuring that the Content-Type header 
> is appropriately set in the response object for the content the servlet is 
> generating. The HTTP 1.1 specification does not require that this header be 
> set in an HTTP response. Servlet containers must not set a default content 
> type when the servlet programmer does not set the type.
> {quote}
> {quote}
> ServletResponse#getContentType() should "Returns the content type used for 
> the MIME body sent in this response. The content type proper must have been 
> specified using setContentType(String) before the response is committed. If 
> no content type has been specified, this method returns null. If a content 
> type has been specified and a character encoding has been explicitly or 
> implicitly specified as described in getCharacterEncoding() , the charset 
> parameter is included in the string returned. If no character encoding has 
> been specified, the charset parameter is omitted.
> Returns: a String specifying the content type, for example, text/html; 
> charset=UTF-8, or null
> Since: 2.4
> {quote}
> So, optionally, if #getContentType() returns null, then FreemarkerServlet can 
> detect that the Content-Type was never set before.
> Actually, frameworks or containers don't have to set Content-Type if 
> programmers don't. However, I think setting Content-Type header in the 
> framework level (freemarker servlet in this case) to a reasonable default 
> value seems fine.
> Daniels's remarks/suggestions on this in the old ML:
> {quote}
> The contentType matter... thanks for looking after these! So then, 
> FreemarkerServlet surely should set the HttpServletResponse contentType when 
> it's still null. OTOH there should be an option to only set it then (if it's 
> not null), not always as it happens now. So then the "ContetType" init-param 
> remains as is, and we add a new init-param, "OverrideResponseContentType" 
> (better name?), whose default is true for backward compatibility, but this 
> default can be changed to false by extending FreemarkerServlet. WDYT?
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (FREEMARKER-4) [Docgen] Links in tables are wrapping

2015-10-17 Thread Daniel Dekany (JIRA)

 [ 
https://issues.apache.org/jira/browse/FREEMARKER-4?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Dekany updated FREEMARKER-4:
---
   Assignee: Evangelia Dendramis
Component/s: docgen

> [Docgen] Links in tables are wrapping
> -
>
> Key: FREEMARKER-4
> URL: https://issues.apache.org/jira/browse/FREEMARKER-4
> Project: Apache Freemarker
>  Issue Type: Bug
>  Components: docgen
>Reporter: Evangelia Dendramis
>Assignee: Evangelia Dendramis
>Priority: Minor
>
> If you browse to http://freemarker.org/poweredBy.html, the links are wrapping 
> due to `.page-content a { word-break: break-word;`



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Closed] (FREEMARKER-3) FileTemplateLoaderTest and ASTTest fails test on non-Windows env

2015-10-17 Thread Daniel Dekany (JIRA)

 [ 
https://issues.apache.org/jira/browse/FREEMARKER-3?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Dekany closed FREEMARKER-3.
--
Resolution: Fixed

> FileTemplateLoaderTest and ASTTest fails test on non-Windows env
> 
>
> Key: FREEMARKER-3
> URL: https://issues.apache.org/jira/browse/FREEMARKER-3
> Project: Apache Freemarker
>  Issue Type: Bug
> Environment: - OS X 10.10.5 x86_64
> - Apache Ant(TM) version 1.9.6 compiled on June 29 2015
> - Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
>Reporter: Woonsan Ko
>
> From master, if you run `ant test' on OS X (Ant 1.9 / Java 1.8), two tests 
> fail:
> {noformat}
> [junit] TEST freemarker.cache.FileTemplateLoaderTest FAILED
> [junit] TEST freemarker.core.ASTTest FAILED
> {noformat}
> Those look like an environment related issue. FileTemplateLoaderTest seems 
> failing when resolving file in case-sensitive way and ASTTest seems failing 
> due to EOL issue.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)