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