Class ActionConfig
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ActionMapping
A JavaBean representing the configuration information of an
<action> element from a Struts module configuration
file.
- Since:
- Struts 1.1
- Version:
- $Rev$ $Date$
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IntegerAccepted page value for multi-page validation.
If two or more page values are accepted, then acceptPage is set minimum of them.
If multi-page validation is not use, acceptPage is not set.protected StringThe internal identification of this action mapping.protected StringThe request-scope or session-scope attribute name under which our form bean is accessed, if it is different from the form bean's specifiedname.protected booleanCan this Action be cancelled? [false]protected StringThe name of acommons-chaincatalog in whichcommandshould be sought.protected StringThe name of acommons-chaincommand which should be executed as part of the processing of this action.protected StringThe name of theDispatcherimplementation that will dispatch to the end point of this action.protected HashMap<String, ExceptionConfig> The set of exception handling configurations for this action, if any, keyed by thetypeproperty.protected booleanHave the inheritance values for this class been applied?protected StringContext-relative path of the web application resource that will process this request via RequestDispatcher.forward(), instead of instantiating and calling theActionclass specified by "type".protected HashMap<String, ForwardConfig> The set of local forward configurations for this action, if any, keyed by thenameproperty.protected StringContext-relative path of the web application resource that will process this request via RequestDispatcher.include(), instead of instantiating and calling theActionclass specified by "type".protected StringThe path of the ActionConfig that this object should inherit properties from.protected StringContext-relative path of the input form to which control should be returned if a validation error is encountered.protected ModuleConfigThe module configuration with which we are associated.protected StringFully qualified Java class name of theMultipartRequestHandlerimplementation class used to process multi-part request data for this Action.protected StringName of the form bean, if any, associated with this Action.protected StringGeneral purpose configuration parameter that can be used to pass extra information to the Action instance selected by this Action.protected StringContext-relative path of the submitted request, starting with a slash ("/") character, and omitting any filename extension if extension mapping is being used.protected StringIdentifies conditions for automatic form population with values from HTTP request.protected StringPrefix used to match request parameter names to form bean property names, if any.protected StringIdentifies conditions for automatic form reset.protected String[]The set of security role names used to authorize access to this Action, as an array for faster access.protected StringComma-delimited list of security role names allowed to request this Action.protected StringIdentifier of the scope ("request" or "session") within which our form bean is accessed, if any.protected StringSuffix used to match request parameter names to form bean property names, if any.protected StringFully qualified Java class name of theActionclass to be used to process requests for this mapping if theforwardandincludeproperties are not set.protected booleanIndicates Action be configured as the default one for this module, when true.protected booleanShould thevalidate()method of the form bean associated with this action be called?Fields inherited from class org.apache.struts.config.BaseConfig
configured -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExceptionConfig(ExceptionConfig config) Add a newExceptionConfiginstance to the set associated with this action.voidaddForwardConfig(ForwardConfig config) Add a newForwardConfiginstance to the set of global forwards associated with this action.protected booleancheckCircularInheritance(ModuleConfig moduleConfig) Traces the hierarchy of this object to check if any of the ancestors is extending this instance.findException(Class<?> type) Find and return theExceptionConfiginstance defining howExceptionsof the specified type should be handled.findExceptionConfig(String type) Return the exception configuration for the specified type, if any; otherwise returnnull.Return the exception configurations for this action.findForwardConfig(String name) Return the forward configuration for the specified key, if any; otherwise returnnull.Return all forward configurations for this module.voidfreeze()Freeze the configuration of this action.Returns accepted page value for multi-page validation.The internal name of this action mapping.Returns the request-scope or session-scope attribute name under which our form bean is accessed, if it is different from the form bean's specifiedname.booleanAccessor for cancellable propertyGet the name of acommons-chaincatalog in which a specified command should be sought.Get the name of acommons-chaincommand which should be executed as part of the processing of this action.final StringRetrieves the fully-qualified class name of theDispatcherimplementation that will dispatch to the this action.Returns thepathoractionIdof theActionConfigthat this object should inherit properties from.Returns context-relative path of the web application resource that will process this request.Context-relative path of the web application resource that will process this request.getInput()Get the context-relative path of the input form to which control should be returned if a validation error is encountered.The module configuration with which we are associated.Return the fully qualified Java class name of theMultipartRequestHandlerimplementation class used to process multi-part request data for this Action.getName()Return name of the form bean, if any, associated with this Action.Return general purpose configuration parameter that can be used to pass extra information to the Action instance selected by this Action.getPath()Return context-relative path of the submitted request, starting with a slash ("/") character, and omitting any filename extension if extension mapping is being used.final StringGets the comma-delimiated list of events that specify when this action should be populated.final String[]Gets the array of events names that specify when this action should be populated.Retruns prefix used to match request parameter names to form bean property names, if any.final StringgetReset()Gets the comma-delimiated list of events that specify when this action should be reset.final String[]Gets the array of events names that specify when this action should be reset.String[]Get array of security role names used to authorize access to this Action.getRoles()getScope()Get the scope ("request" or "session") within which our form bean is accessed, if any.Return suffix used to match request parameter names to form bean property names, if any.getType()booleanDetermine whether Action is configured as the default one for this module.booleanprotected voidinheritExceptionHandlers(ActionConfig baseConfig) Compare the exception handlers of this action with that of the given and copy those that are not present.protected voidinheritForwards(ActionConfig baseConfig) Compare the forwards of this action with that of the given and copy those that are not present.voidinheritFrom(ActionConfig config) Inherit values that have not been overridden from the provided config object.booleanfinal booleanDetermines whether this action is a singleton (one per module) or a prototype (one per request).voidprocessExtends(ModuleConfig moduleConfig) Inherit configuration information from the ActionConfig that this instance is extending.voidremoveExceptionConfig(ExceptionConfig config) Remove the specified exception configuration instance.voidremoveForwardConfig(ForwardConfig config) Remove the specified forward configuration instance.voidsetAcceptPage(Integer acceptPage) Set accepted page value for multi-page validation.voidsetActionId(String actionId) The internal name of this action mapping.voidsetAttribute(String attribute) Set the request-scope or session-scope attribute name under which our form bean is accessed, if it is different from the form bean's specifiedname.voidsetCancellable(boolean cancellable) Mutator for for cancellable propertyvoidsetCatalog(String catalog) Set the name of acommons-chaincatalog in which a specified command should be sought.voidsetCommand(String command) Set the name of acommons-chaincommand which should be executed as part of the processing of this action.final voidsetDispatcher(String dispatcher) Stores the fully-qualified class name of theDispatcherimplementation that will dispatch to the this action.voidsetExtends(String inherit) Set thepathoractionIdof theActionConfigthat this object should inherit properties from.voidsetForward(String forward) Set the context-relative path of the web application resource that will process this request.voidsetInclude(String include) Set context-relative path of the web application resource that will process this request.voidSet the context-relative path of the input form to which control should be returned if a validation error is encountered.voidsetModuleConfig(ModuleConfig moduleConfig) The module configuration with which we are associated.voidsetMultipartClass(String multipartClass) Set the fully qualified Java class name of theMultipartRequestHandlerimplementation class used to process multi-part request data for this Action.voidvoidsetParameter(String parameter) General purpose configuration parameter that can be used to pass extra information to the Action instance selected by this Action.voidSet context-relative path of the submitted request, starting with a slash ("/") character, and omitting any filename extension if extension mapping is being used.final voidsetPopulate(String populate) voidfinal voidvoidvoidfinal voidsetSingleton(boolean singleton) Stores whether this action is a singleton.voidvoidvoidsetUnknown(boolean unknown) voidsetValidate(boolean validate) toString()Return a String representation of this object.Methods inherited from class org.apache.struts.config.BaseConfig
copyProperties, getProperties, getProperty, inheritProperties, setProperties, setProperty, throwIfConfigured
-
Field Details
-
exceptions
The set of exception handling configurations for this action, if any, keyed by the
typeproperty. -
forwards
The set of local forward configurations for this action, if any, keyed by the
nameproperty. -
moduleConfig
The module configuration with which we are associated.
-
attribute
The request-scope or session-scope attribute name under which our form bean is accessed, if it is different from the form bean's specified
name. -
actionId
The internal identification of this action mapping. Identifications are not inheritable and must be unique within a module.
- Since:
- Struts 1.3.6
-
inherit
The path of the ActionConfig that this object should inherit properties from.
-
cancellable
protected boolean cancellableCan this Action be cancelled? [false]
By default, when an Action is cancelled, validation is bypassed and the Action should not execute the business operation. If a request tries to cancel an Action when cancellable is not set, a "InvalidCancelException" is thrown.
-
extensionProcessed
protected boolean extensionProcessedHave the inheritance values for this class been applied?
-
forward
Context-relative path of the web application resource that will process this request via RequestDispatcher.forward(), instead of instantiating and calling the
Actionclass specified by "type". Exactly one offorward,include, ortypemust be specified. -
include
Context-relative path of the web application resource that will process this request via RequestDispatcher.include(), instead of instantiating and calling the
Actionclass specified by "type". Exactly one offorward,include, ortypemust be specified. -
input
Context-relative path of the input form to which control should be returned if a validation error is encountered. Required if "name" is specified and the input bean returns validation errors.
-
multipartClass
Fully qualified Java class name of the
MultipartRequestHandlerimplementation class used to process multi-part request data for this Action. -
name
Name of the form bean, if any, associated with this Action.
-
parameter
General purpose configuration parameter that can be used to pass extra information to the Action instance selected by this Action. Struts does not itself use this value in any way.
-
path
Context-relative path of the submitted request, starting with a slash ("/") character, and omitting any filename extension if extension mapping is being used.
-
prefix
Prefix used to match request parameter names to form bean property names, if any.
-
roles
Comma-delimited list of security role names allowed to request this Action.
-
roleNames
The set of security role names used to authorize access to this Action, as an array for faster access.
-
scope
Identifier of the scope ("request" or "session") within which our form bean is accessed, if any.
-
reset
Identifies conditions for automatic form reset.
-
populate
Identifies conditions for automatic form population with values from HTTP request.
-
suffix
Suffix used to match request parameter names to form bean property names, if any.
-
type
Fully qualified Java class name of the
Actionclass to be used to process requests for this mapping if theforwardandincludeproperties are not set. Exactly one offorward,include, ortypemust be specified. -
unknown
protected boolean unknownIndicates Action be configured as the default one for this module, when true.
-
validate
protected boolean validateShould the
validate()method of the form bean associated with this action be called? -
command
The name of a
commons-chaincommand which should be executed as part of the processing of this action.- Since:
- Struts 1.3.0
-
catalog
The name of a
commons-chaincatalog in whichcommandshould be sought. If acommandis defined and this property is undefined, the "default" catalog will be used. This is likely to be infrequently used after a future release ofcommons-chainsupports a one-string expression of a catalog/chain combination.- Since:
- Struts 1.3.0
-
dispatcher
The name of theDispatcherimplementation that will dispatch to the end point of this action.- Since:
- Struts 1.4
-
acceptPage
Accepted page value for multi-page validation.
If two or more page values are accepted, then acceptPage is set minimum of them.
If multi-page validation is not use, acceptPage is not set. Then multi-page validation is disabled.- Since:
- Struts 1.4.1
-
-
Constructor Details
-
ActionConfig
public ActionConfig()
-
-
Method Details
-
getActionId
The internal name of this action mapping. If an action has a name, it may be used as a shortcut in a URI. For example, an action with an identification of "editPerson" may be internally forwarded as "editPerson?id=1" which will then resolve to the real URI path at execution time.
- Returns:
- the actionId
- Since:
- Struts 1.3.6
-
setActionId
The internal name of this action mapping. The name is not inheritable, may not contain a forward slash, and must be unique within a module.
- Parameters:
actionId- the action identifier- Throws:
IllegalStateException- if the configuration is frozenIllegalArgumentException- if the identifier contains a forward slash- Since:
- Struts 1.3.6
-
getModuleConfig
The module configuration with which we are associated.
-
setModuleConfig
The module configuration with which we are associated.
-
getAttribute
Returns the request-scope or session-scope attribute name under which our form bean is accessed, if it is different from the form bean's specified
name.- Returns:
- attribute name under which our form bean is accessed.
-
setAttribute
Set the request-scope or session-scope attribute name under which our form bean is accessed, if it is different from the form bean's specified
name.- Parameters:
attribute- the request-scope or session-scope attribute name under which our form bean is access.
-
getCancellable
public boolean getCancellable()Accessor for cancellable property
- Returns:
- True if Action can be cancelled
-
setCancellable
public void setCancellable(boolean cancellable) Mutator for for cancellable property
- Parameters:
cancellable-
-
getExtends
Returns the
pathoractionIdof theActionConfigthat this object should inherit properties from.- Returns:
- the path or action id of the action mapping that this object should inherit properties from.
-
setExtends
Set the
pathoractionIdof theActionConfigthat this object should inherit properties from.- Parameters:
inherit- the path or action id of the action mapping that this object should inherit properties from.
-
isExtensionProcessed
public boolean isExtensionProcessed() -
getForward
Returns context-relative path of the web application resource that will process this request.
- Returns:
- context-relative path of the web application resource that will process this request.
-
setForward
Set the context-relative path of the web application resource that will process this request. Exactly one of
forward,include, ortypemust be specified.- Parameters:
forward- context-relative path of the web application resource that will process this request.
-
getInclude
Context-relative path of the web application resource that will process this request.
- Returns:
- Context-relative path of the web application resource that will process this request.
-
setInclude
Set context-relative path of the web application resource that will process this request. Exactly one of
forward,include, ortypemust be specified.- Parameters:
include- context-relative path of the web application resource that will process this request.
-
getInput
Get the context-relative path of the input form to which control should be returned if a validation error is encountered.
- Returns:
- context-relative path of the input form to which control should be returned if a validation error is encountered.
-
setInput
Set the context-relative path of the input form to which control should be returned if a validation error is encountered. Required if "name" is specified and the input bean returns validation errors.
- Parameters:
input- context-relative path of the input form to which control should be returned if a validation error is encountered.
-
getMultipartClass
Return the fully qualified Java class name of the
MultipartRequestHandlerimplementation class used to process multi-part request data for this Action. -
setMultipartClass
Set the fully qualified Java class name of the
MultipartRequestHandlerimplementation class used to process multi-part request data for this Action.- Parameters:
multipartClass- fully qualified class name of theMultipartRequestHandlerimplementation class.
-
getName
Return name of the form bean, if any, associated with this Action.
-
setName
- Parameters:
name- name of the form bean associated with this Action.
-
getParameter
Return general purpose configuration parameter that can be used to pass extra information to the Action instance selected by this Action. Struts does not itself use this value in any way.
-
setParameter
General purpose configuration parameter that can be used to pass extra information to the Action instance selected by this Action. Struts does not itself use this value in any way.
- Parameters:
parameter- General purpose configuration parameter.
-
getPath
Return context-relative path of the submitted request, starting with a slash ("/") character, and omitting any filename extension if extension mapping is being used.
-
setPath
Set context-relative path of the submitted request, starting with a slash ("/") character, and omitting any filename extension if extension mapping is being used.
- Parameters:
path- context-relative path of the submitted request.
-
getPrefix
Retruns prefix used to match request parameter names to form bean property names, if any.
-
setPrefix
- Parameters:
prefix- Prefix used to match request parameter names to form bean property names, if any.
-
getRoles
-
setRoles
-
getRoleNames
Get array of security role names used to authorize access to this Action.
-
getScope
Get the scope ("request" or "session") within which our form bean is accessed, if any.
-
setScope
- Parameters:
scope- scope ("request" or "session") within which our form bean is accessed, if any.
-
getReset
Gets the comma-delimiated list of events that specify when this action should be reset.
- Since:
- Struts 1.4
- See Also:
-
getResetNames
Gets the array of events names that specify when this action should be reset.
- Since:
- Struts 1.4
- See Also:
-
setReset
- Parameters:
reset- the comma-delimited list of reset events- Since:
- Struts 1.4
- See Also:
-
getPopulate
Gets the comma-delimiated list of events that specify when this action should be populated.
- Since:
- Struts 1.4
- See Also:
-
getPopulateNames
Gets the array of events names that specify when this action should be populated.
- Since:
- Struts 1.4
- See Also:
-
setPopulate
- Parameters:
populate- the comma-delimited list of populate events- Since:
- Struts 1.4
- See Also:
-
isSingleton
public final boolean isSingleton()Determines whether this action is a singleton (one per module) or a prototype (one per request). Actions are defaulted to singletons unless otherwise specified.- Returns:
truefor singleton; otherwise prototype- Since:
- Struts 1.4
- See Also:
-
setSingleton
public final void setSingleton(boolean singleton) Stores whether this action is a singleton.- Parameters:
singleton-truefor singleton; otherwise prototype- Since:
- Struts 1.4
- See Also:
-
getSuffix
Return suffix used to match request parameter names to form bean property names, if any.
-
setSuffix
- Parameters:
suffix- Suffix used to match request parameter names to form bean property names, if any.
-
getType
-
setType
-
getUnknown
public boolean getUnknown()Determine whether Action is configured as the default one for this module.
-
setUnknown
public void setUnknown(boolean unknown) - Parameters:
unknown- Indicates Action is configured as the default one for this module, when true.
-
getValidate
public boolean getValidate() -
setValidate
public void setValidate(boolean validate) -
getCommand
Get the name of a
commons-chaincommand which should be executed as part of the processing of this action.- Returns:
- name of a
commons-chaincommand which should be executed as part of the processing of this action. - Since:
- Struts 1.3.0
-
getCatalog
Get the name of a
commons-chaincatalog in which a specified command should be sought. This is likely to be infrequently used after a future release ofcommons-chainsupports a one-string expression of a catalog/chain combination.- Returns:
- name of a
commons-chaincatalog in which a specified command should be sought. - Since:
- Struts 1.3.0
-
setCommand
Set the name of a
commons-chaincommand which should be executed as part of the processing of this action.- Parameters:
command- name of acommons-chaincommand which should be executed as part of the processing of this action.- Since:
- Struts 1.3.0
-
setCatalog
Set the name of a
commons-chaincatalog in which a specified command should be sought. This is likely to be infrequently used after a future release ofcommons-chainsupports a one-string expression of a catalog/chain combination.- Parameters:
catalog- name of acommons-chaincatalog in which a specified command should be sought.- Since:
- Struts 1.3.0
-
getDispatcher
Retrieves the fully-qualified class name of theDispatcherimplementation that will dispatch to the this action.- Returns:
- the dispatcher class name or
null - Since:
- Struts 1.4
- See Also:
-
setDispatcher
Stores the fully-qualified class name of theDispatcherimplementation that will dispatch to the this action.- Parameters:
dispatcher- the dispatcher class name- Throws:
IllegalStateException- if the configuration is frozen- Since:
- Struts 1.4
- See Also:
-
getAcceptPage
Returns accepted page value for multi-page validation.- Returns:
- Accepted page value for multi-page validation
- Since:
- Struts 1.4.1
-
setAcceptPage
Set accepted page value for multi-page validation.- Parameters:
acceptPage- Accepted page value for multi-page validation- Since:
- Struts 1.4.1
-
checkCircularInheritance
Traces the hierarchy of this object to check if any of the ancestors is extending this instance.
- Parameters:
moduleConfig- The configuration for the module being configured.- Returns:
- true if circular inheritance was detected.
-
inheritExceptionHandlers
protected void inheritExceptionHandlers(ActionConfig baseConfig) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException Compare the exception handlers of this action with that of the given and copy those that are not present.
- Parameters:
baseConfig- The action config to copy handlers from.- Throws:
ClassNotFoundExceptionIllegalAccessExceptionInstantiationExceptionInvocationTargetException- See Also:
-
inheritForwards
protected void inheritForwards(ActionConfig baseConfig) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException Compare the forwards of this action with that of the given and copy those that are not present.
- Parameters:
baseConfig- The action config to copy forwards from.- Throws:
ClassNotFoundExceptionIllegalAccessExceptionInstantiationExceptionInvocationTargetException- See Also:
-
addExceptionConfig
Add a new
ExceptionConfiginstance to the set associated with this action.- Parameters:
config- The new configuration instance to be added- Throws:
IllegalStateException- if this module configuration has been frozen
-
addForwardConfig
Add a new
ForwardConfiginstance to the set of global forwards associated with this action.- Parameters:
config- The new configuration instance to be added- Throws:
IllegalStateException- if this module configuration has been frozen
-
findExceptionConfig
Return the exception configuration for the specified type, if any; otherwise return
null.- Parameters:
type- Exception class name to find a configuration for
-
findExceptionConfigs
Return the exception configurations for this action. If there are none, a zero-length array is returned.
-
findException
Find and return the
ExceptionConfiginstance defining howExceptionsof the specified type should be handled. This is performed by checking local and then global configurations for the specified exception's class, and then looking up the superclass chain (again checking local and then global configurations). If no handler configuration can be found, returnnull.Introduced in
ActionMappingin Struts 1.1, but pushed up toActionConfigin Struts 1.2.0.- Parameters:
type- Exception class for which to find a handler- Since:
- Struts 1.2.0
-
findForwardConfig
Return the forward configuration for the specified key, if any; otherwise return
null.- Parameters:
name- Name of the forward configuration to return
-
findForwardConfigs
Return all forward configurations for this module. If there are none, a zero-length array is returned.
-
freeze
public void freeze()Freeze the configuration of this action.
- Overrides:
freezein classBaseConfig
-
inheritFrom
public void inheritFrom(ActionConfig 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
configis 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:
ClassNotFoundExceptionIllegalAccessExceptionInstantiationExceptionInvocationTargetException- See Also:
-
processExtends
public void processExtends(ModuleConfig moduleConfig) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException Inherit configuration information from the ActionConfig that this instance is extending. This method verifies that any action config object that it inherits from has also had its processExtends() method called.
- Parameters:
moduleConfig- TheModuleConfigthat this bean is from.- Throws:
ClassNotFoundExceptionIllegalAccessExceptionInstantiationExceptionInvocationTargetException- See Also:
-
removeExceptionConfig
Remove the specified exception configuration instance.
- Parameters:
config- ExceptionConfig instance to be removed- Throws:
IllegalStateException- if this module configuration has been frozen
-
removeForwardConfig
Remove the specified forward configuration instance.
- Parameters:
config- ForwardConfig instance to be removed- Throws:
IllegalStateException- if this module configuration has been frozen
-
toString
Return a String representation of this object.
-