View Javadoc

1   /**
2    * Copyright 2005-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.web;
17  
18  import javax.servlet.http.HttpServletRequest;
19  import javax.servlet.http.HttpServletResponse;
20  
21  import org.apache.struts.action.ActionForm;
22  import org.apache.struts.action.ActionForward;
23  import org.apache.struts.action.ActionMapping;
24  import org.kuali.rice.kew.api.KewApiConstants;
25  import org.kuali.rice.kns.web.struts.action.KualiAction;
26  
27  /**
28   * This is a description of what this class does - ewestfal don't forget to fill this in. 
29   * 
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   *
32   */
33  public abstract class KewKualiAction extends KualiAction {
34  	
35  	public static final String DEFAULT_MAPPING = "basic";
36  	
37  	@Override 
38  	protected String getReturnLocation(HttpServletRequest request, ActionMapping mapping) 
39      {
40      	String mappingPath = mapping.getPath();
41      	String basePath = getApplicationBaseUrl();
42          return basePath + KewApiConstants.WEBAPP_DIRECTORY + mappingPath + ".do";
43      }
44  
45  	@Override
46  	protected ActionForward defaultDispatch(ActionMapping mapping,
47  			ActionForm form, HttpServletRequest request,
48  			HttpServletResponse response) throws Exception {
49  		return start(mapping, form, request, response);
50  	}
51  	
52  	public ActionForward start(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception {
53  		return mapping.findForward(getDefaultMapping());
54  	}
55  	
56  	protected String getDefaultMapping() {
57  		return DEFAULT_MAPPING;
58  	}
59  	
60  }