You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by so...@apache.org on 2011/03/14 08:38:36 UTC

svn commit: r1081275 - /myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java

Author: sobryan
Date: Mon Mar 14 07:38:36 2011
New Revision: 1081275

URL: http://svn.apache.org/viewvc?rev=1081275&view=rev
Log:
TRINIDAD-2062 - Added a getWriter method to the ExternalContextUtils.  This is to support backward compatibility with 1.2.x

Modified:
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java?rev=1081275&r1=1081274&r2=1081275&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java Mon Mar 14 07:38:36 2011
@@ -21,6 +21,8 @@ package org.apache.myfaces.trinidad.util
 import java.io.IOException;
 import java.io.InputStream;
 
+import java.io.Writer;
+
 import java.lang.reflect.Method;
 
 import javax.faces.context.ExternalContext;
@@ -224,7 +226,7 @@ public final class ExternalContextUtils
       return null;
     }
   }
-
+  
   /**
    * Returns the contextPath of the ServletRequest or <code>null</code> for portlet requests
    *
@@ -267,6 +269,29 @@ public final class ExternalContextUtils
       return null;
     }
   }
+  
+  /**
+   * Returns the writer appropriate for the current response or <code>null</code> if one is
+   * not available.  This will always be available in a servlet request, but will only be available
+   * for resource or render responses in a portal environments
+   * 
+   * @param ec the current externalContext
+   * @return a writer appropriate for the current response
+   * @see ExternalContext#getResponseOutputWriter()
+   * 
+   * @deprecated replaced by an API in JSF.  Use ExternalContext.getResponseOutputWriter()
+   */
+  @Deprecated
+  public static Writer getResponseWriter(ExternalContext ec)
+    throws IOException
+  {
+    if (isResponseWritable(ec))
+    {
+      return ec.getResponseOutputWriter();
+    }
+    
+    return null;
+  }
 
   /**
    * Returns the character encoding or <code>null</code> if there isn't any