001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.struts;
016    
017    import com.liferay.portal.kernel.struts.BaseStrutsAction;
018    
019    import javax.servlet.http.HttpServletRequest;
020    import javax.servlet.http.HttpServletResponse;
021    
022    import org.apache.struts.action.Action;
023    import org.apache.struts.action.ActionForm;
024    import org.apache.struts.action.ActionForward;
025    import org.apache.struts.action.ActionMapping;
026    
027    /**
028     * @author Mika Koivisto
029     */
030    public class StrutsActionAdapter extends BaseStrutsAction {
031    
032            public StrutsActionAdapter(
033                    Action action, ActionMapping actionMapping, ActionForm actionForm) {
034    
035                    _action = action;
036                    _actionMapping = actionMapping;
037                    _actionForm = actionForm;
038            }
039    
040            @Override
041            public String execute(
042                            HttpServletRequest request, HttpServletResponse response)
043                    throws Exception {
044    
045                    ActionForward actionForward = _action.execute(
046                            _actionMapping, _actionForm, request, response);
047    
048                    return actionForward.getPath();
049            }
050    
051            private Action _action;
052            private ActionForm _actionForm;
053            private ActionMapping _actionMapping;
054    
055    }