001/**
002 * Copyright 2005-2015 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.kew.web;
017
018import javax.servlet.http.HttpServletRequest;
019import javax.servlet.http.HttpServletResponse;
020
021import org.apache.struts.action.ActionForm;
022import org.apache.struts.action.ActionForward;
023import org.apache.struts.action.ActionMapping;
024import org.kuali.rice.kew.api.KewApiConstants;
025import org.kuali.rice.kns.web.struts.action.KualiAction;
026
027/**
028 * This is a description of what this class does - ewestfal don't forget to fill this in. 
029 * 
030 * @author Kuali Rice Team (rice.collab@kuali.org)
031 *
032 */
033public abstract class KewKualiAction extends KualiAction {
034        
035        public static final String DEFAULT_MAPPING = "basic";
036        
037        @Override 
038        protected String getReturnLocation(HttpServletRequest request, ActionMapping mapping) 
039    {
040        String mappingPath = mapping.getPath();
041        String basePath = getApplicationBaseUrl();
042        return basePath + KewApiConstants.WEBAPP_DIRECTORY + mappingPath + ".do";
043    }
044
045        @Override
046        protected ActionForward defaultDispatch(ActionMapping mapping,
047                        ActionForm form, HttpServletRequest request,
048                        HttpServletResponse response) throws Exception {
049                return start(mapping, form, request, response);
050        }
051        
052        public ActionForward start(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception {
053                return mapping.findForward(getDefaultMapping());
054        }
055        
056        protected String getDefaultMapping() {
057                return DEFAULT_MAPPING;
058        }
059        
060}