1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.messaging;
18
19 import java.io.IOException;
20
21 import javax.portlet.ActionRequest;
22 import javax.portlet.ActionResponse;
23 import javax.portlet.PortletException;
24 import javax.servlet.http.HttpServletRequest;
25 import javax.servlet.http.HttpServletResponse;
26
27 import org.apache.jetspeed.container.window.PortletWindowAccessor;
28 import org.apache.jetspeed.request.RequestContext;
29 import org.apache.pluto.PortletContainerServices;
30 import org.apache.pluto.factory.PortletObjectAccess;
31 import org.apache.pluto.invoker.PortletInvoker;
32 import org.apache.pluto.invoker.PortletInvokerAccess;
33 import org.apache.pluto.om.window.PortletWindow;
34
35
36 /***
37 * Message
38 *
39 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
40 * @version $Id: $
41 */
42 public class PortletMessagingImpl
43 {
44 private PortletWindowAccessor windowAccessor;
45 private PortletInvoker invoker;
46 private ActionRequest actionRequest;
47 private ActionResponse actionResponse;
48
49 public PortletMessagingImpl(PortletWindowAccessor windowAccessor)
50 {
51 this.windowAccessor = windowAccessor;
52 }
53
54 public void processActionMessage(String portletName, RequestContext jetspeedRequest)
55 throws PortletException, IOException
56 {
57
58 PortletContainerServices.prepare("Jetspeed");
59
60 PortletWindow window = windowAccessor.getPortletWindow("psd-1");
61 HttpServletRequest requestForWindow = jetspeedRequest.getRequestForWindow(window);
62 HttpServletResponse responseForWindow = jetspeedRequest.getResponseForWindow(window);
63
64 actionRequest = PortletObjectAccess.getActionRequest(window, requestForWindow, responseForWindow);
65 actionResponse = PortletObjectAccess.getActionResponse(window, requestForWindow, responseForWindow);
66
67 invoker = PortletInvokerAccess.getPortletInvoker(window.getPortletEntity().getPortletDefinition());
68
69 invoker.action(actionRequest, actionResponse);
70
71 PortletContainerServices.release();
72 }
73
74 }