org.apache.struts.action
Class ActionServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--org.apache.struts.action.ActionServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class ActionServlet
extends javax.servlet.http.HttpServlet

ActionServlet represents the "controller" in the Model-View-Controller (MVC) design pattern for web applications that is commonly known as "Model 2". This nomenclature originated with a description in the JavaServerPages Specification, version 0.92, and has persisted ever since (in the absence of a better name).

Generally, a "Model 2" application is architected as follows:

The standard version of ActionServlet implements the following logic for each incoming HTTP request. You can override some or all of this functionality by subclassing this servlet and implementing your own version of the processing.

The standard version of ActionServlet is configured based on the following servlet initialization parameters, which you will specify in the web application deployment descriptor (/WEB-INF/web.xml) for your application. Subclasses that specialize this servlet are free to define additional initialization parameters.

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

Field Summary
protected  FastHashMap actions
          The set of Action instances that have been created and initialized, keyed by the fully qualified Java class name.
protected  MessageResources application
          The resources object for our application resources (if any).
protected  int bufferSize
          The size in bytes of the buffer used to read files from a client upload
protected  java.lang.String config
          The context-relative path to our configuration resource.
protected  java.lang.String content
          The default content type and character encoding to be set on each response (may be overridden by forwarded-to resources).
protected  FastHashMap dataSources
          The JDBC data sources that has been configured for this application, if any, keyed by the servlet context attribute under which they are stored.
protected  int debug
          The debugging detail level for this servlet.
protected  java.util.Locale defaultLocale
          The default Locale for this server.
protected  java.lang.String factoryClass
          The Java class name of the MessageResourcesFactory class for the application message resources bundle.
protected  java.lang.String formBeanClass
          The Java class name of the ActionFormBean implementation class to use.
protected  ActionFormBeans formBeans
          The global ActionFormBean collection for this controller.
protected  java.lang.String forwardClass
          The Java class name of the ActionForward implementation class to use.
protected  ActionForwards forwards
          The global ActionForward collection for this controller.
protected  MessageResources internal
          The resources object for our internal resources.
protected  java.lang.String internalName
          The Java base name of our internal resources.
protected  boolean locale
          Should we create a java.util.Locale for this user, based on the HTTP headers of the request, if one is not present?
protected  java.lang.String mappingClass
          The Java class name of our ActionMapping implementation class.
protected  ActionMappings mappings
          The configured mappings for this web application, keyed by path.
protected  java.lang.String maxFileSize
          The maximum size allowed for a client upload.
protected  java.lang.String multipartClass
          The MultipartRequestHandler class name used for handling multipart form requests.
protected  boolean nocache
          Include the no-caching headers in our response?
protected  java.lang.String[] registrations
          The set of public identifiers, and corresponding resource names, for the versions of the configuration file DTDs that we know about.
protected  java.lang.String servletMapping
          The URL pattern to which we are mapped in our web application deployment descriptor.
protected  java.lang.String servletName
          The servlet name under which we are registered in our web application deployment descriptor.
protected  java.lang.String tempDir
          The directory used to store temporary files for the DiskMultipartRequestHandler multipart implementation
protected  boolean validate
          Are we using the new configuration file format?
protected  boolean validating
          Should we use a validating XML parser to read the configuration file?
 
Fields inherited from class javax.servlet.http.HttpServlet
HEADER_IFMODSINCE, HEADER_LASTMOD, LSTRING_FILE, lStrings, METHOD_DELETE, METHOD_GET, METHOD_HEAD, METHOD_OPTIONS, METHOD_POST, METHOD_PUT, METHOD_TRACE
 
Constructor Summary
ActionServlet()
           
 
Method Summary
 void addDataSource(java.lang.String key, javax.sql.DataSource dataSource)
          Add a data source object to be used by this application.
 void addFormBean(ActionFormBean formBean)
          Register a form bean definition to the set configured for this servlet.
 void addForward(ActionForward forward)
          Register a logical forwarding to the set configured for this servlet.
 void addMapping(ActionMapping mapping)
          Register a mapping to the set configured for this servlet.
 void addServletMapping(java.lang.String servletName, java.lang.String urlPattern)
          Remember a servlet mapping from our web application deployment descriptor, if it is for this servlet.
 void destroy()
          Gracefully shut down this controller servlet, releasing any resources that were allocated at initialization.
protected  void destroyActions()
          Gracefully shut down any action instances we have created.
protected  void destroyApplication()
          Gracefully terminate use of the application MessageResources (if any).
protected  void destroyDataSources()
          Gracefully terminate use of the data source associated with this application (if any).
protected  void destroyInternal()
          Gracefully terminate use of the internal MessageResources.
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process an HTTP "GET" request.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process an HTTP "POST" request.
 javax.sql.DataSource findDataSource(java.lang.String key)
          Return a JDBC data source associated with this application, if any.
 ActionFormBean findFormBean(java.lang.String name)
          Return the form bean definition associated with the specified logical name, if any; otherwise return null.
 ActionForward findForward(java.lang.String name)
          Return the forwarding associated with the specified logical name, if any; otherwise return null.
 ActionMapping findMapping(java.lang.String path)
          Return the mapping associated with the specified request path, if any; otherwise return null.
 int getBufferSize()
          Get the buffer size (how large of a chunk of data is recieved by the input stream at once) used for file uploading.
 int getDebug()
          Return the debugging detail level for this servlet.
 java.lang.String getFormBeanClass()
          Return the Java class name of the class used to instantiate ActionFormBean objects.
 java.lang.String getForwardClass()
          Return the Java class name of the class used to instantiate ActionForward objects.
 java.lang.String getMappingClass()
          Return the Java class name of the class used to instantiate ActionMapping objects.
 java.lang.String getMaxFileSize()
          Get the maximum file size.
 java.lang.String getMultipartClass()
          Get the class name of the MultipartRequestHandler implementation
 MessageResources getResources()
          Return the application resources for this web application, if any.
 java.lang.String getTempDir()
          Get the directory used to temporarily store form files
 void init()
          Initialize this servlet.
protected  void initActions()
          Initialize the collection of previously instantiated Action instances.
protected  void initApplication()
          Initialize the MessageResources bundle for this application, if any.
protected  void initDataSources()
          Initialize use of the data sources associated with this application (if any).
protected  void initDebug()
          Initialize the debugging detail level for this application.
protected  Digester initDigester(int detail)
          Construct and return a digester that uses the new configuration file format.
protected  Digester initDigesterOld(int detail)
          Construct and return a digester that uses the old configuration file format.
protected  void initInternal()
          Initialize our internal MessageResources bundle.
protected  void initMapping()
          Initialize the mapping information for this application.
protected  void initOther()
          Initialize other configuration parameters that have not yet been processed.
protected  void initServlet()
          Initialize the servlet mapping under which our controller servlet is being accessed.
protected  void initUpload()
          Initialize upload parameters and "bufferSize", "multipartClass", "maxFileSize", "tempDir"
 void log(java.lang.String message, int level)
          Log the specified message if the current debugging detail level for this servlet has been set to an equal or higher value.
protected  void process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process an HTTP request.
protected  Action processActionCreate(ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
          Create or retrieve the Action instance that will process this request, or null if no such Action instance can be created.
protected  ActionForm processActionForm(ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
          Retrieve and return the ActionForm bean associated with this mapping, creating and stashing one if necessary.
protected  void processActionForward(ActionForward forward, ActionMapping mapping, ActionForm formInstance, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Forward to the specified destination, by the specified mechanism, if an ActionForward instance was returned by the Action.
protected  ActionForward processActionPerform(Action action, ActionMapping mapping, ActionForm formInstance, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Ask the specified Action instance to handle this request.
protected  void processContent(javax.servlet.http.HttpServletResponse response)
          Set the default content type (with optional character encoding) for all responses.
protected  boolean processForward(ActionMapping mapping, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process a forward requested by this mapping, if any.
protected  boolean processInclude(ActionMapping mapping, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process an include requested by this mapping, if any.
protected  void processLocale(javax.servlet.http.HttpServletRequest request)
          Automatically calculate an appropriate java.util.Locale for this user, and store it in their session, if there is no such Locale object present already.
protected  ActionMapping processMapping(java.lang.String path, javax.servlet.http.HttpServletRequest request)
          Identify and return an appropriate ActionMapping for the specified path.
protected  void processNoCache(javax.servlet.http.HttpServletResponse response)
          Render the HTTP headers to defeat browser caching if requested.
protected  java.lang.String processPath(javax.servlet.http.HttpServletRequest request)
          Identify and return the path component (from the request URI) that we will use to select an ActionMapping to dispatch with.
protected  void processPopulate(ActionForm formInstance, ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
          Populate the properties of the specified ActionForm from the request parameters included with this request.
protected  boolean processPreprocess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          General purpose preprocessing hook that can be overridden to support application specific preprocessing activity.
protected  boolean processValidate(ActionMapping mapping, ActionForm formInstance, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Call the validate() method of the specified ActionForm, and forward back to the input form if there are any errors.
 void reload()
          Reload the configuration of this controller servlet from our underlying configuration files.
 void removeFormBean(ActionFormBean formBean)
          Deregister a form bean definition from the set configured for this servlet.
 void removeForward(ActionForward forward)
          Deregister a forwarding from the set configured for this servlet.
 void removeMapping(ActionMapping mapping)
          Deregister a mapping from the set configured for this servlet.
 void setBufferSize(int bufferSize)
          Set the buffer size (how large of a chunk of data is recieved by the input stream at once) used for file uploading.
 void setFormBeanClass(java.lang.String formBeanClass)
          Set the Java class name of the class used to instantiate ActionFormBean objects.
 void setForwardClass(java.lang.String forwardClass)
          Set the Java class name of the class used to instantiate ActionForward objects.
 void setMappingClass(java.lang.String mappingClass)
          Set the Java class name of the class used to instantiate ActionMapping objects.
 void setMaxFileSize(java.lang.String maxFileSize)
          Set the maximum file size that a client can upload, number String with a trailing letter indicating the size.
 void setMultipartClass(java.lang.String multipartClass)
          Set the class name of the MultipartRequestHandler implementation
 void setTempDir(java.lang.String tempDir)
          Set the directory used to temporarily store files for MultipartRequestHandler implementations that write to the disk
 
Methods inherited from class javax.servlet.http.HttpServlet
, doDelete, doHead, doOptions, doPut, doTrace, getAllDeclaredMethods, getLastModified, maybeSetLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

actions

protected FastHashMap actions
The set of Action instances that have been created and initialized, keyed by the fully qualified Java class name.

application

protected MessageResources application
The resources object for our application resources (if any).

config

protected java.lang.String config
The context-relative path to our configuration resource.

content

protected java.lang.String content
The default content type and character encoding to be set on each response (may be overridden by forwarded-to resources).

dataSources

protected FastHashMap dataSources
The JDBC data sources that has been configured for this application, if any, keyed by the servlet context attribute under which they are stored.

debug

protected int debug
The debugging detail level for this servlet.

defaultLocale

protected final java.util.Locale defaultLocale
The default Locale for this server.

factoryClass

protected java.lang.String factoryClass
The Java class name of the MessageResourcesFactory class for the application message resources bundle.

formBeanClass

protected java.lang.String formBeanClass
The Java class name of the ActionFormBean implementation class to use.

formBeans

protected ActionFormBeans formBeans
The global ActionFormBean collection for this controller.

forwardClass

protected java.lang.String forwardClass
The Java class name of the ActionForward implementation class to use.

forwards

protected ActionForwards forwards
The global ActionForward collection for this controller.

internal

protected MessageResources internal
The resources object for our internal resources.

internalName

protected java.lang.String internalName
The Java base name of our internal resources.

locale

protected boolean locale
Should we create a java.util.Locale for this user, based on the HTTP headers of the request, if one is not present?

mappingClass

protected java.lang.String mappingClass
The Java class name of our ActionMapping implementation class.

mappings

protected ActionMappings mappings
The configured mappings for this web application, keyed by path.

nocache

protected boolean nocache
Include the no-caching headers in our response?

registrations

protected java.lang.String[] registrations
The set of public identifiers, and corresponding resource names, for the versions of the configuration file DTDs that we know about. There MUST be an even number of Strings in this list!

servletMapping

protected java.lang.String servletMapping
The URL pattern to which we are mapped in our web application deployment descriptor.

servletName

protected java.lang.String servletName
The servlet name under which we are registered in our web application deployment descriptor.

validate

protected boolean validate
Are we using the new configuration file format?

validating

protected boolean validating
Should we use a validating XML parser to read the configuration file?

bufferSize

protected int bufferSize
The size in bytes of the buffer used to read files from a client upload

maxFileSize

protected java.lang.String maxFileSize
The maximum size allowed for a client upload. A suffix of "K" represents Kilobytes, a suffix of "M" represents "Megabytes", a suffix of "G" represents Gigabytes, and no suffix is taken as bytes.

multipartClass

protected java.lang.String multipartClass
The MultipartRequestHandler class name used for handling multipart form requests. This is the global default value, the handler can also be set in individual mapping entries

tempDir

protected java.lang.String tempDir
The directory used to store temporary files for the DiskMultipartRequestHandler multipart implementation
Constructor Detail

ActionServlet

public ActionServlet()
Method Detail

destroy

public void destroy()
Gracefully shut down this controller servlet, releasing any resources that were allocated at initialization.
Overrides:
destroy in class javax.servlet.GenericServlet

init

public void init()
          throws javax.servlet.ServletException
Initialize this servlet. Most of the processing has been factored into support methods so that you can override particular functionality at a fairly granular level.
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException - if we cannot configure ourselves correctly

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws java.io.IOException,
                  javax.servlet.ServletException
Process an HTTP "GET" request.
Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws java.io.IOException,
                   javax.servlet.ServletException
Process an HTTP "POST" request.
Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

addDataSource

public void addDataSource(java.lang.String key,
                          javax.sql.DataSource dataSource)
Add a data source object to be used by this application.
Parameters:
key - The servlet context attribute key under which to store this data source, or null for the default
dataSource - The data source to be used

addFormBean

public void addFormBean(ActionFormBean formBean)
Register a form bean definition to the set configured for this servlet.
Parameters:
formBean - The form bean definition to be added

addForward

public void addForward(ActionForward forward)
Register a logical forwarding to the set configured for this servlet.
Parameters:
forward - The forwarding to be added

addMapping

public void addMapping(ActionMapping mapping)
Register a mapping to the set configured for this servlet.
Parameters:
mapping - The mapping to be added

addServletMapping

public void addServletMapping(java.lang.String servletName,
                              java.lang.String urlPattern)
Remember a servlet mapping from our web application deployment descriptor, if it is for this servlet.
Parameters:
servletName - The name of the servlet being mapped
urlPattern - The URL pattern to which this servlet is mapped

findDataSource

public javax.sql.DataSource findDataSource(java.lang.String key)
Return a JDBC data source associated with this application, if any.
Parameters:
key - The servlet context attribute key under which this data source is stored, or null for the default.

findFormBean

public ActionFormBean findFormBean(java.lang.String name)
Return the form bean definition associated with the specified logical name, if any; otherwise return null.
Parameters:
name - Logical name of the requested form bean definition

findForward

public ActionForward findForward(java.lang.String name)
Return the forwarding associated with the specified logical name, if any; otherwise return null.
Parameters:
name - Logical name of the requested forwarding

findMapping

public ActionMapping findMapping(java.lang.String path)
Return the mapping associated with the specified request path, if any; otherwise return null.
Parameters:
path - Request path for which a mapping is requested

getBufferSize

public int getBufferSize()
Get the buffer size (how large of a chunk of data is recieved by the input stream at once) used for file uploading.
Returns:
The size in bytes of the buffer

getDebug

public int getDebug()
Return the debugging detail level for this servlet.

getFormBeanClass

public java.lang.String getFormBeanClass()
Return the Java class name of the class used to instantiate ActionFormBean objects.

getForwardClass

public java.lang.String getForwardClass()
Return the Java class name of the class used to instantiate ActionForward objects.

getMappingClass

public java.lang.String getMappingClass()
Return the Java class name of the class used to instantiate ActionMapping objects.

getMaxFileSize

public java.lang.String getMaxFileSize()
Get the maximum file size. See setMaxFileSize for information on the number format used.

getMultipartClass

public java.lang.String getMultipartClass()
Get the class name of the MultipartRequestHandler implementation
Returns:
A qualified classname of the MultipartRequestHandler implementation

getResources

public MessageResources getResources()
Return the application resources for this web application, if any.

getTempDir

public java.lang.String getTempDir()
Get the directory used to temporarily store form files
Returns:
A platform-dependant String representing the path to the temporary directory

log

public void log(java.lang.String message,
                int level)
Log the specified message if the current debugging detail level for this servlet has been set to an equal or higher value. Otherwise, ignore this message.
Parameters:
message - Message to be logged
level - Debugging detail level of this message

reload

public void reload()
            throws java.io.IOException,
                   javax.servlet.ServletException
Reload the configuration of this controller servlet from our underlying configuration files.
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

removeFormBean

public void removeFormBean(ActionFormBean formBean)
Deregister a form bean definition from the set configured for this servlet.
Parameters:
formBean - The form bean definition to be deregistered

removeForward

public void removeForward(ActionForward forward)
Deregister a forwarding from the set configured for this servlet.
Parameters:
forward - The forwarding to be deregistered

removeMapping

public void removeMapping(ActionMapping mapping)
Deregister a mapping from the set configured for this servlet.
Parameters:
mapping - The mapping to be deregistered

setBufferSize

public void setBufferSize(int bufferSize)
Set the buffer size (how large of a chunk of data is recieved by the input stream at once) used for file uploading.
Parameters:
bufferSize - The size in bytes of the buffer

setFormBeanClass

public void setFormBeanClass(java.lang.String formBeanClass)
Set the Java class name of the class used to instantiate ActionFormBean objects.
Parameters:
formBeanClass - The new class name

setForwardClass

public void setForwardClass(java.lang.String forwardClass)
Set the Java class name of the class used to instantiate ActionForward objects.
Parameters:
forwardClass - The new class name

setMappingClass

public void setMappingClass(java.lang.String mappingClass)
Set the Java class name of the class used to instantiate ActionMapping objects.
Parameters:
mappingClass - The new class name

setMaxFileSize

public void setMaxFileSize(java.lang.String maxFileSize)
Set the maximum file size that a client can upload, number String with a trailing letter indicating the size. "K" indicates "kilobytes", "M" indicates "megabytes", "G" indicates "gigabytes". If there's no trailing letter the suffix is assumed to indicate the number is in bytes. For example, to set a maximum file size of 500 megabytes, you'd call setMaxFileSize("500M").
Parameters:
maxFileSize - A String representing the maximum file size.

setMultipartClass

public void setMultipartClass(java.lang.String multipartClass)
Set the class name of the MultipartRequestHandler implementation
Parameters:
multipartClass - A qualified classname of the MultipartRequestHandler implementation

setTempDir

public void setTempDir(java.lang.String tempDir)
Set the directory used to temporarily store files for MultipartRequestHandler implementations that write to the disk
Parameters:
tempDir - A platform-dependant String representing the path to the temporary directory

destroyActions

protected void destroyActions()
Gracefully shut down any action instances we have created.

destroyApplication

protected void destroyApplication()
Gracefully terminate use of the application MessageResources (if any).

destroyDataSources

protected void destroyDataSources()
Gracefully terminate use of the data source associated with this application (if any).

destroyInternal

protected void destroyInternal()
Gracefully terminate use of the internal MessageResources.

initActions

protected void initActions()
Initialize the collection of previously instantiated Action instances.

initApplication

protected void initApplication()
                        throws javax.servlet.ServletException
Initialize the MessageResources bundle for this application, if any.
Throws:
javax.servlet.ServletException - if we cannot initialize these resources

initDataSources

protected void initDataSources()
                        throws javax.servlet.ServletException
Initialize use of the data sources associated with this application (if any).
Throws:
javax.servlet.ServletException - if a fatal initialization error occurs

initDebug

protected void initDebug()
                  throws javax.servlet.ServletException
Initialize the debugging detail level for this application.
Throws:
javax.servlet.ServletException - if we cannot initialize these resources

initDigester

protected Digester initDigester(int detail)
Construct and return a digester that uses the new configuration file format.

initDigesterOld

protected Digester initDigesterOld(int detail)
Construct and return a digester that uses the old configuration file format.

initInternal

protected void initInternal()
                     throws javax.servlet.ServletException
Initialize our internal MessageResources bundle.
Throws:
javax.servlet.ServletException - if we cannot initialize these resources

initMapping

protected void initMapping()
                    throws java.io.IOException,
                           javax.servlet.ServletException
Initialize the mapping information for this application.
Throws:
java.io.IOException - if an input/output error is encountered
javax.servlet.ServletException - if we cannot initialize these resources

initOther

protected void initOther()
                  throws javax.servlet.ServletException
Initialize other configuration parameters that have not yet been processed.
Throws:
javax.servlet.ServletException - if we cannot initialize these resources

initServlet

protected void initServlet()
                    throws javax.servlet.ServletException
Initialize the servlet mapping under which our controller servlet is being accessed. This will be used in the &html:form> tag to generate correct destination URLs for form submissions.

initUpload

protected void initUpload()
                   throws javax.servlet.ServletException
Initialize upload parameters and "bufferSize", "multipartClass", "maxFileSize", "tempDir"
Throws:
javax.servlet.ServletException - if there are invalid parameters

process

protected void process(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
                throws java.io.IOException,
                       javax.servlet.ServletException
Process an HTTP request.
Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

processActionCreate

protected Action processActionCreate(ActionMapping mapping,
                                     javax.servlet.http.HttpServletRequest request)
Create or retrieve the Action instance that will process this request, or null if no such Action instance can be created.
Parameters:
mapping - The ActionMapping we are processing
request - The servlet request we are processing

processActionForm

protected ActionForm processActionForm(ActionMapping mapping,
                                       javax.servlet.http.HttpServletRequest request)
Retrieve and return the ActionForm bean associated with this mapping, creating and stashing one if necessary. If there is no form bean associated with this mapping, return null.
Parameters:
mapping - The ActionMapping we are processing
request - The servlet request we are processing

processActionForward

protected void processActionForward(ActionForward forward,
                                    ActionMapping mapping,
                                    ActionForm formInstance,
                                    javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response)
                             throws java.io.IOException,
                                    javax.servlet.ServletException
Forward to the specified destination, by the specified mechanism, if an ActionForward instance was returned by the Action.
Parameters:
forward - The ActionForward returned by our action
mapping - The ActionMapping we are processing
formInstance - The ActionForm we are processing
request - The servlet request we are processing
response - The servlet response we are creating
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

processActionPerform

protected ActionForward processActionPerform(Action action,
                                             ActionMapping mapping,
                                             ActionForm formInstance,
                                             javax.servlet.http.HttpServletRequest request,
                                             javax.servlet.http.HttpServletResponse response)
                                      throws java.io.IOException,
                                             javax.servlet.ServletException
Ask the specified Action instance to handle this request. Return the ActionForward instance (if any) returned by the called Action.
Parameters:
action - The Action to process this request
mapping - The ActionMapping we are processing
formInstance - The ActionForm we are processing
request - The servlet request we are processing
response - The servlet response we are creating
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

processContent

protected void processContent(javax.servlet.http.HttpServletResponse response)
Set the default content type (with optional character encoding) for all responses. This value may be overridden by forwarded-to servlets or JSP pages.
Parameters:
response - The response we are processing

processForward

protected boolean processForward(ActionMapping mapping,
                                 javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response)
                          throws java.io.IOException,
                                 javax.servlet.ServletException
Process a forward requested by this mapping, if any. Return true if processing of this request should continue (i.e. be processed by an Action class), or false if we have already handled this request.
Parameters:
mapping - The ActionMapping we are processing
request - The request we are processing
response - The response we are processing
Throws:
java.io.IOException - if the included resource throws an exception
javax.servlet.ServletException - if the included resource throws an exception

processInclude

protected boolean processInclude(ActionMapping mapping,
                                 javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response)
                          throws java.io.IOException,
                                 javax.servlet.ServletException
Process an include requested by this mapping, if any. Return true if processing of this request should continue (i.e. be processed by an Action class), or false if we have already handled this request.
Parameters:
mapping - The ActionMapping we are processing
request - The request we are processing
response - The response we are processing
Throws:
java.io.IOException - if the included resource throws an exception
javax.servlet.ServletException - if the included resource throws an exception

processLocale

protected void processLocale(javax.servlet.http.HttpServletRequest request)
Automatically calculate an appropriate java.util.Locale for this user, and store it in their session, if there is no such Locale object present already.
Parameters:
request - The request we are processing

processMapping

protected ActionMapping processMapping(java.lang.String path,
                                       javax.servlet.http.HttpServletRequest request)
Identify and return an appropriate ActionMapping for the specified path. If no such mapping can be identified, return null. The request parameter is available if you need to make decisions on available mappings (such as checking permissions) based on request parameters or other properties, but it is not used in the default implementation.
Parameters:
path - Path component used to select a mapping
request - The request we are processing

processNoCache

protected void processNoCache(javax.servlet.http.HttpServletResponse response)
                       throws java.io.IOException,
                              javax.servlet.ServletException
Render the HTTP headers to defeat browser caching if requested.
Parameters:
response - The servlet response we are creating
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

processPath

protected java.lang.String processPath(javax.servlet.http.HttpServletRequest request)
Identify and return the path component (from the request URI) that we will use to select an ActionMapping to dispatch with. If no such path can be identified, return null.
Parameters:
request - The servlet request we are processing

processPreprocess

protected boolean processPreprocess(javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response)
                             throws java.io.IOException,
                                    javax.servlet.ServletException
General purpose preprocessing hook that can be overridden to support application specific preprocessing activity. This hook can examine and/or modify the properties of the request and response objects, and optionally complete the response if it wishes.

The default implementation does nothing.

Parameters:
request - The servlet request we are processing
response - The servlet response we are generating
Returns:
true if the remainder of the standard processing should be performed, or false if the response has already been created so the calling method should immediately exit
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

processPopulate

protected void processPopulate(ActionForm formInstance,
                               ActionMapping mapping,
                               javax.servlet.http.HttpServletRequest request)
                        throws javax.servlet.ServletException
Populate the properties of the specified ActionForm from the request parameters included with this request.
Parameters:
formInstance - The ActionForm we are processing
mapping - The ActionMapping we are processing
request - The servlet request we are processing
Throws:
javax.servlet.ServletException - if thrown by RequestUtils.populate()

processValidate

protected boolean processValidate(ActionMapping mapping,
                                  ActionForm formInstance,
                                  javax.servlet.http.HttpServletRequest request,
                                  javax.servlet.http.HttpServletResponse response)
                           throws java.io.IOException,
                                  javax.servlet.ServletException
Call the validate() method of the specified ActionForm, and forward back to the input form if there are any errors. Return true if we should continue processing (and call the Action class perform() method), or return false if we have already forwarded control back to the input form.
Parameters:
mapping - The ActionMapping we are processing
formInstance - The ActionForm we are processing
request - The servlet request we are processing
response - The servlet response we are processing
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs


Copyright © 2000-2001 - Apache Software Foundation