You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by so...@apache.org on 2011/07/06 22:47:35 UTC

svn commit: r1143561 - /myfaces/trinidad/branches/trinidad-1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java

Author: sobryan
Date: Wed Jul  6 20:47:35 2011
New Revision: 1143561

URL: http://svn.apache.org/viewvc?rev=1143561&view=rev
Log:
TRINIDAD-2110: workaround for jsf portlet bridge 2.0 nullviewstatetoken

Modified:
    myfaces/trinidad/branches/trinidad-1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java

Modified: myfaces/trinidad/branches/trinidad-1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java?rev=1143561&r1=1143560&r2=1143561&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java (original)
+++ myfaces/trinidad/branches/trinidad-1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java Wed Jul  6 20:47:35 2011
@@ -940,7 +940,7 @@ public class StateManagerImpl extends St
     // @see setPerViewStateSaving()
     String viewStateValue =
       external.getRequestParameterMap().get(ResponseStateManager.VIEW_STATE_PARAM);
-    if (viewStateValue != null && !viewStateValue.startsWith("!"))
+    if (! (_isViewStateNull(viewStateValue) || viewStateValue.startsWith("!")))
     {
       return false;
     }
@@ -958,6 +958,29 @@ public class StateManagerImpl extends St
     // its default (token), so we return TRUE to send down a token string.
     return true;
   }
+  
+  /**
+   * One oddity with some of the JSF 1.2 Bridge impelmentations is that when
+   * there is a goLink that is encoded as an action URL, as the are expected to
+   * be, the bridge works around an issue in Mojarra that would cause JSF to not
+   * display properly.  The reason for this is that ActionRequests into the
+   * Portal are considered "posts" and Mojarra will skip the render phase of JSF
+   * if there is a post request without a viewStateParameter.  Hopefully this
+   * issue can be fixed in later versions of Mojarra 1.2 and it DOES NOT exist
+   * in MyFaces or Mojarra 2.0 and later.
+   * 
+   * For now, however, in the JSF 1.2 branches, we need to check to see if the
+   * VIEW_STATE_PARAMETER is "org.apache.myfaces.portlet.faces.nullViewState"
+   * in addition to the actual Null value.  This bug is being tracked in
+   * Jira: PORTLETBRIDGE-216.
+   * 
+   * @param ec
+   * @return
+   */
+  private boolean _isViewStateNull(String viewStateValue)
+  {
+    return viewStateValue == null || "org.apache.myfaces.portlet.faces.nullViewState".equals(viewStateValue);
+  }
 
   private int _getCacheSize(ExternalContext extContext)
   {
@@ -983,7 +1006,6 @@ public class StateManagerImpl extends St
   //
   // @todo Map is a bad structure
   // @todo a static size is bad
-  //
   @SuppressWarnings("unchecked")
   static private Map<String, PageState> _getApplicationViewCache(FacesContext context)
   {