Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.struts.action
Class ActionRedirect  view ActionRedirect download ActionRedirect.java

java.lang.Object
  extended byorg.apache.struts.config.ForwardConfig
      extended byorg.apache.struts.action.ActionForward
          extended byorg.apache.struts.action.ActionRedirect
All Implemented Interfaces:
java.io.Serializable

public class ActionRedirect
extends ActionForward

A subclass of ActionForward which is designed for use in redirecting requests, with support for adding parameters at runtime.
An org.apache.struts.config.ForwardConfig (or subclass) can be passed to the constructor to copy its configuration:
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionRedirect redirect = new ActionRedirect(mapping.findForward("doRedirect")); redirect.addParameter("param1","value1"); redirect.addParameter("param2","2"); redirect.addParameter("param3","3.0"); return redirect; }

Since:
Struts 1.2.7
Version:
$Rev: 164747 $ $Date: 2005-04-26 06:47:48 +0100 (Tue, 26 Apr 2005) $

Field Summary
protected static org.apache.commons.logging.Log log
          Commons logging instance.
protected  java.util.Map parameterValues
          Holds the redirect parameters.
 
Fields inherited from class org.apache.struts.config.ForwardConfig
configured, contextRelative, module, name, path, redirect
 
Constructor Summary
ActionRedirect()
          Construct a new instance with redirect set to true and initialize parameter lists.
ActionRedirect(org.apache.struts.config.ForwardConfig baseConfig)
          Construct a new instance with a org.apache.struts.config.ForwardConfig object to copy name, path, and contextRelative values from.
ActionRedirect(java.lang.String path)
          Construct a new instance with the specified path and initialize parameter lists.
ActionRedirect(java.lang.String name, java.lang.String path, java.lang.String module)
          Construct a new instance with the specified values and initialize parameter lists.
 
Method Summary
 void addParameter(java.lang.String fieldName, java.lang.Object valueObj)
          Adds the object's toString() to the list of parameters if it's not null, or an empty string with the given fieldName if it is.
 java.lang.String getOriginalPath()
          Get the original path without the parameters added at runtime.
 java.lang.String getParameterString()
          Forms the string containing the parameters passed onto this object thru calls to addParameter().
 java.lang.String getPath()
          Get the path for this object, including any parameters that may have been added at runtime.
private  void initializeParameters()
          Initializes the internal objects used to hold parameter values.
 java.lang.String toString()
          Return a string description of this object.
 
Methods inherited from class org.apache.struts.config.ForwardConfig
freeze, getContextRelative, getModule, getName, getRedirect, setContextRelative, setModule, setName, setPath, setRedirect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log

Commons logging instance.


parameterValues

protected java.util.Map parameterValues

Holds the redirect parameters. Each entry is either a String or a String[] depending on whether it has one or more entries.

Constructor Detail

ActionRedirect

public ActionRedirect()

Construct a new instance with redirect set to true and initialize parameter lists.


ActionRedirect

public ActionRedirect(java.lang.String path)

Construct a new instance with the specified path and initialize parameter lists.


ActionRedirect

public ActionRedirect(java.lang.String name,
                      java.lang.String path,
                      java.lang.String module)

Construct a new instance with the specified values and initialize parameter lists.


ActionRedirect

public ActionRedirect(org.apache.struts.config.ForwardConfig baseConfig)

Construct a new instance with a org.apache.struts.config.ForwardConfig object to copy name, path, and contextRelative values from.

Method Detail

initializeParameters

private void initializeParameters()

Initializes the internal objects used to hold parameter values.


addParameter

public void addParameter(java.lang.String fieldName,
                         java.lang.Object valueObj)

Adds the object's toString() to the list of parameters if it's not null, or an empty string with the given fieldName if it is.


getOriginalPath

public java.lang.String getOriginalPath()

Get the original path without the parameters added at runtime.


getPath

public java.lang.String getPath()

Get the path for this object, including any parameters that may have been added at runtime.


getParameterString

public java.lang.String getParameterString()

Forms the string containing the parameters passed onto this object thru calls to addParameter().


toString

public java.lang.String toString()

Return a string description of this object.