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 2005/07/14 18:02:38 UTC

svn commit: r219054 - /myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/ajaxsuggest/AjaxPhaseListener.java

Author: mmarinschek
Date: Thu Jul 14 09:02:35 2005
New Revision: 219054

URL: http://svn.apache.org/viewcvs?rev=219054&view=rev
Log:
changed phase of AJAX listener

Modified:
    myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/ajaxsuggest/AjaxPhaseListener.java

Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/ajaxsuggest/AjaxPhaseListener.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/ajaxsuggest/AjaxPhaseListener.java?rev=219054&r1=219053&r2=219054&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/ajaxsuggest/AjaxPhaseListener.java (original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/ajaxsuggest/AjaxPhaseListener.java Thu Jul 14 09:02:35 2005
@@ -31,12 +31,7 @@
 
     public void afterPhase(PhaseEvent event)
     {
-        //too late here ;)
-    }
-
-    public void beforePhase(PhaseEvent event)
-    {
-        FacesContext context = event.getFacesContext();
+         FacesContext context = event.getFacesContext();
 
         if(context.getExternalContext().getRequestParameterMap().containsKey("affectedAjaxComponent"))
         {
@@ -47,7 +42,7 @@
             if(ajaxComponent instanceof AjaxComponent)
             {
                 try
-                {       
+                {
                     HtmlBufferResponseWriterWrapper wrapper = HtmlBufferResponseWriterWrapper.getInstance(null);
                     context.setResponseWriter(wrapper);
 
@@ -82,9 +77,20 @@
         }
     }
 
+    public void beforePhase(PhaseEvent event)
+    {
+
+    }
+
+    /**
+     * We need to hang our AJAX phase listener in the invoke application phase as it would be
+     * too late to stop renderering in the render response phase.
+     *
+     * @return
+     */
     public PhaseId getPhaseId()
     {
-        return PhaseId.RENDER_RESPONSE;
+        return PhaseId.INVOKE_APPLICATION;
     }
 
 }