You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2009/02/10 11:35:32 UTC

svn commit: r742928 - /myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java

Author: bommel
Date: Tue Feb 10 10:35:19 2009
New Revision: 742928

URL: http://svn.apache.org/viewvc?rev=742928&view=rev
Log:
(TOBAGO-732) Websphere ignores charset if setContentType is called twice

Modified:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java?rev=742928&r1=742927&r2=742928&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java Tue Feb 10 10:35:19 2009
@@ -60,8 +60,13 @@
       if (!response.containsHeader("Content-Type")) {
         response.setContentType(contentType);
       } else {
-        if (LOG.isInfoEnabled()) {
-          LOG.info("Reponse already contains Header Content-Type. Ignore setting Content-Type to " + contentType);
+        String responseContentType = response.getContentType();
+        if (!responseContentType.equalsIgnoreCase(contentType)) {
+          response.setContentType(contentType);
+          if (LOG.isInfoEnabled()) {
+            LOG.info("Reponse already contains Header Content-Type '" + responseContentType
+                + "'. Setting Content-Type to '" + contentType + "'");
+          }
         }
       }
     }