org.apache.struts.action
Class ActionMapping

java.lang.Object
  |
  +--org.apache.struts.action.ActionMapping
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ActionMappingBase, RequestActionMapping, SessionActionMapping

public class ActionMapping
extends java.lang.Object
implements java.io.Serializable

An ActionMapping represents the information that the controller servlet, ActionServlet, knows about the mapping of a particular request to an instance of a particular action class. The mapping is passed to the perform() method of the action class itself, enabling access to this information directly.

An ActionMapping has the following minimal set of properties. Additional properties can be added by a subclass, simply by providing appropriate public "getter" and "setter" methods.

Version:
$Revision: 1.2 $ $Date$
Author:
Craig R. McClanahan
See Also:
Serialized Form

Field Summary
protected  java.lang.String attribute
          The name of the request-scope or session-scope attribute under which our form bean, if any, will be created.
protected  java.lang.String forward
          The context relative path of the servlet or JSP resource (to be called via RequestDispatcher.forward()) that will process this request, rather than instantiating and calling the Action class that is specified by the type attribute.
protected  ActionForwards forwards
          The set of ActionForward objects associated with this mapping.
protected  java.lang.String include
          The context relative path of the servlet or JSP resource (to be called via RequestDispatcher.include()) that will process this request, rather than instantiating and calling the Action class that is specified by the type attribute.
protected  java.lang.String input
          The context-relative path of the input form to which control should be returned if a validation error is encountered.
protected  Action instance
          The initialized Action instance for this mapping.
protected  ActionMappings mappings
          The ActionMappings collection of which we are a part.
protected  java.lang.String multipartClass
          The fully qualified class name of the MultipartRequestHandler implementation class used to process multipart request data for this mapping
protected  java.lang.String name
          The name of the form bean, if any, associated with this action.
protected  java.lang.String parameter
          General purpose configuration parameter for this mapping.
protected  java.lang.String path
          The context-relative path of the submitted request, starting with a "/" character, and without the filename extension (if any), that is mapped to this action.
protected  java.lang.String prefix
          The parameter name prefix used to select parameters for this action.
protected  java.lang.String scope
          The identifier of the scope ("request" or "session") under which the form bean associated with this mapping, if any, should be created.
protected  java.lang.String suffix
          The parameter name suffix used to select parameters for this action.
protected  java.lang.String type
          The fully qualified Java class name of the Action implementation class to be used to process requests for this mapping.
protected  boolean unknown
          Should this action be the default for this application?
protected  boolean validate
          Should the validate() method of our form bean be called?
 
Constructor Summary
ActionMapping()
           
 
Method Summary
 void addForward(ActionForward forward)
          Add a new ActionForward associated with this mapping.
 ActionForm createFormInstance()
          Deprecated. Creation of ActionForm instances is now the responsibility of the controller servlet
 ActionForward findForward(java.lang.String name)
          Return the ActionForward with the specified name, if any; otherwise return null.
 java.lang.String[] findForwards()
          Return the logical names of all locally defined forwards for this mapping.
 java.lang.String getActionClass()
          Deprecated. Use getType() instead
 java.lang.String getAttribute()
          Return the attribute name for our form bean.
 java.lang.String getFormAttribute()
          Deprecated. Use getAttribute() instead
 java.lang.String getFormClass()
          Deprecated. Use the bean name to look up the corresponding ActionFormBean instead
 java.lang.String getFormPrefix()
          Deprecated. Use getPrefix() instead
 java.lang.String getFormScope()
          Deprecated. Use getScope() instead
 java.lang.String getFormSuffix()
          Deprecated. Use getSuffix() instead
 java.lang.String getForward()
          Return the forward path for this mapping.
 java.lang.String getInclude()
          Return the include path for this mapping.
 java.lang.String getInput()
          Return the input form path for this mapping.
 java.lang.String getInputForm()
          Deprecated. Use getInput() instead
 ActionMappings getMappings()
          Return the ActionMappings collection of which we are a part.
 java.lang.String getMultipartClass()
          Get the name of the class used to handle multipart request data
 java.lang.String getName()
          Return the name of the form bean for this mapping.
 java.lang.String getParameter()
          Return the general purpose configuation parameter for this mapping.
 java.lang.String getPath()
          Return the request URI path used to select this mapping.
 java.lang.String getPrefix()
          Return the parameter name prefix for this mapping.
 java.lang.String getScope()
          Return the attribute scope for this mapping.
 java.lang.String getSuffix()
          Return the parameter name suffix for this mapping.
 java.lang.String getType()
          Return the fully qualified Action class name.
 boolean getUnknown()
          Return the unknown flag for this mapping.
 boolean getValidate()
          Return the validate flag for this mapping.
 void removeForward(ActionForward forward)
          Remove a ActionForward associated with this mapping.
 void setActionClass(java.lang.String actionClass)
          Deprecated. Use setType(String) instead
 void setAttribute(java.lang.String attribute)
          Set the attribute name for our form bean.
 void setFormAttribute(java.lang.String formAttribute)
          Deprecated. Use setAttribute(String) instead
 void setFormClass(java.lang.String formClass)
          Deprecated. Modify the corresponding ActionFormBean instead
 void setFormPrefix(java.lang.String formPrefix)
          Deprecated. Use setPrefix(String) instead
 void setFormScope(java.lang.String formScope)
          Deprecated. Use setScope(String) instead
 void setFormSuffix(java.lang.String formSuffix)
          Deprecated. Use setSuffix(String) instead
 void setForward(java.lang.String forward)
          Set the forward path for this mapping.
 void setInclude(java.lang.String include)
          Set the include path for this mapping.
 void setInput(java.lang.String input)
          Set the input form path for this mapping.
 void setInputForm(java.lang.String inputForm)
          Deprecated. Use setInput(String) instead
 void setMappings(ActionMappings mappings)
          Set the ActionMappings collection of which we are a part.
 void setMultipartClass(java.lang.String multipartClass)
          Set the name of the class used to handle multipart request data
 void setName(java.lang.String name)
          Set the name of the form bean for this mapping.
 void setParameter(java.lang.String parameter)
          Set the general purpose configuration parameter for this mapping.
 void setPath(java.lang.String path)
          Set the request URI path used to select this mapping.
 void setPrefix(java.lang.String prefix)
          Set the parameter name prefix for this mapping.
 void setScope(java.lang.String scope)
          Set the attribute scope for this mapping.
 void setSuffix(java.lang.String suffix)
          Set the parameter name suffix for this mapping.
 void setType(java.lang.String type)
          Set the fully qualified Action class name.
 void setUnknown(boolean unknown)
          Set the unknown flag for this mapping.
 void setValidate(boolean validate)
          Set the validate flag for this mapping.
 java.lang.String toString()
          Return a String version of this mapping.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

attribute

protected java.lang.String attribute
The name of the request-scope or session-scope attribute under which our form bean, if any, will be created.

forward

protected java.lang.String forward
The context relative path of the servlet or JSP resource (to be called via RequestDispatcher.forward()) that will process this request, rather than instantiating and calling the Action class that is specified by the type attribute.

forwards

protected ActionForwards forwards
The set of ActionForward objects associated with this mapping.

include

protected java.lang.String include
The context relative path of the servlet or JSP resource (to be called via RequestDispatcher.include()) that will process this request, rather than instantiating and calling the Action class that is specified by the type attribute.

input

protected java.lang.String input
The context-relative path of the input form to which control should be returned if a validation error is encountered.

instance

protected Action instance
The initialized Action instance for this mapping.

mappings

protected ActionMappings mappings
The ActionMappings collection of which we are a part.

multipartClass

protected java.lang.String multipartClass
The fully qualified class name of the MultipartRequestHandler implementation class used to process multipart request data for this mapping

name

protected java.lang.String name
The name of the form bean, if any, associated with this action.

parameter

protected java.lang.String parameter
General purpose configuration parameter for this mapping.

path

protected java.lang.String path
The context-relative path of the submitted request, starting with a "/" character, and without the filename extension (if any), that is mapped to this action.

prefix

protected java.lang.String prefix
The parameter name prefix used to select parameters for this action.

scope

protected java.lang.String scope
The identifier of the scope ("request" or "session") under which the form bean associated with this mapping, if any, should be created.

suffix

protected java.lang.String suffix
The parameter name suffix used to select parameters for this action.

type

protected java.lang.String type
The fully qualified Java class name of the Action implementation class to be used to process requests for this mapping.

unknown

protected boolean unknown
Should this action be the default for this application?

validate

protected boolean validate
Should the validate() method of our form bean be called?
Constructor Detail

ActionMapping

public ActionMapping()
Method Detail

getActionClass

public java.lang.String getActionClass()
Deprecated. Use getType() instead

Return the action class name for this mapping.

setActionClass

public void setActionClass(java.lang.String actionClass)
Deprecated. Use setType(String) instead

Set the action class name for this mapping.
Parameters:
actionClass - The new action class name

getAttribute

public java.lang.String getAttribute()
Return the attribute name for our form bean.

setAttribute

public void setAttribute(java.lang.String attribute)
Set the attribute name for our form bean.
Parameters:
attribute - The new attribute name

getFormAttribute

public java.lang.String getFormAttribute()
Deprecated. Use getAttribute() instead

Return the form session attribute key for this mapping, if any.

setFormAttribute

public void setFormAttribute(java.lang.String formAttribute)
Deprecated. Use setAttribute(String) instead

Set the form session attribute key for this mapping.
Parameters:
formAttribute - The new form session attribute key

getFormClass

public java.lang.String getFormClass()
Deprecated. Use the bean name to look up the corresponding ActionFormBean instead

Return the form class name for this mapping.

setFormClass

public void setFormClass(java.lang.String formClass)
Deprecated. Modify the corresponding ActionFormBean instead

Set the form class name for this mapping.
Parameters:
formClass - The new form class name

getFormPrefix

public java.lang.String getFormPrefix()
Deprecated. Use getPrefix() instead

Return the form parameter name prefix for this mapping.

setFormPrefix

public void setFormPrefix(java.lang.String formPrefix)
Deprecated. Use setPrefix(String) instead

Set the form parameter name prefix for this mapping.
Parameters:
formPrefix - The new form prefix

getFormScope

public java.lang.String getFormScope()
Deprecated. Use getScope() instead

Return the scope within which our form bean will be accessed.

setFormScope

public void setFormScope(java.lang.String formScope)
Deprecated. Use setScope(String) instead

Set the scope within which our form bean will be accessed.
Parameters:
formScope - The new scope ("request" or "session")

getFormSuffix

public java.lang.String getFormSuffix()
Deprecated. Use getSuffix() instead

Return the form parameter name suffix for this mapping.

setFormSuffix

public void setFormSuffix(java.lang.String formSuffix)
Deprecated. Use setSuffix(String) instead

Set the form parameter name suffix for this mapping.
Parameters:
formSuffix - The new form suffix

getForward

public java.lang.String getForward()
Return the forward path for this mapping.

setForward

public void setForward(java.lang.String forward)
Set the forward path for this mapping.
Parameters:
forward - The forward path for this mapping

getInclude

public java.lang.String getInclude()
Return the include path for this mapping.

setInclude

public void setInclude(java.lang.String include)
Set the include path for this mapping.
Parameters:
include - The include path for this mapping

getInput

public java.lang.String getInput()
Return the input form path for this mapping.

setInput

public void setInput(java.lang.String input)
Set the input form path for this mapping.
Parameters:
input - The new input form path

getInputForm

public java.lang.String getInputForm()
Deprecated. Use getInput() instead

Return the input form URI for this mapping.

setInputForm

public void setInputForm(java.lang.String inputForm)
Deprecated. Use setInput(String) instead

Set the input form URI for this mapping.
Parameters:
inputForm - The new input form URI

getMappings

public ActionMappings getMappings()
Return the ActionMappings collection of which we are a part.

getMultipartClass

public java.lang.String getMultipartClass()
Get the name of the class used to handle multipart request data
Returns:
A fully qualified java class name representing the implementation of MultipartRequestHandler to use.

setMappings

public void setMappings(ActionMappings mappings)
Set the ActionMappings collection of which we are a part.
Parameters:
mappings - The new ActionMappings collection

setMultipartClass

public void setMultipartClass(java.lang.String multipartClass)
Set the name of the class used to handle multipart request data
Parameters:
multipartClass - The fully qualified class name representing the MultipartRequestHandler class to use. If null, the global class specified in "web.xml" will be used.

getName

public java.lang.String getName()
Return the name of the form bean for this mapping.

setName

public void setName(java.lang.String name)
Set the name of the form bean for this mapping.
Parameters:
name - The new name

getParameter

public java.lang.String getParameter()
Return the general purpose configuation parameter for this mapping.

setParameter

public void setParameter(java.lang.String parameter)
Set the general purpose configuration parameter for this mapping.
Parameters:
parameter - The new configuration parameter

getPath

public java.lang.String getPath()
Return the request URI path used to select this mapping.

setPath

public void setPath(java.lang.String path)
Set the request URI path used to select this mapping.
Parameters:
path - The new request URI path

getPrefix

public java.lang.String getPrefix()
Return the parameter name prefix for this mapping.

setPrefix

public void setPrefix(java.lang.String prefix)
Set the parameter name prefix for this mapping.
Parameters:
prefix - The new parameter name prefix

getScope

public java.lang.String getScope()
Return the attribute scope for this mapping.

setScope

public void setScope(java.lang.String scope)
Set the attribute scope for this mapping.
Parameters:
scope - The new attribute scope

getSuffix

public java.lang.String getSuffix()
Return the parameter name suffix for this mapping.

setSuffix

public void setSuffix(java.lang.String suffix)
Set the parameter name suffix for this mapping.
Parameters:
suffix - The new parameter name suffix

getType

public java.lang.String getType()
Return the fully qualified Action class name.

setType

public void setType(java.lang.String type)
Set the fully qualified Action class name.
Parameters:
type - The new class name

getUnknown

public boolean getUnknown()
Return the unknown flag for this mapping.

setUnknown

public void setUnknown(boolean unknown)
Set the unknown flag for this mapping.
Parameters:
unknown - The new unknown flag

getValidate

public boolean getValidate()
Return the validate flag for this mapping.

setValidate

public void setValidate(boolean validate)
Set the validate flag for this mapping.
Parameters:
validate - The new validate flag

addForward

public void addForward(ActionForward forward)
Add a new ActionForward associated with this mapping.
Parameters:
forward - The ActionForward to be added

createFormInstance

public ActionForm createFormInstance()
Deprecated. Creation of ActionForm instances is now the responsibility of the controller servlet

Create and return an initialized instance of our form class. If instantiation fails for any reason, null is returned.

findForward

public ActionForward findForward(java.lang.String name)
Return the ActionForward with the specified name, if any; otherwise return null. If there is no locally defined forwarding for the specified name, but a global forwards collection has been associated with this mapping, the global collection will also be searched before returning.
Parameters:
name - Name of the forward entry to be returned

findForwards

public java.lang.String[] findForwards()
Return the logical names of all locally defined forwards for this mapping. If there are no such forwards, a zero-length array is returned.

removeForward

public void removeForward(ActionForward forward)
Remove a ActionForward associated with this mapping.
Parameters:
forward - The ActionForward to be removed

toString

public java.lang.String toString()
Return a String version of this mapping.
Overrides:
toString in class java.lang.Object


Copyright © 2000-2001 - Apache Software Foundation