myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r927507 - /myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxResponseRenderer.java
Date Thu, 25 Mar 2010 17:18:06 GMT
Author: lofwyr
Date: Thu Mar 25 17:18:06 2010
New Revision: 927507

URL: http://svn.apache.org/viewvc?rev=927507&view=rev
Log:
TOBAGO-664: The state should be called after the encoding.
(Error was "activated" of Popup was saved incorrectly)

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxResponseRenderer.java

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxResponseRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxResponseRenderer.java?rev=927507&r1=927506&r2=927507&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxResponseRenderer.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxResponseRenderer.java
Thu Mar 25 17:18:06 2010
@@ -41,11 +41,7 @@ import javax.faces.render.RenderKitFacto
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.EmptyStackException;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 public class AjaxResponseRenderer {
   
@@ -136,10 +132,9 @@ public class AjaxResponseRenderer {
     writer.write("\n  }");
   }
 
-  private void saveState(FacesContext facesContext, RenderKit renderKit)
-      throws IOException {
-    ResponseWriter stateWriter =
-        renderKit.createResponseWriter(getPrintWriter(facesContext), contentType, null);
+  private void saveState(FacesContext facesContext, RenderKit renderKit) throws IOException
{
+
+    ResponseWriter stateWriter = renderKit.createResponseWriter(getPrintWriter(facesContext),
contentType, null);
     facesContext.setResponseWriter(stateWriter);
 
     StateManager stateManager = facesContext.getApplication().getStateManager();
@@ -176,13 +171,6 @@ public class AjaxResponseRenderer {
     writer.write("  \"responseCode\": ");
     writer.write(reloadRequired ? Integer.toString(CODE_RELOAD_REQUIRED) : Integer.toString(CODE_SUCCESS));
 
-    if (!reloadRequired) {
-      writer.write(",\n");
-      writer.write("  \"jsfState\": \"");
-      saveState(facesContext, renderKit);
-      writer.write("\"");
-    }
-
     Map<String, UIComponent> ajaxComponents = AjaxInternalUtils.getAjaxComponents(facesContext);
     int i = 0;
     for (Map.Entry<String, UIComponent> entry : ajaxComponents.entrySet()) {
@@ -198,6 +186,13 @@ public class AjaxResponseRenderer {
       renderComponent(facesContext, renderKit, entry.getKey(), component);
     }
 
+    if (!reloadRequired) {
+      writer.write(",\n");
+      writer.write("  \"jsfState\": \"");
+      saveState(facesContext, renderKit);
+      writer.write("\"");
+    }
+
     writer.write("\n}\n");
     writer.flush();
     writer.close();



Mime
View raw message