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 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
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 |
0 |
{ |
51 |
0 |
this.windowAccessor = windowAccessor; |
52 |
0 |
} |
53 |
|
|
54 |
|
public void processActionMessage(String portletName, RequestContext jetspeedRequest) |
55 |
|
throws PortletException, IOException |
56 |
|
{ |
57 |
|
|
58 |
0 |
PortletContainerServices.prepare("Jetspeed"); |
59 |
|
|
60 |
0 |
PortletWindow window = windowAccessor.getPortletWindow("psd-1"); |
61 |
0 |
HttpServletRequest requestForWindow = jetspeedRequest.getRequestForWindow(window); |
62 |
0 |
HttpServletResponse responseForWindow = jetspeedRequest.getResponseForWindow(window); |
63 |
|
|
64 |
0 |
actionRequest = PortletObjectAccess.getActionRequest(window, requestForWindow, responseForWindow); |
65 |
0 |
actionResponse = PortletObjectAccess.getActionResponse(window, requestForWindow, responseForWindow); |
66 |
|
|
67 |
0 |
invoker = PortletInvokerAccess.getPortletInvoker(window.getPortletEntity().getPortletDefinition()); |
68 |
|
|
69 |
0 |
invoker.action(actionRequest, actionResponse); |
70 |
|
|
71 |
0 |
PortletContainerServices.release(); |
72 |
0 |
} |
73 |
|
|
74 |
|
} |