Class ForwardConfig
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ActionForward
A JavaBean representing the configuration information of a
<forward>
element from a Struts configuration file.
- Since:
- Struts 1.1
- Version:
- $Rev$ $Date: 2005-08-14 17:24:39 -0400 (Sun, 14 Aug 2005) $
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
The name of acommons-chain
catalog in whichcommand
should be looked up.protected String
The name of acommons-chain
command which should be looked up and executed before Struts dispatches control to the view represented by this config.protected boolean
Have the inheritance values for this class been applied?protected String
The name of the ForwardConfig that this object should inherit properties from.protected String
The prefix of the module to which thisForwardConfig
entry points, which must start with a slash ("/") character.protected String
The unique identifier of this forward, which is used to reference it inAction
classes.protected String
The URL to which thisForwardConfig
entry points, which must start with a slash ("/") character.protected boolean
Should a redirect be used to transfer control to the specified path?Fields inherited from class org.apache.struts.config.BaseConfig
configured
-
Constructor Summary
ConstructorDescriptionConstruct a new instance with default values.ForwardConfig
(String name, String path, boolean redirect) Construct a new instance with the specified values.ForwardConfig
(String name, String path, boolean redirect, String module) Construct a new instance with the specified values.ForwardConfig
(ForwardConfig copyMe) Construct a new instance based on the values of another ForwardConfig. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
checkCircularInheritance
(ModuleConfig moduleConfig, ActionConfig actionConfig) Traces the hierarchy of this object to check if any of the ancestors are extending this instance.getName()
getPath()
boolean
void
inheritFrom
(ForwardConfig config) Inherit values that have not been overridden from the provided config object.boolean
void
processExtends
(ModuleConfig moduleConfig, ActionConfig actionConfig) Inherit configuration information from the ForwardConfig that this instance is extending.void
setCatalog
(String catalog) void
setCommand
(String command) void
setExtends
(String inherit) void
void
void
void
setRedirect
(boolean redirect) 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
-
Field Details
-
inherit
The name of the ForwardConfig that this object should inherit properties from. -
extensionProcessed
protected boolean extensionProcessedHave the inheritance values for this class been applied? -
name
The unique identifier of this forward, which is used to reference it inAction
classes. -
path
The URL to which this
ForwardConfig
entry points, which must start with a slash ("/") character. It is interpreted according to the following rules:- If
contextRelative
property istrue
, the path is considered to be context-relative within the current web application (even if we are in a named module). It will be prefixed by the context path to create a server-relative URL. - If the
contextRelative
property is false, the path is considered to be the module-relative portion of the URL. It will be used as the replacement for the$P
marker in theforwardPattern
property defined on theControllerConfig
element for our current module. For the defaultforwardPattern
value of$C$M$P
, the resulting server-relative URL will be the concatenation of the context path, the module prefix, and thepath
from thisForwardConfig
.
- If
-
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 redirectShould a redirect be used to transfer control to the specified path? -
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
The name of a
commons-chain
catalog in whichcommand
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 thecommand
property.
-
-
Constructor Details
-
ForwardConfig
public ForwardConfig()Construct a new instance with default values. -
ForwardConfig
Construct a new instance with the specified values.- Parameters:
name
- Name of this forwardpath
- Path to which control should be forwarded or redirectedredirect
- Should we do a redirect?
-
ForwardConfig
Construct a new instance with the specified values.
- Parameters:
name
- Name of this forwardpath
- Path to which control should be forwarded or redirectedredirect
- Should we do a redirect?module
- Module prefix, if any
-
ForwardConfig
Construct a new instance based on the values of another ForwardConfig.
- Parameters:
copyMe
- A ForwardConfig instance to copy- Since:
- Struts 1.3.6
-
-
Method Details
-
getExtends
-
setExtends
-
isExtensionProcessed
public boolean isExtensionProcessed() -
getName
-
setName
-
getPath
-
setPath
-
getModule
-
setModule
-
getRedirect
public boolean getRedirect() -
setRedirect
public void setRedirect(boolean redirect) -
getCommand
-
setCommand
-
getCatalog
-
setCatalog
-
checkCircularInheritance
Traces the hierarchy of this object to check if any of the ancestors are extending this instance.
- Parameters:
moduleConfig
- TheModuleConfig
that this config is from.actionConfig
- TheActionConfig
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 ClassNotFoundException, IllegalAccessException, InstantiationException, 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:
ClassNotFoundException
IllegalAccessException
InstantiationException
InvocationTargetException
- See Also:
-
processExtends
public void processExtends(ModuleConfig moduleConfig, ActionConfig actionConfig) throws ClassNotFoundException, IllegalAccessException, InstantiationException, 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
- TheModuleConfig
that this config is from.actionConfig
- TheActionConfig
that this config is from, if applicable. This must be null for global forwards.- Throws:
ClassNotFoundException
IllegalAccessException
InstantiationException
InvocationTargetException
- See Also:
-
toString
Return a String representation of this object.
-