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/05/27 16:51:49 UTC

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

Author: lofwyr
Date: Wed May 27 14:51:49 2009
New Revision: 779199

URL: http://svn.apache.org/viewvc?rev=779199&view=rev
Log:
TOBAGO-732: workaround for Servlet 2.3

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=779199&r1=779198&r2=779199&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 Wed May 27 14:51:49 2009
@@ -60,13 +60,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 (AbstractMethodError e) {
+          LOG.warn("The method ServletResponse.getContentType() is not available before Servlet 2.4");
         }
       }
     }