myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfreed...@apache.org
Subject svn commit: r1160945 - in /myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces: bridge/BridgeImpl.java context/PortletExternalContextImpl.java
Date Wed, 24 Aug 2011 00:43:50 GMT
Author: mfreedman
Date: Wed Aug 24 00:43:50 2011
New Revision: 1160945

URL: http://svn.apache.org/viewvc?rev=1160945&view=rev
Log:
PORTLETBRIDGE-219: NonFaces in protocol resource request fails after and action

Modified:
    myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
    myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java

Modified: myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java?rev=1160945&r1=1160944&r2=1160945&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
(original)
+++ myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
Wed Aug 24 00:43:50 2011
@@ -1190,7 +1190,7 @@ public class BridgeImpl
   
   private boolean isFacesResourceRequest(ResourceRequest request)
   {
-    return (request.getParameter(PortletExternalContextImpl.JSF_TARGET_VIEWID_RENDER_PARAMETER)
!= null ||
+    return (request.getParameter(PortletExternalContextImpl.JSF_TARGET_VIEWID_RESOURCE_PARAMETER)
!= null ||
             request.getParameter(Bridge.FACES_VIEW_ID_PARAMETER) != null ||
             request.getParameter(Bridge.FACES_VIEW_PATH_PARAMETER) != null);
   }

Modified: myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java?rev=1160945&r1=1160944&r2=1160945&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java
(original)
+++ myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java
Wed Aug 24 00:43:50 2011
@@ -105,6 +105,8 @@ public class PortletExternalContextImpl
 
   // Render parameter to store the viewId
   public static final String JSF_TARGET_VIEWID_RENDER_PARAMETER = "__jpfbJSFTARGET";
+  public static final String JSF_TARGET_VIEWID_RESOURCE_PARAMETER = "__jpfbJSFResTARGET";
+
   public static final String NO_SCOPE = "org.apache.myfaces.portlet.faces.noScope";
   
   public static final String SERVLET_INCLUDED_PATHINFO_ATTRIBUTE = "javax.servlet.include.path_info";
@@ -383,7 +385,7 @@ public class PortletExternalContextImpl
 
       if (viewId != null)
       {
-        encodeFacesActionTarget(queryStr, viewId);
+      encodeFacesActionTarget(queryStr, viewId, (urlType != Bridge.PortletPhase.RESOURCE_PHASE)
? JSF_TARGET_VIEWID_RENDER_PARAMETER : JSF_TARGET_VIEWID_RESOURCE_PARAMETER);
       }
       else
       {
@@ -892,7 +894,7 @@ public class PortletExternalContextImpl
     {
       // This is a Faces resource
       // put the viewId in the QueryStr.
-      queryStr.addParameter(JSF_TARGET_VIEWID_RENDER_PARAMETER, viewId);
+      queryStr.addParameter(JSF_TARGET_VIEWID_RESOURCE_PARAMETER, viewId);
       queryStr.removeParameter(Bridge.PORTLET_MODE_PARAMETER);
       queryStr.removeParameter(Bridge.PORTLET_WINDOWSTATE_PARAMETER);
     }
@@ -1638,8 +1640,17 @@ public class PortletExternalContextImpl
     if (viewId == null)
     {
      // Read the target from the request parameter
-        
-      viewId = mPortletRequest.getParameter(JSF_TARGET_VIEWID_RENDER_PARAMETER);
+      
+      // We encode the viewId in a different parameter in the resource request 
+      // As resource requests can't set render parameters (and hence we might get the old
one back in case one not set)
+      if (getPortletPhase() != Bridge.PortletPhase.RESOURCE_PHASE)
+      {
+          viewId = mPortletRequest.getParameter(JSF_TARGET_VIEWID_RENDER_PARAMETER);
+      }
+      else
+      {
+        viewId = mPortletRequest.getParameter(JSF_TARGET_VIEWID_RESOURCE_PARAMETER);
+      }
 
       if (viewId != null) debugLog("PortletExternalContextImpl.getViewId: found jsf target
viewId = " + viewId);
 
@@ -2304,7 +2315,7 @@ public class PortletExternalContextImpl
     return url;
   }
   
-  private void encodeFacesActionTarget(QueryString queryStr, String target)
+  private void encodeFacesActionTarget(QueryString queryStr, String target, String paramName)
   {
     // determine mode that we need to encode with this viewId
     String mode = queryStr.getParameter(Bridge.PORTLET_MODE_PARAMETER);
@@ -2320,7 +2331,7 @@ public class PortletExternalContextImpl
     }
     
     // put the viewId in the QueryStr.
-    queryStr.setParameter(JSF_TARGET_VIEWID_RENDER_PARAMETER,
+    queryStr.setParameter(paramName,
                           new StringBuffer(100).append(mode).append(':').append(target).toString());
   }
   



Mime
View raw message