myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r983042 - in /myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago: lifecycle/RestoreViewExecutor.java renderkit/TobagoResponseStateManager.java
Date Fri, 06 Aug 2010 16:27:04 GMT
Author: lofwyr
Date: Fri Aug  6 16:27:04 2010
New Revision: 983042

URL: http://svn.apache.org/viewvc?rev=983042&view=rev
Log:
TOBAGO-905: Wrong detection of post back, when existing request params and using GET request

Modified:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/lifecycle/RestoreViewExecutor.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/TobagoResponseStateManager.java

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/lifecycle/RestoreViewExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/lifecycle/RestoreViewExecutor.java?rev=983042&r1=983041&r2=983042&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/lifecycle/RestoreViewExecutor.java
(original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/lifecycle/RestoreViewExecutor.java
Fri Aug  6 16:27:04 2010
@@ -17,18 +17,15 @@ package org.apache.myfaces.tobago.lifecy
  * limitations under the License.
  */
 
-import static org.apache.myfaces.tobago.lifecycle.TobagoLifecycle.FACES_MESSAGES_KEY;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
-import static org.apache.myfaces.tobago.lifecycle.TobagoLifecycle.VIEW_ROOT_KEY;
 import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.renderkit.TobagoResponseStateManager;
 
 import javax.faces.FacesException;
 import javax.faces.application.Application;
-import javax.faces.application.ViewHandler;
 import javax.faces.application.FacesMessage;
+import javax.faces.application.ViewHandler;
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIInput;
 import javax.faces.component.UIViewRoot;
@@ -39,8 +36,11 @@ import javax.faces.event.PhaseId;
 import java.io.IOException;
 import java.lang.reflect.Method;
 import java.util.Iterator;
-import java.util.Map;
 import java.util.List;
+import java.util.Map;
+
+import static org.apache.myfaces.tobago.lifecycle.TobagoLifecycle.FACES_MESSAGES_KEY;
+import static org.apache.myfaces.tobago.lifecycle.TobagoLifecycle.VIEW_ROOT_KEY;
 //import org.apache.myfaces.portlet.MyFacesGenericPortlet;
 //import org.apache.myfaces.portlet.PortletUtil;
 
@@ -116,7 +116,7 @@ class RestoreViewExecutor implements Pha
     facesContext.setViewRoot(viewRoot);
     ComponentUtil.resetPage(facesContext);
 
-    if (facesContext.getExternalContext().getRequestParameterMap().isEmpty()) {
+    if (!isPostBack(facesContext)) {
       // no POST or query parameters --> set render response flag
       facesContext.renderResponse();
     }
@@ -127,6 +127,11 @@ class RestoreViewExecutor implements Pha
     return false;
   }
 
+  private boolean isPostBack(FacesContext facesContext) {
+    Map requestParameterMap = facesContext.getExternalContext().getRequestParameterMap();
+    return requestParameterMap.containsKey(TobagoResponseStateManager.TREE_PARAM);
+  }
+
   public PhaseId getPhase() {
     return PhaseId.RESTORE_VIEW;
   }

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/TobagoResponseStateManager.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/TobagoResponseStateManager.java?rev=983042&r1=983041&r2=983042&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/TobagoResponseStateManager.java
(original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/TobagoResponseStateManager.java
Fri Aug  6 16:27:04 2010
@@ -19,15 +19,15 @@ package org.apache.myfaces.tobago.render
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
+import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
 
-import javax.faces.render.ResponseStateManager;
+import javax.faces.application.StateManager;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
-import javax.faces.application.StateManager;
-import java.util.Map;
+import javax.faces.render.ResponseStateManager;
 import java.io.IOException;
+import java.util.Map;
 
 /*
  * Date: 21.05.2006
@@ -36,7 +36,7 @@ import java.io.IOException;
 public class TobagoResponseStateManager extends ResponseStateManager {
   private static final Log LOG = LogFactory.getLog(TobagoResponseStateManager.class);
 
-  private static final String TREE_PARAM = "jsf_tree";
+  public static final String TREE_PARAM = "jsf_tree";
   private static final String STATE_PARAM = "jsf_state";
   private static final String VIEWID_PARAM = "jsf_viewid";
 



Mime
View raw message