You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2005/11/22 23:38:38 UTC
svn commit: r348280 -
/myfaces/share/trunk/src/java/org/apache/myfaces/renderkit/html/util/DummyFormUtils.java
Author: skitching
Date: Tue Nov 22 14:38:35 2005
New Revision: 348280
URL: http://svn.apache.org/viewcvs?rev=348280&view=rev
Log:
Added javadoc
Modified:
myfaces/share/trunk/src/java/org/apache/myfaces/renderkit/html/util/DummyFormUtils.java
Modified: myfaces/share/trunk/src/java/org/apache/myfaces/renderkit/html/util/DummyFormUtils.java
URL: http://svn.apache.org/viewcvs/myfaces/share/trunk/src/java/org/apache/myfaces/renderkit/html/util/DummyFormUtils.java?rev=348280&r1=348279&r2=348280&view=diff
==============================================================================
--- myfaces/share/trunk/src/java/org/apache/myfaces/renderkit/html/util/DummyFormUtils.java (original)
+++ myfaces/share/trunk/src/java/org/apache/myfaces/renderkit/html/util/DummyFormUtils.java Tue Nov 22 14:38:35 2005
@@ -47,7 +47,25 @@
/**
* Returns a DummyFormResponseWriter.
- * Replaces current ResponseWriter by a DummyFormResponseWriter if necessary.
+ * <p>
+ * Note that the default HTML renderkit's createResponseWriter method returns
+ * instances of HtmlResponseWriterImpl, which already implements the
+ * DummyFormResponseWriter interface. Calls to this method when using that
+ * renderkit therefore just return the standard responsewriter, typecast
+ * to the appropriate interface.
+ * <p>
+ * For other renderkits whose createResponseWriter method doesn't return
+ * an implementation of DummyFormResponseWriter this method creates an
+ * implementation which <i>wraps</i> the current ResponseWriter while
+ * providing the additional functionality needed. The FacesContext is
+ * updated to use the wrapper as its ResponseWriter.
+ * <p>
+ * When a wrapper is created, it is also stored into the request for
+ * some reason. This can have unexpected side-effects, as changing the
+ * current FacesContext's responseWriter will not cause the cached
+ * DummyFormResponseWriterWrapper's underlying response writer to change.
+ * TODO: document why caching is needed.
+ *
* @param facesContext
* @return a DummyFormResponseWriter instance
*/
@@ -56,8 +74,6 @@
ResponseWriter currentWriter = facesContext.getResponseWriter();
if (currentWriter instanceof DummyFormResponseWriter)
{
- // current ResponseWriter is a DummyFormResponseWriter
- //((DummyFormResponseWriter)currentWriter).setWriteDummyForm(true);
return (DummyFormResponseWriter)currentWriter;
}
else