You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by sa...@apache.org on 2011/04/25 18:32:08 UTC
svn commit: r1096510 - in /click/trunk/click/framework/src/org/apache/click:
ClickServlet.java Page.java
Author: sabob
Date: Mon Apr 25 16:32:08 2011
New Revision: 1096510
URL: http://svn.apache.org/viewvc?rev=1096510&view=rev
Log:
Added page method getCharacterEncoding. CLK-764
Modified:
click/trunk/click/framework/src/org/apache/click/ClickServlet.java
click/trunk/click/framework/src/org/apache/click/Page.java
Modified: click/trunk/click/framework/src/org/apache/click/ClickServlet.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/ClickServlet.java?rev=1096510&r1=1096509&r2=1096510&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ClickServlet.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ClickServlet.java Mon Apr 25 16:32:08 2011
@@ -939,6 +939,8 @@ public class ClickServlet extends HttpSe
response.setContentType(page.getContentType());
+ response.setCharacterEncoding(page.getCharacterEncoding());
+
Writer writer = getWriter(response);
if (page.hasHeaders()) {
Modified: click/trunk/click/framework/src/org/apache/click/Page.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/Page.java?rev=1096510&r1=1096509&r2=1096510&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/Page.java (original)
+++ click/trunk/click/framework/src/org/apache/click/Page.java Mon Apr 25 16:32:08 2011
@@ -135,6 +135,7 @@ import org.apache.commons.lang.StringUti
* <li>{@link #model} to populate the Velocity Context</li>
* <li>{@link #format} to add to the Velocity Context</li>
* <li>{@link #getContentType()} to set as the HttpServletResponse content type</li>
+ * <li>{@link #getContentType()} to set as the HttpServletResponse content type</li>
* <li>{@link #headers} to set as the HttpServletResponse headers</li>
* </ul>
*
@@ -449,27 +450,30 @@ public class Page implements Serializabl
}
/**
+ * Return the HTTP response character encoding. By default this method returns
+ * the request character encoding via
+ * {@link javax.servlet.ServletRequest#getCharacterEncoding()}
+ * <p/>
+ * The ClickServlet uses the pages character encoding for setting the
+ * HttpServletResponse character encoding.
+ *
+ * @return the HTTP response content type
+ */
+ public String getCharacterEncoding() {
+ return getContext().getRequest().getCharacterEncoding();
+ }
+
+ /**
* Return the HTTP response content type. By default this method returns
* <tt>"text/html"</tt>.
* <p/>
- * If the request specifies a character encoding via
- * If {@link javax.servlet.ServletRequest#getCharacterEncoding()}
- * then this method will return <tt>"text/html; charset=encoding"</tt>.
- * <p/>
* The ClickServlet uses the pages content type for setting the
* HttpServletResponse content type.
*
* @return the HTTP response content type
*/
public String getContentType() {
- String charset = getContext().getRequest().getCharacterEncoding();
-
- if (charset == null) {
- return "text/html";
-
- } else {
- return "text/html; charset=" + charset;
- }
+ return "text/html";
}
/**