org.apache.struts.config
Class ForwardConfig

java.lang.Object
  extended by org.apache.struts.config.BaseConfig
      extended by org.apache.struts.config.ForwardConfig
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ActionForward

public class ForwardConfig
extends BaseConfig

A JavaBean representing the configuration information of a <forward> element from a Struts configuration file.

Since:
Struts 1.1
Version:
$Rev: 471754 $ $Date: 2005-08-14 17:24:39 -0400 (Sun, 14 Aug 2005) $
See Also:
Serialized Form

Field Summary
protected  java.lang.String catalog
          The name of a commons-chain catalog in which command should be looked up.
protected  java.lang.String command
          The name of a commons-chain command which should be looked up and executed before Struts dispatches control to the view represented by this config.
protected  boolean extensionProcessed
          Have the inheritance values for this class been applied?
protected  java.lang.String inherit
          The name of the ForwardConfig that this object should inherit properties from.
protected  java.lang.String module
          The prefix of the module to which this ForwardConfig entry points, which must start with a slash ("/") character.
protected  java.lang.String name
          The unique identifier of this forward, which is used to reference it in Action classes.
protected  java.lang.String path
          The URL to which this ForwardConfig entry points, which must start with a slash ("/") character.
protected  boolean redirect
          Should a redirect be used to transfer control to the specified path?
 
Fields inherited from class org.apache.struts.config.BaseConfig
configured
 
Constructor Summary
ForwardConfig()
          Construct a new instance with default values.
ForwardConfig(ForwardConfig copyMe)
          Construct a new instance based on the values of another ForwardConfig.
ForwardConfig(java.lang.String name, java.lang.String path, boolean redirect)
          Construct a new instance with the specified values.
ForwardConfig(java.lang.String name, java.lang.String path, boolean redirect, java.lang.String module)
          Construct a new instance with the specified values.
 
Method Summary
protected  boolean checkCircularInheritance(ModuleConfig moduleConfig, ActionConfig actionConfig)
          Traces the hierarchy of this object to check if any of the ancestors are extending this instance.
 java.lang.String getCatalog()
           
 java.lang.String getCommand()
           
 java.lang.String getExtends()
           
 java.lang.String getModule()
           
 java.lang.String getName()
           
 java.lang.String getPath()
           
 boolean getRedirect()
           
 void inheritFrom(ForwardConfig config)
          Inherit values that have not been overridden from the provided config object.
 boolean isExtensionProcessed()
           
 void processExtends(ModuleConfig moduleConfig, ActionConfig actionConfig)
          Inherit configuration information from the ForwardConfig that this instance is extending.
 void setCatalog(java.lang.String catalog)
           
 void setCommand(java.lang.String command)
           
 void setExtends(java.lang.String inherit)
           
 void setModule(java.lang.String module)
           
 void setName(java.lang.String name)
           
 void setPath(java.lang.String path)
           
 void setRedirect(boolean redirect)
           
 java.lang.String toString()
          Return a String representation of this object.
 
Methods inherited from class org.apache.struts.config.BaseConfig
copyProperties, freeze, getProperties, getProperty, inheritProperties, setProperties, setProperty, throwIfConfigured
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

inherit

protected java.lang.String inherit
The name of the ForwardConfig that this object should inherit properties from.


extensionProcessed

protected boolean extensionProcessed
Have the inheritance values for this class been applied?


name

protected java.lang.String name
The unique identifier of this forward, which is used to reference it in Action classes.


path

protected java.lang.String path

The URL to which this ForwardConfig entry points, which must start with a slash ("/") character. It is interpreted according to the following rules:


module

protected java.lang.String module

The prefix of the module to which this ForwardConfig entry points, which must start with a slash ("/") character.

Usage note: If a forward config is used in a hyperlink, and a module is specified, the path must lead to another action and not directly to a page. This is in keeping with rule that in a modular application all links must be to an action rather than a page.


redirect

protected boolean redirect
Should a redirect be used to transfer control to the specified path?


command

protected java.lang.String command

The name of a commons-chain command which should be looked up and executed before Struts dispatches control to the view represented by this config.


catalog

protected java.lang.String catalog

The name of a commons-chain catalog in which command should be looked up. If this value is undefined, then the command will be looked up in the "default" catalog. This value has no meaning except in the context of the command property.

Constructor Detail

ForwardConfig

public ForwardConfig()
Construct a new instance with default values.


ForwardConfig

public ForwardConfig(java.lang.String name,
                     java.lang.String path,
                     boolean redirect)
Construct a new instance with the specified values.

Parameters:
name - Name of this forward
path - Path to which control should be forwarded or redirected
redirect - Should we do a redirect?

ForwardConfig

public ForwardConfig(java.lang.String name,
                     java.lang.String path,
                     boolean redirect,
                     java.lang.String module)

Construct a new instance with the specified values.

Parameters:
name - Name of this forward
path - Path to which control should be forwarded or redirected
redirect - Should we do a redirect?
module - Module prefix, if any

ForwardConfig

public ForwardConfig(ForwardConfig copyMe)

Construct a new instance based on the values of another ForwardConfig.

Parameters:
copyMe - A ForwardConfig instance to copy
Since:
Struts 1.3.6
Method Detail

getExtends

public java.lang.String getExtends()

setExtends

public void setExtends(java.lang.String inherit)

isExtensionProcessed

public boolean isExtensionProcessed()

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getPath

public java.lang.String getPath()

setPath

public void setPath(java.lang.String path)

getModule

public java.lang.String getModule()

setModule

public void setModule(java.lang.String module)

getRedirect

public boolean getRedirect()

setRedirect

public void setRedirect(boolean redirect)

getCommand

public java.lang.String getCommand()

setCommand

public void setCommand(java.lang.String command)

getCatalog

public java.lang.String getCatalog()

setCatalog

public void setCatalog(java.lang.String catalog)

checkCircularInheritance

protected boolean checkCircularInheritance(ModuleConfig moduleConfig,
                                           ActionConfig actionConfig)

Traces the hierarchy of this object to check if any of the ancestors are extending this instance.

Parameters:
moduleConfig - The ModuleConfig that this config is from.
actionConfig - The ActionConfig that this config is from, if applicable. This parameter must be null if this forward config is a global forward.
Returns:
true if circular inheritance was detected.

inheritFrom

public void inheritFrom(ForwardConfig config)
                 throws java.lang.ClassNotFoundException,
                        java.lang.IllegalAccessException,
                        java.lang.InstantiationException,
                        java.lang.reflect.InvocationTargetException

Inherit values that have not been overridden from the provided config object. Subclasses overriding this method should verify that the given parameter is of a class that contains a property it is trying to inherit:

 if (config instanceof MyCustomConfig) {
     MyCustomConfig myConfig =
         (MyCustomConfig) config;

     if (getMyCustomProp() == null) {
         setMyCustomProp(myConfig.getMyCustomProp());
     }
 }
 

If the given config is extending another object, those extensions should be resolved before it's used as a parameter to this method.

Parameters:
config - The object that this instance will be inheriting its values from.
Throws:
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
See Also:
processExtends(ModuleConfig, ActionConfig)

processExtends

public void processExtends(ModuleConfig moduleConfig,
                           ActionConfig actionConfig)
                    throws java.lang.ClassNotFoundException,
                           java.lang.IllegalAccessException,
                           java.lang.InstantiationException,
                           java.lang.reflect.InvocationTargetException

Inherit configuration information from the ForwardConfig that this instance is extending. This method verifies that any forward config object that it inherits from has also had its processExtends() method called.

Parameters:
moduleConfig - The ModuleConfig that this config is from.
actionConfig - The ActionConfig that this config is from, if applicable. This must be null for global forwards.
Throws:
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
See Also:
inheritFrom(ForwardConfig)

toString

public java.lang.String toString()
Return a String representation of this object.

Overrides:
toString in class java.lang.Object


Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.