1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.struts.action;
19
20 import org.apache.struts.config.ForwardConfig;
21
22 /***
23 * <p>An <strong>ActionForward</strong> represents a destination to which the
24 * controller, RequestProcessor, might be directed to perform a
25 * RequestDispatcher.forward or HttpServletResponse.sendRedirect to, as a
26 * result of processing activities of an Action class. Instances of this class
27 * may be created dynamically as necessary, or configured in association with
28 * an ActionMapping instance for named lookup of potentially multiple
29 * destinations for a particular mapping instance.</p>
30 *
31 * <p>An ActionForward has the following minimal set of properties. Additional
32 * properties can be provided as needed by subclassses.</p>
33 *
34 * <ul>
35 *
36 * <li><strong>contextRelative</strong> - Should the path value be interpreted
37 * as context-relative (instead of module-relative, if it starts with a '/'
38 * character? [false]</li>
39 *
40 * <li><strong>name</strong> - Logical name by which this instance may be
41 * looked up in relationship to a particular ActionMapping. </li>
42 *
43 * <li><strong>path</strong> - Module-relative or context-relative URI to
44 * which control should be forwarded, or an absolute or relative URI to which
45 * control should be redirected.</li>
46 *
47 * <li><strong>redirect</strong> - Set to true if the controller servlet
48 * should call HttpServletResponse.sendRedirect() on the associated path;
49 * otherwise false. [false]</li>
50 *
51 * </ul>
52 *
53 * <p>Since Struts 1.1 this class extends ForwardConfig and inherits the
54 * contextRelative property.
55 *
56 * <p><strong>NOTE</strong> - This class would have been deprecated and
57 * replaced by org.apache.struts.config.ForwardConfig except for the fact that
58 * it is part of the public API that existing applications are using.</p>
59 *
60 * @version $Rev: 421119 $ $Date: 2005-08-14 17:24:39 -0400 (Sun, 14 Aug 2005)
61 * $
62 */
63 public class ActionForward extends ForwardConfig {
64 /***
65 * <p>Construct a new instance with default values.</p>
66 */
67 public ActionForward() {
68 this(null, false);
69 }
70
71 /***
72 * <p>Construct a new instance with the specified path.</p>
73 *
74 * @param path Path for this instance
75 */
76 public ActionForward(String path) {
77 this(path, false);
78 }
79
80 /***
81 * <p>Construct a new instance with the specified <code>path</code> and
82 * <code>redirect</code> flag.</p>
83 *
84 * @param path Path for this instance
85 * @param redirect Redirect flag for this instance
86 */
87 public ActionForward(String path, boolean redirect) {
88 super();
89 setName(null);
90 setPath(path);
91 setRedirect(redirect);
92 }
93
94 /***
95 * <p>Construct a new instance with the specified <code>name</code>,
96 * <code>path</code> and <code>redirect</code> flag.</p>
97 *
98 * @param name Name of this instance
99 * @param path Path for this instance
100 * @param redirect Redirect flag for this instance
101 */
102 public ActionForward(String name, String path, boolean redirect) {
103 super();
104 setName(name);
105 setPath(path);
106 setRedirect(redirect);
107 }
108
109 /***
110 * <p>Construct a new instance with the specified values.</p>
111 *
112 * @param name Name of this forward
113 * @param path Path to which control should be forwarded or
114 * redirected
115 * @param redirect Should we do a redirect?
116 * @param module Module prefix, if any
117 */
118 public ActionForward(String name, String path, boolean redirect,
119 String module) {
120 super();
121 setName(name);
122 setPath(path);
123 setRedirect(redirect);
124 setModule(module);
125 }
126
127 /***
128 * <p>Construct a new instance based on the values of another
129 * ActionForward.</p>
130 *
131 * @param copyMe An ActionForward instance to copy
132 * @since Struts 1.2.1
133 */
134 public ActionForward(ActionForward copyMe) {
135 this(copyMe.getName(), copyMe.getPath(), copyMe.getRedirect(),
136 copyMe.getModule());
137 }
138 }