myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfreed...@apache.org
Subject svn commit: r1225664 - 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 Thu, 29 Dec 2011 21:44:40 GMT
Author: mfreedman
Date: Thu Dec 29 21:44:39 2011
New Revision: 1225664

URL: http://svn.apache.org/viewvc?rev=1225664&view=rev
Log:
Added PS6 feature that allows bridge to be configured to encode action URLs to nonFaces targets
as portlet resourceURLs rather than as a portlet re nder URL.

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=1225664&r1=1225663&r2=1225664&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
Thu Dec 29 21:44:39 2011
@@ -140,6 +140,7 @@ public class BridgeImpl
   public static final String LOGGING_ENABLED = "org.apache.myfaces.portlet.faces.loggingEnabled";
   public static final String WRITE_BEHIND_RESPONSE = "org.apache.myfaces.portlet.faces.writeBehindResponse";
   public static final String MANAGE_SCOPE_FOR_FACES_CONSUMER = "manageScopeForFacesConsumer";
+  public static final String ENCODE_NONFACES_ACTION_AS_RESOURCE = "encodeNonFacesActionAsResource";
   
   // public so other parts of the impl can access the portletName to access portlet specific
context attrs
   public static final String PORTLET_NAME_ATTRIBUTE = "org.apache.myfaces.portlet.faces.portletName";
@@ -241,6 +242,26 @@ public class BridgeImpl
       {
         mManageScopeForFacesConsumer = Boolean.valueOf(s);
       }
+      
+    }
+
+    // Like mangescopeforfacesconsumer, encodeNopnFacesViewAsResource is an Oracle only
+    // config attribute and hence can't be preset by GenericFacesPortlet.  We need recognize
+    // here and preset because PortletExternalContextImpl which uses this doesn't have access
+    // to the portletConfig
+    if (portletContext.getAttribute("org.apache.myfaces.portlet.faces." + 
+                                  mPortletConfig.getPortletName() + "." + 
+                                  ENCODE_NONFACES_ACTION_AS_RESOURCE) == null)
+    {
+      String s = 
+        mPortletConfig.getInitParameter("org.apache.myfaces.portlet.faces." + 
+                                        ENCODE_NONFACES_ACTION_AS_RESOURCE);
+      if (s != null)
+      {
+        portletContext.setAttribute("org.apache.myfaces.portlet.faces." + 
+                                    mPortletConfig.getPortletName() + "." + 
+                                    ENCODE_NONFACES_ACTION_AS_RESOURCE, Boolean.valueOf(s));
+      }
     }
     
     

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=1225664&r1=1225663&r2=1225664&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
Thu Dec 29 21:44:39 2011
@@ -151,6 +151,8 @@ public class PortletExternalContextImpl
   private String mIncludedServletPath = null;
   private String mIncludedPathInfo = null;
   
+  private boolean mEncodeNonFacesActionAsResource = false;  
+  
   private boolean mUseIncludeAttributeServletDependencyWorkaround;
   
   @SuppressWarnings("unchecked")
@@ -182,6 +184,19 @@ public class PortletExternalContextImpl
     
     // Because determining the view accesses request parameters -- delay until its demanded
     // so clients can still set request character encoding.
+    
+    // Check for config parameter indicating how nonFaces views should be encoded in an encodeActionURL
to avoid
+    // use of isViewLink=false hack in ADF:goLink
+    Boolean b = 
+      (Boolean) mPortletContext.getAttribute("org.apache.myfaces.portlet.faces." + 
+                                                         mPortletName + 
+                                                         "." + 
+                                                         "encodeNonFacesActionAsResource");
+    
+    if (b != null)
+    {
+      mEncodeNonFacesActionAsResource = b.booleanValue();
+    }
   }
   
   /**
@@ -387,13 +402,17 @@ public class PortletExternalContextImpl
       {
       encodeFacesActionTarget(queryStr, viewId, (urlType != Bridge.PortletPhase.RESOURCE_PHASE)
? JSF_TARGET_VIEWID_RENDER_PARAMETER : JSF_TARGET_VIEWID_RESOURCE_PARAMETER);
       }
-      else
+      else if (!mEncodeNonFacesActionAsResource)
       {
         // URL points at non-Faces action
         // Non-JSF actions are renderURLs as we merely dispatch to them
         urlType = Bridge.PortletPhase.RENDER_PHASE;
         encodeNonFacesActionTarget(queryStr, path);
       }
+      else
+      {
+        return encodeResourceURL(url);
+      }
     }
     
     if (getPortletPhase() == Bridge.PortletPhase.RENDER_PHASE ||



Mime
View raw message