| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ModuleRelativeForwardAction |
|
| 3.0;3 |
| 1 | /* | |
| 2 | * Copyright 2007-2008 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.ServletException; | |
| 19 | import javax.servlet.http.HttpServletRequest; | |
| 20 | import javax.servlet.http.HttpServletResponse; | |
| 21 | ||
| 22 | import org.apache.struts.action.ActionForm; | |
| 23 | import org.apache.struts.action.ActionForward; | |
| 24 | import org.apache.struts.action.ActionMapping; | |
| 25 | import org.apache.struts.actions.ForwardAction; | |
| 26 | import org.apache.struts.util.MessageResources; | |
| 27 | ||
| 28 | /** | |
| 29 | * ForwardAction subclass that interprets path as module-relative | |
| 30 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 31 | */ | |
| 32 | 0 | public class ModuleRelativeForwardAction extends ForwardAction { |
| 33 | /** | |
| 34 | * The message resources for this package. | |
| 35 | */ | |
| 36 | 0 | protected static MessageResources messages = MessageResources.getMessageResources("org.apache.struts.actions.LocalStrings"); |
| 37 | ||
| 38 | /** | |
| 39 | * Process the specified HTTP request, and create the corresponding HTTP | |
| 40 | * response (or forward to another web component that will create it). | |
| 41 | * Return an <code>ActionForward</code> instance describing where and how | |
| 42 | * control should be forwarded, or <code>null</code> if the response has | |
| 43 | * already been completed. | |
| 44 | * | |
| 45 | * @param mapping The ActionMapping used to select this instance | |
| 46 | * @param form The optional ActionForm bean for this request (if any) | |
| 47 | * @param request The HTTP request we are processing | |
| 48 | * @param response The HTTP response we are creating | |
| 49 | * | |
| 50 | * @exception Exception if an error occurs | |
| 51 | */ | |
| 52 | public ActionForward execute( | |
| 53 | ActionMapping mapping, | |
| 54 | ActionForm form, | |
| 55 | HttpServletRequest request, | |
| 56 | HttpServletResponse response) throws Exception { | |
| 57 | ||
| 58 | // Create a RequestDispatcher the corresponding resource | |
| 59 | 0 | String path = mapping.getParameter(); |
| 60 | ||
| 61 | 0 | if (path == null) { |
| 62 | 0 | throw new ServletException(messages.getMessage("forward.path")); |
| 63 | } | |
| 64 | ||
| 65 | // Let the controller handle the request | |
| 66 | 0 | ActionForward retVal = new ActionForward(path); |
| 67 | ||
| 68 | 0 | return retVal; |
| 69 | } | |
| 70 | } |