1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.struts.chain.commands;
22
23 import org.apache.struts.chain.contexts.ActionContext;
24 import org.apache.struts.config.ForwardConfig;
25
26 /**
27 * <p>Perform forwarding or redirection based on the specified
28 * <code>ForwardConfig</code> (if any).</p>
29 *
30 * @version $Rev: 471754 $ $Date: 2005-06-04 10:58:46 -0400 (Sat, 04 Jun 2005)
31 * $
32 */
33 public abstract class AbstractPerformForward extends ActionCommandBase {
34
35
36 /**
37 * <p>Perform forwarding or redirection based on the specified
38 * <code>ActionForward</code> (if any).</p>
39 *
40 * @param actionCtx The <code>Context</code> for the current request
41 * @return <code>true</code> so that processing completes
42 * @throws Exception if thrown by the <code>Action</code>
43 */
44 public boolean execute(ActionContext actionCtx)
45 throws Exception {
46
47 ForwardConfig forwardConfig = actionCtx.getForwardConfig();
48
49 if (forwardConfig == null) {
50 return (false);
51 }
52
53
54 perform(actionCtx, forwardConfig);
55
56 return (true);
57 }
58
59
60
61 /**
62 * <p>Perform the appropriate processing on the specified
63 * <code>ForwardConfig</code>.</p>
64 *
65 * @param context The context for this request
66 * @param forwardConfig The forward to be performed
67 * @throws Exception if thrown by the <code>Action</code>
68 */
69 protected abstract void perform(ActionContext context,
70 ForwardConfig forwardConfig)
71 throws Exception;
72 }