Author: nbelaevski
Date: 2008-03-21 13:50:52 -0400 (Fri, 21 Mar 2008)
New Revision: 7079
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java
Log:
http://jira.jboss.com/jira/browse/RF-1360
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java 2008-03-21
17:49:12 UTC (rev 7078)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java 2008-03-21
17:50:52 UTC (rev 7079)
@@ -250,6 +250,7 @@
// if content not
// supported by tidy.
String contentType = servletResponseWrapper.getContentType();
+ String contentTypeCharset = contentType;
if (log.isDebugEnabled()) {
log.debug("create HTML/XML parser for content type: "
+ contentType);
@@ -257,13 +258,12 @@
// if(contentType == null){
// contentType = request.getContentType();
// }
- if (contentType != null) {
- if (contentType.indexOf("charset") < 0
+ if (contentTypeCharset != null) {
+ if (contentTypeCharset.indexOf("charset") < 0
&& null != characterEncoding) {
- contentType += ";charset=" + characterEncoding;
+ contentTypeCharset += ";charset=" + characterEncoding;
}
- parser = getParser(contentType, false, viewId);
- response.setContentType(contentType);
+ parser = getParser(contentTypeCharset, false, viewId);
}
// null or unsupported content type
if (null == parser) {
@@ -273,10 +273,18 @@
}
try {
if (servletResponseWrapper.isUseWriter()) {
+ if (contentTypeCharset != null) {
+ response.setContentType(contentTypeCharset);
+ }
+
output = createResponseWriter(response,
characterEncoding);
servletResponseWrapper.sendContent(output);
} else if (servletResponseWrapper.isUseStream()) {
+ if (contentType != null) {
+ response.setContentType(contentType);
+ }
+
ServletOutputStream out = response.getOutputStream();
servletResponseWrapper.sendContent(out);
}
@@ -285,6 +293,11 @@
}
return;
}
+
+ if (contentTypeCharset != null) {
+ response.setContentType(contentTypeCharset);
+ }
+
output = createResponseWriter(response, characterEncoding);
parser.setInputEncoding(characterEncoding);