View Javadoc

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  package org.apache.struts.chain.commands.servlet;
17  
18  import org.apache.struts.action.Action;
19  import org.apache.struts.action.ActionForm;
20  import org.apache.struts.action.ActionMapping;
21  import org.apache.struts.chain.commands.AbstractExecuteAction;
22  import org.apache.struts.chain.contexts.ActionContext;
23  import org.apache.struts.chain.contexts.ServletActionContext;
24  import org.apache.struts.config.ActionConfig;
25  import org.apache.struts.config.ForwardConfig;
26  
27  /***
28   * <p>Invoke the appropriate <code>Action</code> for this request, and cache
29   * the returned <code>ActionForward</code>.</p>
30   *
31   * @version $Rev: 421119 $ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005)
32   *          $
33   */
34  public class ExecuteAction extends AbstractExecuteAction {
35      // ------------------------------------------------------- Protected Methods
36  
37      /***
38       * <p>Execute the specified <code>Action</code>, and return the resulting
39       * <code>ActionForward</code>.</p>
40       *
41       * @param context      The <code>Context</code> for this request
42       * @param action       The <code>Action</code> to be executed
43       * @param actionConfig The <code>ActionConfig</code> defining this action
44       * @param actionForm   The <code>ActionForm</code> (if any) for this
45       *                     action
46       * @throws Exception if thrown by the <code>Action</code>
47       */
48      protected ForwardConfig execute(ActionContext context, Action action,
49          ActionConfig actionConfig, ActionForm actionForm)
50          throws Exception {
51          ServletActionContext saContext = (ServletActionContext) context;
52  
53          return (action.execute((ActionMapping) actionConfig, actionForm,
54              saContext.getRequest(), saContext.getResponse()));
55      }
56  }