portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msnickl...@apache.org
Subject [15/22] portals-pluto git commit: Some fixes for parameter handling problems
Date Mon, 16 Feb 2015 15:54:57 GMT
Some fixes for parameter handling problems


Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/bac65740
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/bac65740
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/bac65740

Branch: refs/heads/V3Prototype
Commit: bac6574077c9e72629b2f5b5cc4c563b9e2ebb1d
Parents: b46bff8
Author: Scott Nicklous <msnicklous@apache.org>
Authored: Wed Feb 11 20:00:19 2015 +0100
Committer: Scott Nicklous <msnicklous@apache.org>
Committed: Wed Feb 11 20:00:19 2015 +0100

----------------------------------------------------------------------
 .../container/impl/ResourceRequestImpl.java     |  5 ++-
 .../container/PortletURLProviderImpl.java       | 28 +++++++++++++++-
 .../driver/url/impl/RelativePortalURLImpl.java  |  2 +-
 .../driver/url/PortletParameterFactory.java     | 35 ++++++++++++++------
 4 files changed, 54 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/bac65740/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceRequestImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceRequestImpl.java
b/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceRequestImpl.java
index 4d87575..b6863ee 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceRequestImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceRequestImpl.java
@@ -102,16 +102,15 @@ public class ResourceRequestImpl extends ClientDataRequestImpl implements
Resour
       if (LOG.isDebugEnabled()) {
          Map<String, String[]> pmap = super.getParameterMap();
          StringBuffer txt = new StringBuffer(1024);
-         txt.append("Resource Request parameter map dump:\n");
+         txt.append("Resource Request parameter map dump:");
          for (String n : pmap.keySet()) {
-            txt.append("Name: " + n + ", Values: ");
+            txt.append("\nName: " + n + ", Values: ");
             String[] vals = pmap.get(n);
             String sep = "";
             for (String v : vals) {
                txt.append(sep + v);
                sep = ", ";
             }
-            txt.append("\n");
          }
          LOG.debug(txt.toString());
       }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/bac65740/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletURLProviderImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletURLProviderImpl.java
b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletURLProviderImpl.java
index a576644..44e890d 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletURLProviderImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletURLProviderImpl.java
@@ -86,7 +86,20 @@ public class PortletURLProviderImpl implements PortletURLProvider {
          txt.append(", URL target=").append(url.getTargetWindow());
          LOGGER.debug(txt.toString());
       }
-      
+
+      if (isTrace) {
+         StringBuilder txt = new StringBuilder("Before clearing parameters for window: ");
+         txt.append(window);
+         for (PortalURLParameter p : this.url.getParameters()) {
+            if (p.getWindowId().equals(window)) {
+               txt.append("\nName: ").append(p.getName());
+               txt.append(", Type: ").append(p.getType());
+               txt.append(", Values: ").append(Arrays.toString(p.getValues()));
+            }
+         }
+         LOGGER.debug(txt.toString());
+      }
+
       this.url.setTargetWindow(window);
       switch (type) {
       case ACTION:
@@ -119,6 +132,19 @@ public class PortletURLProviderImpl implements PortletURLProvider {
          txt.append(", target=").append(url.getTargetWindow());
          LOGGER.debug(txt.toString());
       }
+      
+      if (isDebug) {
+         StringBuilder txt = new StringBuilder("URL Parameters for window: ");
+         txt.append(window);
+         for (PortalURLParameter p : url.getParameters()) {
+            if (p.getWindowId().equals(window)) {
+               txt.append("\nName: ").append(p.getName());
+               txt.append(", Type: ").append(p.getType());
+               txt.append(", Values: ").append(Arrays.toString(p.getValues()));
+            }
+         }
+         LOGGER.debug(txt.toString());
+      }
       return url;
    }
 

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/bac65740/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/RelativePortalURLImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/RelativePortalURLImpl.java
b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/RelativePortalURLImpl.java
index b93e493..90d2c3b 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/RelativePortalURLImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/RelativePortalURLImpl.java
@@ -190,7 +190,7 @@ public class RelativePortalURLImpl implements PortalURL {
                if (isDebug) {
                   StringBuilder txt = new StringBuilder("Added private parameter: ");
                   txt.append(parm).append(", Values: ").append(Arrays.toString(parms.get(parm)));
-                  txt.append(parm).append(", Type: ").append(ptype);
+                  txt.append(", Type: ").append(ptype);
                   txt.append(", Clone ID: " + cloneId);
                   LOG.debug(txt.toString());
                }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/bac65740/pluto-portal-driver/src/main/java/org/apache/pluto/driver/url/PortletParameterFactory.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/url/PortletParameterFactory.java
b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/url/PortletParameterFactory.java
index be49fec..dbcb7ec 100644
--- a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/url/PortletParameterFactory.java
+++ b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/url/PortletParameterFactory.java
@@ -21,10 +21,12 @@ package org.apache.pluto.driver.url;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.pluto.driver.services.portal.PublicRenderParameterMapper;
+import org.apache.pluto.driver.url.PortalURL.URLType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,6 +48,13 @@ public class PortletParameterFactory {
    HashMap<String, ArrayList<PortalURLParameter>> wid2Action;
    HashMap<String, ArrayList<PortalURLParameter>> wid2Resource;
    
+   static final HashSet<PortalURL.URLType> actionTypes = new HashSet<PortalURL.URLType>();
+   static {
+      actionTypes.add(URLType.Action);
+      actionTypes.add(URLType.AjaxAction);
+      actionTypes.add(URLType.PartialAction);
+   }
+   
    public PortletParameterFactory(PortalURL url) {
       this.url = url;
    }
@@ -95,6 +104,8 @@ public class PortletParameterFactory {
    public Map<String, String[]> getPrivateParameterMap(String windowId) {
       HashMap<String, String[]> parameters = new HashMap<String, String[]>();
       processParams();
+      
+      boolean isV3 = url.isVersion3(windowId);
 
       // get the action or resource parameters
       
@@ -108,17 +119,19 @@ public class PortletParameterFactory {
          }
       }
       
-      // Now merge in the render parameters
-      
-      if (wid2Render.containsKey(windowId)) {
-         for (PortalURLParameter parm : wid2Render.get(windowId)) {
-            if (parameters.containsKey(parm.getName())) {
-               ArrayList<String> vals = 
-                     new ArrayList<String>(Arrays.asList(parameters.get(parm.getName())));
-               vals.addAll(Arrays.asList(parm.getValues()));
-               parameters.put(parm.getName(), vals.toArray(new String[0]));
-            } else {
-               parameters.put(parm.getName(), parm.getValues().clone());
+      // Now merge in the render parameters if we're not dealing with a V2 action
+
+      if (isV3 || !actionTypes.contains(url.getType())) {
+         if (wid2Render.containsKey(windowId)) {
+            for (PortalURLParameter parm : wid2Render.get(windowId)) {
+               if (parameters.containsKey(parm.getName())) {
+                  ArrayList<String> vals = 
+                        new ArrayList<String>(Arrays.asList(parameters.get(parm.getName())));
+                  vals.addAll(Arrays.asList(parm.getValues()));
+                  parameters.put(parm.getName(), vals.toArray(new String[0]));
+               } else {
+                  parameters.put(parm.getName(), parm.getValues().clone());
+               }
             }
          }
       }


Mime
View raw message