001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.struts;
016    
017    import com.liferay.portal.kernel.util.ClassResolverUtil;
018    import com.liferay.portal.kernel.util.MethodKey;
019    import com.liferay.portal.kernel.util.PortalClassInvoker;
020    
021    import javax.portlet.ActionRequest;
022    import javax.portlet.ActionResponse;
023    import javax.portlet.PortletConfig;
024    
025    /**
026     * @author Brian Wing Shun Chan
027     */
028    public class PortletActionInvoker {
029    
030            public static void processAction(
031                            String className, PortletConfig portletConfig,
032                            ActionRequest actionRequest, ActionResponse actionResponse)
033                    throws Exception {
034    
035                    MethodKey methodKey = new MethodKey(
036                            ClassResolverUtil.resolveByPortalClassLoader(className),
037                            "processAction",
038                            new Class<?>[] {
039                                    ClassResolverUtil.resolveByPortalClassLoader(
040                                            "org.apache.struts.action.ActionMapping"),
041                                    ClassResolverUtil.resolveByPortalClassLoader(
042                                            "org.apache.struts.action.ActionForm"),
043                                    PortletConfig.class, ActionRequest.class, ActionResponse.class
044                            });
045    
046                    PortalClassInvoker.invoke(
047                            true, methodKey, null, null, portletConfig, actionRequest,
048                            actionResponse);
049            }
050    
051    }