You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2006/07/12 18:43:21 UTC

svn commit: r421316 - /myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/ExtensionsPhaseListener.java

Author: mmarinschek
Date: Wed Jul 12 09:43:21 2006
New Revision: 421316

URL: http://svn.apache.org/viewvc?rev=421316&view=rev
Log:
explained a little bit better what is happening in this class

Modified:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/ExtensionsPhaseListener.java

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/ExtensionsPhaseListener.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/ExtensionsPhaseListener.java?rev=421316&r1=421315&r2=421316&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/ExtensionsPhaseListener.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/ExtensionsPhaseListener.java Wed Jul 12 09:43:21 2006
@@ -63,7 +63,7 @@
 
         try
         {
-            renderCodeBeforeBodyEnd(facesContext);
+            getJavaScriptCodeAndStoreInRequest(facesContext);
         } catch (IOException e)
         {
             log.error("Exception while rendering extension filter code.",e);
@@ -71,10 +71,13 @@
     }
 
     /**
-     * Renders stuff such as the dummy form and the autoscroll javascript, which goes before the closing </body>
+     * Creates javascript-code such as the dummy form and the autoscroll javascript, which goes before the closing </body>
+     *
+     * The extension filter will then finally process it and render it into the page.
+     * 
      * @throws IOException
      */
-    private void renderCodeBeforeBodyEnd(FacesContext facesContext) throws IOException
+    private void getJavaScriptCodeAndStoreInRequest(FacesContext facesContext) throws IOException
     {
         Object myFacesJavascript = facesContext.getExternalContext().getRequestMap().get(ORG_APACHE_MYFACES_MY_FACES_JAVASCRIPT);
 
@@ -103,7 +106,18 @@
         return "<!-- MYFACES JAVASCRIPT -->\n"+writerWrapper.toString()+"\n";
     }
 
-	public static void writeCodeBeforeBodyEnd(FacesContext facesContext) throws IOException
+    /**In case of StreamingAddResource and a documentBody-Tag, this method will be called with the
+     * normal response writer set.
+     *
+     * It will directly render out the javascript-text at the current position (immediately before body-closing).
+     *
+     * In the case of DefaultAddResource, this method will be called with a wrapped response writer - and we'll
+     * buffer the javascript-text in the request, for the ExtensionFilter to catch and render it.
+     *
+     * @param facesContext
+     * @throws IOException
+     */
+    public static void writeCodeBeforeBodyEnd(FacesContext facesContext) throws IOException
 	{
 		ResponseWriter writer = facesContext.getResponseWriter();