001: /*
002: * $Id: ActionForward.java 471754 2006-11-06 14:55:09Z husted $
003: *
004: * Licensed to the Apache Software Foundation (ASF) under one
005: * or more contributor license agreements. See the NOTICE file
006: * distributed with this work for additional information
007: * regarding copyright ownership. The ASF licenses this file
008: * to you under the Apache License, Version 2.0 (the
009: * "License"); you may not use this file except in compliance
010: * with the License. You may obtain a copy of the License at
011: *
012: * http://www.apache.org/licenses/LICENSE-2.0
013: *
014: * Unless required by applicable law or agreed to in writing,
015: * software distributed under the License is distributed on an
016: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017: * KIND, either express or implied. See the License for the
018: * specific language governing permissions and limitations
019: * under the License.
020: */
021: package org.apache.struts.action;
022:
023: import org.apache.struts.config.ForwardConfig;
024:
025: /**
026: * <p>An <strong>ActionForward</strong> represents a destination to which the
027: * controller, RequestProcessor, might be directed to perform a
028: * RequestDispatcher.forward or HttpServletResponse.sendRedirect to, as a
029: * result of processing activities of an Action class. Instances of this class
030: * may be created dynamically as necessary, or configured in association with
031: * an ActionMapping instance for named lookup of potentially multiple
032: * destinations for a particular mapping instance.</p>
033: *
034: * <p>An ActionForward has the following minimal set of properties. Additional
035: * properties can be provided as needed by subclassses.</p>
036: *
037: * <ul>
038: *
039: * <li><strong>contextRelative</strong> - Should the path value be interpreted
040: * as context-relative (instead of module-relative, if it starts with a '/'
041: * character? [false]</li>
042: *
043: * <li><strong>name</strong> - Logical name by which this instance may be
044: * looked up in relationship to a particular ActionMapping. </li>
045: *
046: * <li><strong>path</strong> - Module-relative or context-relative URI to
047: * which control should be forwarded, or an absolute or relative URI to which
048: * control should be redirected.</li>
049: *
050: * <li><strong>redirect</strong> - Set to true if the controller servlet
051: * should call HttpServletResponse.sendRedirect() on the associated path;
052: * otherwise false. [false]</li>
053: *
054: * </ul>
055: *
056: * <p>Since Struts 1.1 this class extends ForwardConfig and inherits the
057: * contextRelative property.
058: *
059: * <p><strong>NOTE</strong> - This class would have been deprecated and
060: * replaced by org.apache.struts.config.ForwardConfig except for the fact that
061: * it is part of the public API that existing applications are using.</p>
062: *
063: * @version $Rev: 471754 $ $Date: 2005-08-14 17:24:39 -0400 (Sun, 14 Aug 2005)
064: * $
065: */
066: public class ActionForward extends ForwardConfig {
067: /**
068: * <p>Construct a new instance with default values.</p>
069: */
070: public ActionForward() {
071: this (null, false);
072: }
073:
074: /**
075: * <p>Construct a new instance with the specified path.</p>
076: *
077: * @param path Path for this instance
078: */
079: public ActionForward(String path) {
080: this (path, false);
081: }
082:
083: /**
084: * <p>Construct a new instance with the specified <code>path</code> and
085: * <code>redirect</code> flag.</p>
086: *
087: * @param path Path for this instance
088: * @param redirect Redirect flag for this instance
089: */
090: public ActionForward(String path, boolean redirect) {
091: super ();
092: setName(null);
093: setPath(path);
094: setRedirect(redirect);
095: }
096:
097: /**
098: * <p>Construct a new instance with the specified <code>name</code>,
099: * <code>path</code> and <code>redirect</code> flag.</p>
100: *
101: * @param name Name of this instance
102: * @param path Path for this instance
103: * @param redirect Redirect flag for this instance
104: */
105: public ActionForward(String name, String path, boolean redirect) {
106: super ();
107: setName(name);
108: setPath(path);
109: setRedirect(redirect);
110: }
111:
112: /**
113: * <p>Construct a new instance with the specified values.</p>
114: *
115: * @param name Name of this forward
116: * @param path Path to which control should be forwarded or
117: * redirected
118: * @param redirect Should we do a redirect?
119: * @param module Module prefix, if any
120: */
121: public ActionForward(String name, String path, boolean redirect,
122: String module) {
123: super ();
124: setName(name);
125: setPath(path);
126: setRedirect(redirect);
127: setModule(module);
128: }
129:
130: /**
131: * <p>Construct a new instance based on the values of another
132: * ActionForward.</p>
133: *
134: * @param copyMe An ActionForward instance to copy
135: * @since Struts 1.2.1
136: */
137: public ActionForward(ActionForward copyMe) {
138: this(copyMe.getName(), copyMe.getPath(), copyMe.getRedirect(),
139: copyMe.getModule());
140: }
141: }
|