portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r333092 - in /portals/jetspeed-2/trunk: components/portal/src/java/org/apache/jetspeed/messaging/ components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/ src/webapp/WEB-INF/assembly/
Date Sun, 13 Nov 2005 18:41:53 GMT
Author: taylor
Date: Sun Nov 13 10:41:49 2005
New Revision: 333092

URL: http://svn.apache.org/viewcvs?rev=333092&view=rev
Log:
failed experiment in portlet messaging for actions
leaving this here for review purposes only

Added:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/messaging/PortletMessagingImpl.java
Modified:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/ActionValveImpl.java
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/messaging/PortletMessagingImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/messaging/PortletMessagingImpl.java?rev=333092&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/messaging/PortletMessagingImpl.java
(added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/messaging/PortletMessagingImpl.java
Sun Nov 13 10:41:49 2005
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+package org.apache.jetspeed.messaging;
+
+import java.io.IOException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.container.window.PortletWindowAccessor;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.pluto.PortletContainerServices;
+import org.apache.pluto.factory.PortletObjectAccess;
+import org.apache.pluto.invoker.PortletInvoker;
+import org.apache.pluto.invoker.PortletInvokerAccess;
+import org.apache.pluto.om.window.PortletWindow;
+
+
+/**
+ * Message 
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public class PortletMessagingImpl 
+{
+    private PortletWindowAccessor windowAccessor;
+    private PortletInvoker invoker;
+    private ActionRequest actionRequest;
+    private ActionResponse actionResponse;
+    
+    public PortletMessagingImpl(PortletWindowAccessor windowAccessor)
+    {
+        this.windowAccessor = windowAccessor;
+    }
+    
+    public void processActionMessage(String portletName, RequestContext jetspeedRequest)
+    throws PortletException, IOException
+    {
+        //RequestContext jetspeedRequest = (RequestContext)request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
+        PortletContainerServices.prepare("Jetspeed");
+
+        PortletWindow window = windowAccessor.getPortletWindow("psd-1");
+        HttpServletRequest requestForWindow = jetspeedRequest.getRequestForWindow(window);
       
+        HttpServletResponse responseForWindow = jetspeedRequest.getResponseForWindow(window);
+        
+        actionRequest = PortletObjectAccess.getActionRequest(window, requestForWindow, responseForWindow);
+        actionResponse = PortletObjectAccess.getActionResponse(window, requestForWindow,
responseForWindow); 
+        
+        invoker = PortletInvokerAccess.getPortletInvoker(window.getPortletEntity().getPortletDefinition());
+        
+        invoker.action(actionRequest, actionResponse);
+        
+        PortletContainerServices.release();
+    }
+    
+}

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/ActionValveImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/ActionValveImpl.java?rev=333092&r1=333091&r2=333092&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/ActionValveImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/ActionValveImpl.java
Sun Nov 13 10:41:49 2005
@@ -24,6 +24,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.container.window.PortletWindowAccessor;
+import org.apache.jetspeed.messaging.PortletMessagingImpl;
 import org.apache.jetspeed.om.common.portlet.MutablePortletEntity;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.Page;
@@ -55,10 +57,12 @@
 
     private static final Log log = LogFactory.getLog(ActionValveImpl.class);
     private PortletContainer container;
+    private PortletWindowAccessor windowAccessor;
     
-    public ActionValveImpl(PortletContainer container)
+    public ActionValveImpl(PortletContainer container, PortletWindowAccessor windowAccessor)
     {
         this.container = container;
+        this.windowAccessor = windowAccessor;
     }
 
     /**
@@ -76,12 +80,19 @@
                 HttpServletResponse response = request.getResponseForWindow(actionWindow);
                 HttpServletRequest requestForWindow = request.getRequestForWindow(actionWindow);
                 requestForWindow.setAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE,
request);
+                
+                //PortletMessagingImpl msg = new PortletMessagingImpl(windowAccessor);
+                
+                requestForWindow.setAttribute("JETSPEED_ACTION", request);
                 container.processPortletAction(
                     actionWindow,
                     requestForWindow,
                     response);
                 // The container redirects the client after PortletAction processing
                 // so there is no need to continue the pipeline
+                
+                //msg.processActionMessage("todo", request);
+                
                 responseCommitted = response.isCommitted();
                 request.setAttribute(PortalReservedParameters.PIPELINE, null); // clear the
pipeline
             }

Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml?rev=333092&r1=333091&r2=333092&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml Sun Nov 13 10:41:49
2005
@@ -91,6 +91,9 @@
    <constructor-arg>
    	<ref bean="org.apache.pluto.PortletContainer" />
    </constructor-arg>
+   <constructor-arg>   
+   	<ref bean="PortletWindowAccessor" />    
+   </constructor-arg>   
   </bean> 
   
   <bean id="portletValve"



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