portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r1612750 - in /portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed: aggregator/impl/PortletAggregatorImpl.java request/JetspeedRequestContext.java
Date Wed, 23 Jul 2014 03:46:40 GMT
Author: taylor
Date: Wed Jul 23 03:46:40 2014
New Revision: 1612750

URL: http://svn.apache.org/r1612750
Log:
JS2-1298: allow fragments to be looked up by exact name, not with ContentFragment paths __

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContext.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorImpl.java?rev=1612750&r1=1612749&r2=1612750&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorImpl.java
Wed Jul 23 03:46:40 2014
@@ -16,15 +16,6 @@
  */
 package org.apache.jetspeed.aggregator.impl;
 
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.portlet.PortletMode;
-import javax.portlet.WindowState;
-
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.jetspeed.JetspeedActions;
@@ -42,6 +33,14 @@ import org.apache.jetspeed.request.Reque
 import org.apache.jetspeed.util.HeadElementUtils;
 import org.apache.jetspeed.util.KeyValue;
 
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * PortletAggregator builds the content required to render a single portlet.
  *

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContext.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContext.java?rev=1612750&r1=1612749&r2=1612750&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContext.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContext.java
Wed Jul 23 03:46:40 2014
@@ -646,7 +646,7 @@ public class JetspeedRequestContext impl
         if (window == null)
         {
             // ensure RootContentFragment is initialized
-            getPage().getRootFragment(); 
+            getPage().getRootFragment();
             ContentFragment fragment = getPage().getFragmentById(windowId);
             if (fragment == null)
             {
@@ -722,9 +722,19 @@ public class JetspeedRequestContext impl
                 }
             }
         }
-        
         PortletWindow window = null;
-        
+        if (portletUniqueName == null)
+        {
+            //  JS2-1298: allow fragments to be looked up by exact name, not with ContentFragment
paths __
+            ContentFragment fragment = getPage().getFragmentByFragmentId(windowId);
+            if (fragment != null) {
+                portletUniqueName = fragment.getName();
+                window = createPortletWindow(fragment);
+                registerInstantWindow(window.getWindowId(), portletUniqueName);
+                registerInstantWindow(windowId, portletUniqueName);
+                return window;
+            }
+        }
         if (portletUniqueName != null)
         {
             // dynamically create instantly rendered content fragment and window
@@ -735,40 +745,45 @@ public class JetspeedRequestContext impl
             
             if (register && !registered && window.isValid())
             {
-                if (session == null)
-                {
-                    session = getRequest().getSession(true);
-                }
-                
-                Map<String,Map<String,String>> pages = null;
-                
-                synchronized (session)
-                {
-                    pages = (Map<String,Map<String,String>>) session.getAttribute(INSTANT_WINDOWS_SESSION_KEY);
-                    
-                    if (pages == null)
-                    {
-                        pages = Collections.synchronizedMap(new HashMap<String,Map<String,String>>());
-                        session.setAttribute(INSTANT_WINDOWS_SESSION_KEY, pages);
-                    }
-                }
-                
-                String pageId = getPage().getId();
-                Map<String,String> instantWindows = pages.get(pageId);
-                
-                if (instantWindows == null)
-                {
-                    instantWindows = Collections.synchronizedMap(new HashMap<String,String>());
-                    pages.put(pageId, instantWindows);
-                }
-                
-                instantWindows.put(windowId, portletUniqueName);
+                registerInstantWindow(windowId, portletUniqueName);
             }
         }
         
         return window;
     }
-    
+
+    private void registerInstantWindow(String windowId, String portletUniqueName)
+    {
+        if (session == null)
+        {
+            session = getRequest().getSession(true);
+        }
+
+        Map<String,Map<String,String>> pages = null;
+
+        synchronized (session)
+        {
+            pages = (Map<String,Map<String,String>>) session.getAttribute(INSTANT_WINDOWS_SESSION_KEY);
+
+            if (pages == null)
+            {
+                pages = Collections.synchronizedMap(new HashMap<String,Map<String,String>>());
+                session.setAttribute(INSTANT_WINDOWS_SESSION_KEY, pages);
+            }
+        }
+
+        String pageId = getPage().getId();
+        Map<String,String> instantWindows = pages.get(pageId);
+
+        if (instantWindows == null)
+        {
+            instantWindows = Collections.synchronizedMap(new HashMap<String,String>());
+            pages.put(pageId, instantWindows);
+        }
+
+        instantWindows.put(windowId, portletUniqueName);
+    }
+
     @SuppressWarnings("unchecked")
     public void registerInstantlyCreatedPortletWindow(PortletWindow portletWindow)
     {



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message