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

svn commit: r713560 - in /myfaces/core/branches/2_0_0: api/src/main/java/javax/faces/context/ExternalContext.java impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java

Author: slessard
Date: Wed Nov 12 15:26:16 2008
New Revision: 713560

URL: http://svn.apache.org/viewvc?rev=713560&view=rev
Log:
MYFACES-1946 - Implement ExternalContext.setResponseContentType

Modified:
    myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/ExternalContext.java
    myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java

Modified: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/ExternalContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/ExternalContext.java?rev=713560&r1=713559&r2=713560&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/ExternalContext.java (original)
+++ myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/ExternalContext.java Wed Nov 12 15:26:16 2008
@@ -254,8 +254,7 @@
      */
     public void setResponseContentType(String contentType)
     {
-        // TODO: JSF 2.0 #31
-        // VALIDATE: Should this be asbtract or throws UnsupportedOperationException? Check with the EG
+        throw new UnsupportedOperationException();
     }
 
     public String getResponseCharacterEncoding()

Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java?rev=713560&r1=713559&r2=713560&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java Wed Nov 12 15:26:16 2008
@@ -548,6 +548,17 @@
         this._servletResponse.setCharacterEncoding(encoding);
     }
 
+    @Override
+    public void setResponseContentType(String contentType)
+    {
+        // If the response has not been committed yet.
+        if (!_servletResponse.isCommitted())
+        {
+            // Sets the content type of the response being sent to the client
+            _servletResponse.setContentType(contentType);
+        }
+    }
+
     private void checkNull(final Object o, final String param)
     {
         if (o == null)