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

svn commit: r829744 - /myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java

Author: lofwyr
Date: Mon Oct 26 10:25:13 2009
New Revision: 829744

URL: http://svn.apache.org/viewvc?rev=829744&view=rev
Log:
TOBAGO-791: Servlet 2.3 support

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java?rev=829744&r1=829743&r2=829744&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java Mon Oct 26 10:25:13 2009
@@ -51,13 +51,17 @@
       if (!response.containsHeader("Content-Type")) {
         response.setContentType(contentType);
       } else {
-        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 + "'");
+        try {
+          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 + "'");
+            }
           }
+        } catch (Error e) {
+          LOG.warn("The method ServletResponse.getContentType() is not available before Servlet 2.4");
         }
       }
     }