org.apache.struts.config

Class ActionConfig

public class ActionConfig extends Object implements Serializable

A JavaBean representing the configuration information of an <action> element from a Struts module configuration file.

Since: Struts 1.1

Version: $Rev: 377805 $ $Date: 2006-02-14 19:26:15 +0000 (Tue, 14 Feb 2006) $

Field Summary
protected Stringattribute
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.
protected booleancancellable

Can this Action be cancelled?

protected booleanconfigured
Indicates if configuration of this component been completed.
protected HashMapexceptions
The set of exception handling configurations for this action, if any, keyed by the type property.
protected Stringforward
Context-relative path of the web application resource that will process this request via RequestDispatcher.forward(), instead of instantiating and calling the Action class specified by "type".
protected HashMapforwards
The set of local forward configurations for this action, if any, keyed by the name property.
protected Stringinclude
Context-relative path of the web application resource that will process this request via RequestDispatcher.include(), instead of instantiating and calling the Action class specified by "type".
protected Stringinput
Context-relative path of the input form to which control should be returned if a validation error is encountered.
protected ModuleConfigmoduleConfig
The module configuration with which we are associated.
protected StringmultipartClass
Fully qualified Java class name of the MultipartRequestHandler implementation class used to process multi-part request data for this Action.
protected Stringname
Name of the form bean, if any, associated with this Action.
protected Stringparameter
General purpose configuration parameter that can be used to pass extra information to the Action instance selected by this Action.
protected Stringpath
Context-relative path of the submitted request, starting with a slash ("/") character, and omitting any filename extension if extension mapping is being used.
protected Stringprefix
Prefix used to match request parameter names to form bean property names, if any.
protected String[]roleNames
The set of security role names used to authorize access to this Action, as an array for faster access.
protected Stringroles
Comma-delimited list of security role names allowed to request this Action.
protected Stringscope
Identifier of the scope ("request" or "session") within which our form bean is accessed, if any.
protected Stringsuffix
Suffix used to match request parameter names to form bean property names, if any.
protected Stringtype
Fully qualified Java class name of the Action class to be used to process requests for this mapping if the forward and include properties are not set.
protected booleanunknown
Indicates Action be configured as the default one for this module, when true.
protected booleanvalidate
Should the validate() method of the form bean associated with this action be called?
Method Summary
voidaddExceptionConfig(ExceptionConfig config)
Add a new ExceptionConfig instance to the set associated with this action.
voidaddForwardConfig(ForwardConfig config)
Add a new ForwardConfig instance to the set of global forwards associated with this action.
ExceptionConfigfindException(Class type)

Find and return the ExceptionConfig instance defining how Exceptions of the specified type should be handled.

ExceptionConfigfindExceptionConfig(String type)
Return the exception configuration for the specified type, if any; otherwise return null.
ExceptionConfig[]findExceptionConfigs()
Return the exception configurations for this action.
ForwardConfigfindForwardConfig(String name)
Return the forward configuration for the specified key, if any; otherwise return null.
ForwardConfig[]findForwardConfigs()
Return all forward configurations for this module.
voidfreeze()
Freeze the configuration of this action.
StringgetAttribute()
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.
booleangetCancellable()

Accessor for cancellable property

StringgetForward()
Returns context-relative path of the web application resource that will process this request.
StringgetInclude()
Context-relative path of the web application resource that will process this request.
StringgetInput()
Get the context-relative path of the input form to which control should be returned if a validation error is encountered.
ModuleConfiggetModuleConfig()
The module configuration with which we are associated.
StringgetMultipartClass()
Return the fully qualified Java class name of the MultipartRequestHandler implementation class used to process multi-part request data for this Action.
StringgetName()
Return name of the form bean, if any, associated with this Action.
StringgetParameter()
Return general purpose configuration parameter that can be used to pass extra information to the Action instance selected by this Action.
StringgetPath()
Return context-relative path of the submitted request, starting with a slash ("/") character, and omitting any filename extension if extension mapping is being used.
StringgetPrefix()
Retruns prefix used to match request parameter names to form bean property names, if any.
String[]getRoleNames()
Get array of security role names used to authorize access to this Action.
StringgetRoles()
StringgetScope()
Get the scope ("request" or "session") within which our form bean is accessed, if any.
StringgetSuffix()
Return suffix used to match request parameter names to form bean property names, if any.
StringgetType()
booleangetUnknown()
Determine whether Action is configured as the default one for this module.
booleangetValidate()
voidremoveExceptionConfig(ExceptionConfig config)
Remove the specified exception configuration instance.
voidremoveForwardConfig(ForwardConfig config)
Remove the specified forward configuration instance.
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 specified name.
voidsetCancellable(boolean cancellable)

Mutator for for cancellable property

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.
voidsetInput(String input)
Set 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 the MultipartRequestHandler implementation class used to process multi-part request data for this Action.
voidsetName(String name)
voidsetParameter(String parameter)
General purpose configuration parameter that can be used to pass extra information to the Action instance selected by this Action.
voidsetPath(String path)
Set context-relative path of the submitted request, starting with a slash ("/") character, and omitting any filename extension if extension mapping is being used.
voidsetPrefix(String prefix)
voidsetRoles(String roles)
voidsetScope(String scope)
voidsetSuffix(String suffix)
voidsetType(String type)
voidsetUnknown(boolean unknown)
voidsetValidate(boolean validate)
StringtoString()
Return a String representation of this object.

Field Detail

attribute

protected String 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.

cancellable

protected boolean cancellable

Can 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.

Since: Struts 1.2.9

configured

protected boolean configured
Indicates if configuration of this component been completed.

exceptions

protected HashMap exceptions
The set of exception handling configurations for this action, if any, keyed by the type property.

forward

protected String forward
Context-relative path of the web application resource that will process this request via RequestDispatcher.forward(), instead of instantiating and calling the Action class specified by "type". Exactly one of forward, include, or type must be specified.

forwards

protected HashMap forwards
The set of local forward configurations for this action, if any, keyed by the name property.

include

protected String include
Context-relative path of the web application resource that will process this request via RequestDispatcher.include(), instead of instantiating and calling the Action class specified by "type". Exactly one of forward, include, or type must be specified.

input

protected String 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.

moduleConfig

protected ModuleConfig moduleConfig
The module configuration with which we are associated.

multipartClass

protected String multipartClass
Fully qualified Java class name of the MultipartRequestHandler implementation class used to process multi-part request data for this Action.

name

protected String name
Name of the form bean, if any, associated with this Action.

parameter

protected String 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

protected String 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

protected String prefix
Prefix used to match request parameter names to form bean property names, if any.

roleNames

protected String[] roleNames
The set of security role names used to authorize access to this Action, as an array for faster access.

roles

protected String roles
Comma-delimited list of security role names allowed to request this Action.

scope

protected String scope
Identifier of the scope ("request" or "session") within which our form bean is accessed, if any.

suffix

protected String suffix
Suffix used to match request parameter names to form bean property names, if any.

type

protected String type
Fully qualified Java class name of the Action class to be used to process requests for this mapping if the forward and include properties are not set. Exactly one of forward, include, or type must be specified.

unknown

protected boolean unknown
Indicates Action be configured as the default one for this module, when true.

validate

protected boolean validate
Should the validate() method of the form bean associated with this action be called?

Method Detail

addExceptionConfig

public void addExceptionConfig(ExceptionConfig config)
Add a new ExceptionConfig instance 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

public void addForwardConfig(ForwardConfig config)
Add a new ForwardConfig instance 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

findException

public ExceptionConfig findException(Class type)

Find and return the ExceptionConfig instance defining how Exceptions of 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, return null.

Introduced in ActionMapping in Struts 1.1, but pushed up to ActionConfig in Struts 1.2.0.

Parameters: type Exception class for which to find a handler

Since: Struts 1.2.0

findExceptionConfig

public ExceptionConfig findExceptionConfig(String type)
Return the exception configuration for the specified type, if any; otherwise return null.

Parameters: type Exception class name to find a configuration for

findExceptionConfigs

public ExceptionConfig[] findExceptionConfigs()
Return the exception configurations for this action. If there are none, a zero-length array is returned.

findForwardConfig

public ForwardConfig findForwardConfig(String name)
Return the forward configuration for the specified key, if any; otherwise return null.

Parameters: name Name of the forward configuration to return

findForwardConfigs

public ForwardConfig[] 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.

getAttribute

public String 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.

getCancellable

public boolean getCancellable()

Accessor for cancellable property

Returns: True if Action can be cancelled

Since: Struts 1.2.9

getForward

public String 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.

getInclude

public String 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.

getInput

public String 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.

getModuleConfig

public ModuleConfig getModuleConfig()
The module configuration with which we are associated.

getMultipartClass

public String getMultipartClass()
Return the fully qualified Java class name of the MultipartRequestHandler implementation class used to process multi-part request data for this Action.

getName

public String getName()
Return name of the form bean, if any, associated with this Action.

getParameter

public String 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.

getPath

public String 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.

getPrefix

public String getPrefix()
Retruns prefix used to match request parameter names to form bean property names, if any.

getRoleNames

public String[] getRoleNames()
Get array of security role names used to authorize access to this Action.

getRoles

public String getRoles()

getScope

public String getScope()
Get the scope ("request" or "session") within which our form bean is accessed, if any.

getSuffix

public String getSuffix()
Return suffix used to match request parameter names to form bean property names, if any.

getType

public String getType()

getUnknown

public boolean getUnknown()
Determine whether Action is configured as the default one for this module.

getValidate

public boolean getValidate()

removeExceptionConfig

public void removeExceptionConfig(ExceptionConfig config)
Remove the specified exception configuration instance.

Parameters: config ExceptionConfig instance to be removed

Throws: IllegalStateException if this module configuration has been frozen

removeForwardConfig

public void removeForwardConfig(ForwardConfig config)
Remove the specified forward configuration instance.

Parameters: config ForwardConfig instance to be removed

Throws: IllegalStateException if this module configuration has been frozen

setAttribute

public void setAttribute(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 specified name.

Parameters: attribute the request-scope or session-scope attribute name under which our form bean is access.

setCancellable

public void setCancellable(boolean cancellable)

Mutator for for cancellable property

Parameters: cancellable

Since: Struts 1.2.9

setForward

public void setForward(String forward)
Set the context-relative path of the web application resource that will process this request. Exactly one of forward, include, or type must be specified.

Parameters: forward context-relative path of the web application resource that will process this request.

setInclude

public void setInclude(String include)
Set context-relative path of the web application resource that will process this request. Exactly one of forward, include, or type must be specified.

Parameters: include context-relative path of the web application resource that will process this request.

setInput

public void setInput(String input)
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.

setModuleConfig

public void setModuleConfig(ModuleConfig moduleConfig)
The module configuration with which we are associated.

setMultipartClass

public void setMultipartClass(String multipartClass)
Set the fully qualified Java class name of the MultipartRequestHandler implementation class used to process multi-part request data for this Action.

Parameters: multipartClass fully qualified class name of the MultipartRequestHandler implementation class.

setName

public void setName(String name)

Parameters: name name of the form bean associated with this Action.

setParameter

public void setParameter(String 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.

Parameters: parameter General purpose configuration parameter.

setPath

public void setPath(String path)
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.

setPrefix

public void setPrefix(String prefix)

Parameters: prefix Prefix used to match request parameter names to form bean property names, if any.

setRoles

public void setRoles(String roles)

setScope

public void setScope(String scope)

Parameters: scope scope ("request" or "session") within which our form bean is accessed, if any.

setSuffix

public void setSuffix(String suffix)

Parameters: suffix Suffix used to match request parameter names to form bean property names, if any.

setType

public void setType(String type)

setUnknown

public void setUnknown(boolean unknown)

Parameters: unknown Indicates Action is configured as the default one for this module, when true.

setValidate

public void setValidate(boolean validate)

toString

public String toString()
Return a String representation of this object.
Copyright B) 2000-2009 - The Apache Software Foundation