portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r541420 - in /portals/jetspeed-2/trunk: components/portal/src/java/org/apache/jetspeed/aggregator/impl/ components/portal/src/java/org/apache/jetspeed/container/state/impl/ components/portal/src/java/org/apache/jetspeed/request/ components/...
Date Thu, 24 May 2007 20:27:27 GMT
Author: taylor
Date: Thu May 24 13:27:17 2007
New Revision: 541420

URL: http://svn.apache.org/viewvc?view=rev&rev=541420
Log:
https://issues.apache.org/jira/browse/JS2-584
https://issues.apache.org/jira/browse/JS2-690


Added:
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/request-context-objects.xml
Modified:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/RenderingJobImpl.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/state/impl/SessionNavigationalState.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContext.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/mockobjects/request/MockRequestContext.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/request/RequestContext.java
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/jetspeed-spring.xml

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java?view=diff&rev=541420&r1=541419&r2=541420
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
Thu May 24 13:27:17 2007
@@ -472,7 +472,8 @@
         request.setAttribute(PortalReservedParameters.PAGE_ATTRIBUTE, requestContext.getPage());
         request.setAttribute(PortalReservedParameters.FRAGMENT_ATTRIBUTE, fragment);
         request.setAttribute(PortalReservedParameters.CONTENT_DISPATCHER_ATTRIBUTE, dispatcher);
-        request.setAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE, requestContext);
               
+        request.setAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE, requestContext);
+        request.setAttribute(PortalReservedParameters.REQUEST_CONTEXT_OBJECTS, requestContext.getObjects());
                       
         request.setAttribute(PortalReservedParameters.PATH_ATTRIBUTE, requestContext.getAttribute(PortalReservedParameters.PATH_ATTRIBUTE));
         request.setAttribute(PortalReservedParameters.PORTLET_WINDOW_ATTRIBUTE, portletWindow);
         
@@ -488,7 +489,8 @@
             workerAttrs.put(PortalReservedParameters.PAGE_ATTRIBUTE, requestContext.getPage());
             workerAttrs.put(PortalReservedParameters.FRAGMENT_ATTRIBUTE, fragment);
             workerAttrs.put(PortalReservedParameters.CONTENT_DISPATCHER_ATTRIBUTE, dispatcher);
-            workerAttrs.put(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE, requestContext);
       
+            workerAttrs.put(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE, requestContext);
+            workerAttrs.put(PortalReservedParameters.REQUEST_CONTEXT_OBJECTS, requestContext.getObjects());
                                   
             workerAttrs.put(PortalReservedParameters.PATH_ATTRIBUTE, requestContext.getAttribute(PortalReservedParameters.PATH_ATTRIBUTE));
             workerAttrs.put(PortalReservedParameters.PORTLET_WINDOW_ATTRIBUTE, portletWindow);
 

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/RenderingJobImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/RenderingJobImpl.java?view=diff&rev=541420&r1=541419&r2=541420
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/RenderingJobImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/RenderingJobImpl.java
Thu May 24 13:27:17 2007
@@ -237,6 +237,7 @@
             this.request.setAttribute(PortalReservedParameters.FRAGMENT_ATTRIBUTE, fragment);
             this.request.setAttribute(PortalReservedParameters.PAGE_ATTRIBUTE, requestContext.getPage());
             this.request.setAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE,
requestContext);
+            this.request.setAttribute(PortalReservedParameters.REQUEST_CONTEXT_OBJECTS, requestContext.getObjects());
           
           //  this.request.setAttribute(PortalReservedParameters.CONTENT_DISPATCHER_ATTRIBUTE,dispatcher);
             container.renderPortlet(this.window, this.request, this.response);          
    
             this.response.flushBuffer();                           

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/state/impl/SessionNavigationalState.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/state/impl/SessionNavigationalState.java?view=diff&rev=541420&r1=541419&r2=541420
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/state/impl/SessionNavigationalState.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/state/impl/SessionNavigationalState.java
Thu May 24 13:27:17 2007
@@ -53,6 +53,15 @@
             if (JetspeedActions.SOLO_STATE.equals(state))
             {
                 // skip *any* synchronizations when in SOLO state
+                HttpSession session = context.getRequest().getSession();
+                if ( session != null )
+                {
+                    PortletWindowSessionNavigationalStates sessionStates = (PortletWindowSessionNavigationalStates)session.getAttribute(NavigationalState.NAVSTATE_SESSION_KEY);
+                    if ( sessionStates != null )
+                    {
+                        sessionStates.removeFromCache(context, requestMaximizedWindowId,
cache);
+                    }
+                }
                 return;
             }
         }

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContext.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContext.java?view=diff&rev=541420&r1=541419&r2=541420
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContext.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContext.java
Thu May 24 13:27:17 2007
@@ -92,6 +92,7 @@
     private UserInfoManager userInfoMgr;
     private Map requestsForWindows;
     private Map responsesForWindows;
+    private final Map objects;
     
     /**
      * Create a new Request Context
@@ -104,6 +105,12 @@
     public JetspeedRequestContext( HttpServletRequest request, HttpServletResponse response,
ServletConfig config,
             UserInfoManager userInfoMgr )
     {
+        this(request, response, config, userInfoMgr, new HashMap());
+    }
+
+    public JetspeedRequestContext( HttpServletRequest request, HttpServletResponse response,
ServletConfig config,
+            UserInfoManager userInfoMgr, Map objects)
+    {
         this.request = request;
         this.response = response;
         this.config = config;
@@ -111,6 +118,7 @@
         this.userInfoMgr = userInfoMgr;
         this.requestsForWindows = new HashMap();
         this.responsesForWindows = new HashMap();
+        this.objects = objects;
 
         // set context in Request for later use
         if (null != this.request)
@@ -137,9 +145,9 @@
                 // to the original request.
                 this.request = new HttpServletRequestWrapper(this.request);
             }
-        }
+        }        
     }
-
+    
     public HttpServletRequest getRequest()
     {
         return request;
@@ -670,4 +678,8 @@
         return null;
     }    
 
+    public Map getObjects()
+    {
+        return objects;
+    }
 }

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java?view=diff&rev=541420&r1=541419&r2=541420
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java
Thu May 24 13:27:17 2007
@@ -17,6 +17,8 @@
 package org.apache.jetspeed.request;
 
 import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.servlet.ServletConfig;
 import javax.servlet.http.HttpServletRequest;
@@ -42,12 +44,14 @@
     /** The user info manager. */
     private UserInfoManager userInfoMgr;
     private ThreadLocal tlRequestContext = new ThreadLocal();
-
+    private Map requestContextObjects;
+    
     private final static Log log = LogFactory.getLog(JetspeedRequestContextComponent.class);
 
     public JetspeedRequestContextComponent(String contextClassName)
     {
         this.contextClassName = contextClassName;
+        this.requestContextObjects = new HashMap();
     }
 
     public JetspeedRequestContextComponent(String contextClassName, 
@@ -55,8 +59,18 @@
     {
         this.contextClassName = contextClassName;
         this.userInfoMgr = userInfoMgr;
+        this.requestContextObjects = new HashMap();        
     }
 
+    public JetspeedRequestContextComponent(String contextClassName, 
+            UserInfoManager userInfoMgr,
+            Map requestContextObjects)
+    {
+        this.contextClassName = contextClassName;
+        this.userInfoMgr = userInfoMgr;
+        this.requestContextObjects = requestContextObjects;        
+    }
+    
     public RequestContext create(HttpServletRequest req, HttpServletResponse resp, ServletConfig
config)
     {
         RequestContext context = null;
@@ -74,18 +88,17 @@
                         HttpServletRequest.class,
                         HttpServletResponse.class,
                         ServletConfig.class,
-                        UserInfoManager.class});
-            context = (RequestContext) constructor.newInstance(new Object[] { req, resp,
config, userInfoMgr});
-
+                        UserInfoManager.class,
+                        Map.class});
+            context = (RequestContext) constructor.newInstance(new Object[] { req, resp,
config, userInfoMgr, requestContextObjects});
+                    
         }
         catch (Exception e)
         {
             String msg = "JetspeedRequestContextComponent: Failed to create a Class object
for RequestContext: " + e.toString();
             log.error(msg);
         }
-
-        tlRequestContext.set(context);
-        
+        tlRequestContext.set(context);        
         return context;
     }
 

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java?view=diff&rev=541420&r1=541419&r2=541420
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java
Thu May 24 13:27:17 2007
@@ -287,6 +287,7 @@
         ctx.put("windowStateNormal", WindowState.NORMAL);
         ctx.put("windowStateMinimized", WindowState.MINIMIZED);
         ctx.put("windowStateMaximized", WindowState.MAXIMIZED);
+        ctx.put("rco", requestContext.getObjects());
         StringBuffer appRoot = new StringBuffer();
         if (!requestContext.getPortalURL().isRelativeOnly())
         {

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java?view=diff&rev=541420&r1=541419&r2=541420
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java
Thu May 24 13:27:17 2007
@@ -39,6 +39,7 @@
     public static final String PAGE_EDIT_ACCESS_ATTRIBUTE = "org.apache.jetspeed.decoration.PageEditAccess";
     public static final String SESSION_KEY_SUBJECT = "org.apache.jetspeed.security.subject";
     public static final String REQUEST_CONTEXT_ATTRIBUTE = "org.apache.jetspeed.request.RequestContext";
+    public static final String REQUEST_CONTEXT_OBJECTS = "org.apache.jetspeed.request.RequestContextObjects";
     public static final String FRAGMENT_ATTRIBUTE = "org.apache.jetspeed.Fragment";
     public static final String MAXIMIZED_FRAGMENT_ATTRIBUTE = "org.apache.jetspeed.maximized.Fragment";
   
     public static final String MAXIMIZED_LAYOUT_ATTRIBUTE = "org.apache.jetspeed.maximized.Layout";

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/mockobjects/request/MockRequestContext.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/mockobjects/request/MockRequestContext.java?view=diff&rev=541420&r1=541419&r2=541420
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/mockobjects/request/MockRequestContext.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/mockobjects/request/MockRequestContext.java
Thu May 24 13:27:17 2007
@@ -65,6 +65,7 @@
     private HttpServletResponse response;
     private Object session;
     private Pipeline pipeline;
+    private Map objects;
     
     /* (non-Javadoc)
      * @see org.apache.jetspeed.request.RequestContext#getUserInfoMap(org.apache.pluto.om.common.ObjectID)
@@ -555,5 +556,15 @@
     public ContentPage locatePage(Profiler profiler, String nonProfiledPath)
     {
         return null;
+    }
+    
+    public Map getObjects()
+    {
+        return objects;
+    }
+    
+    public void setObjects(Map objects)
+    {
+        this.objects = objects;
     }
 }

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/request/RequestContext.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/request/RequestContext.java?view=diff&rev=541420&r1=541419&r2=541420
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/request/RequestContext.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/request/RequestContext.java
Thu May 24 13:27:17 2007
@@ -439,5 +439,13 @@
      *  @return A Content Page located by the profiler, or null if not found
      */
     ContentPage locatePage(Profiler profiler, String nonProfiledPath);
+    
+    /**
+     * Return a map of Jetspeed Request Context objects configured via Spring Map
+     * 
+     * @return a Map of request context objects
+     * @since 2.1.1
+     */
+    Map getObjects();
 }
 

Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/jetspeed-spring.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/jetspeed-spring.xml?view=diff&rev=541420&r1=541419&r2=541420
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/jetspeed-spring.xml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/jetspeed-spring.xml Thu May 24 13:27:17
2007
@@ -94,11 +94,14 @@
 
     <!-- Request Context -->
     <bean id="org.apache.jetspeed.request.RequestContextComponent" class="org.apache.jetspeed.request.JetspeedRequestContextComponent">
-        <constructor-arg>
+        <constructor-arg index='0'>
             <value>org.apache.jetspeed.request.JetspeedRequestContext</value>
         </constructor-arg>
-        <constructor-arg>
+        <constructor-arg index='1'>
             <ref bean="org.apache.jetspeed.userinfo.UserInfoManager" />
+        </constructor-arg>
+        <constructor-arg index='2'>
+        	<ref bean="RequestContextObjects" />
         </constructor-arg>
     </bean>
 

Added: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/request-context-objects.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/request-context-objects.xml?view=auto&rev=541420
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/request-context-objects.xml (added)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/request-context-objects.xml Thu May
24 13:27:17 2007
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<beans>
+    <!--  Request Context Objects will be populated into the Jetspeed Request Context
+          and are accessible in the vm context of templates in the "rco" variable, example:
+          $rco.get("myObject") 
+      -->
+    <bean id="RequestContextObjects" class="java.util.HashMap">
+        <constructor-arg index="0">
+            <map>
+            <!-- 
+                <entry key="myObject">
+                    <ref bean="org.me.MyObject" />
+                </entry>
+               -->  
+            </map>
+        </constructor-arg>
+    </bean>
+</beans>



---------------------------------------------------------------------
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