1 /* 2 * Copyright 2003,2004 The Apache Software Foundation. 3 * 4 * Licensed under the Apache 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.apache.org/licenses/LICENSE-2.0 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 17 package org.apache.struts.chain.servlet; 18 19 20 import org.apache.commons.chain.Context; 21 import org.apache.commons.chain.web.servlet.ServletWebContext; 22 import org.apache.struts.action.Action; 23 import org.apache.struts.action.ActionForm; 24 import org.apache.struts.action.ActionMapping; 25 import org.apache.struts.chain.AbstractExecuteAction; 26 import org.apache.struts.config.ActionConfig; 27 import org.apache.struts.config.ForwardConfig; 28 29 30 /** 31 * <p>Invoke the appropriate <code>Action</code> for this request, and cache 32 * the returned <code>ActionForward</code>.</p> 33 * 34 * @version $Rev: 54933 $ $Date: 2004-10-16 18:04:52 +0100 (Sat, 16 Oct 2004) $ 35 */ 36 37 public class ExecuteAction extends AbstractExecuteAction { 38 39 40 // ------------------------------------------------------- Protected Methods 41 42 43 /** 44 * <p>Execute the specified <code>Action</code>, and return the resulting 45 * <code>ActionForward</code>.</p> 46 * 47 * @param context The <code>Context</code> for this request 48 * @param action The <code>Action</code> to be executed 49 * @param actionConfig The <code>ActionConfig</code> defining this action 50 * @param actionForm The <code>ActionForm</code> (if any) for 51 * this action 52 * 53 * @exception Exception if thrown by the <code>Action</code> 54 */ 55 protected ForwardConfig execute(Context context, 56 Action action, 57 ActionConfig actionConfig, 58 ActionForm actionForm) 59 throws Exception { 60 61 ServletWebContext swcontext = (ServletWebContext) context; 62 return (action.execute((ActionMapping) actionConfig, 63 actionForm, 64 swcontext.getRequest(), 65 swcontext.getResponse())); 66 67 } 68 69 70 }