1
14
15 package com.liferay.portal.struts;
16
17 import com.liferay.portal.kernel.util.InstancePool;
18
19 import javax.portlet.ActionRequest;
20 import javax.portlet.ActionResponse;
21 import javax.portlet.PortletConfig;
22 import javax.portlet.PortletRequest;
23 import javax.portlet.RenderRequest;
24 import javax.portlet.RenderResponse;
25
26 import org.apache.struts.action.ActionForm;
27 import org.apache.struts.action.ActionForward;
28 import org.apache.struts.action.ActionMapping;
29 import org.apache.struts.config.ModuleConfig;
30
31
36 public class DynamicPortletAction extends PortletAction {
37
38 public void processAction(
39 ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
40 ActionRequest actionRequest, ActionResponse actionResponse)
41 throws Exception {
42
43 ModuleConfig moduleConfig = getModuleConfig(actionRequest);
44
45 mapping = (ActionMapping)moduleConfig.findActionConfig(
46 getPath(actionRequest));
47
48 PortletAction action = (PortletAction)InstancePool.get(
49 mapping.getType());
50
51 action.processAction(
52 mapping, form, portletConfig, actionRequest, actionResponse);
53 }
54
55 public ActionForward render(
56 ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
57 RenderRequest renderRequest, RenderResponse renderResponse)
58 throws Exception {
59
60 ModuleConfig moduleConfig = getModuleConfig(renderRequest);
61
62 mapping = (ActionMapping)moduleConfig.findActionConfig(
63 getPath(renderRequest));
64
65 PortletAction action = (PortletAction)InstancePool.get(
66 mapping.getType());
67
68 return action.render(
69 mapping, form, portletConfig, renderRequest, renderResponse);
70 }
71
72 protected String getPath(PortletRequest portletRequest) throws Exception {
73 return null;
74 }
75
76 }