| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--org.apache.struts.action.ActionServlet
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:
RequestDispatcher.forward() facility of the servlet API
     to pass control to an appropriate JSP page to produce the next page
     of the user interface.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.
Action interface).
     ActionForm bean
     associated with this mapping.execute method of this action class, passing
     on a reference to the mapping that was used (thereby providing access
     to the underlying ActionServlet and ServletContext, as well as any
     specialized properties of the mapping itself), and the request and
     response that were passed to the controller by the servlet container.
     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. Several of these were
 deprecated between the 1.0 and 1.1 releases. The deprecated parameters
 are listed after the nominal parameters.
java.lang.Integer) will default to null (rather than 0).
     (Since Struts 1.1) [false] org.apache.commons.digester.RuleSet
     instances that should be added to the Digester that will
     be processing struts-config.xml files.  By default, only
     the RuleSet for the standard configuration elements is
     loaded.  (Since Struts 1.1)The following parameters may still be used with the Struts 1.1 release but are deprecated.
MessageResourcesFactory used to create the application
     MessageResources object.
     [org.apache.struts.util.PropertyMessageResourcesFactory]
     DEPRECATED - Configure this using the "factory" attribute
     of the <message-resources> element.org.apache.struts.action.ActionForward
         that defaults the redirect property to
         false (same as the ActionForward default value).
     org.apache.struts.action.ActionForward
         that defaults the redirect property to
         true.
     true, and there is a
     user session, identify and store an appropriate
     java.util.Locale object (under the standard key
     identified by Globals.LOCALE_KEY) in the user's session
     if there is not a Locale object there already. [true]
     DEPRECATED - Configure this using the "locale" attribute of
     the <controller> element.org.apache.struts.action.ActionMapping that
         defaults the scope property to "request".
     org.apache.struts.action.ActionMapping that
         defaults the scope property to "session".  (Same
         as the ActionMapping default value).
     none, disables Struts multipart
     request handling.  [org.apache.struts.upload.CommonsMultipartRequestHandler]
     DEPRECATED - Configure this using the "multipartClass" attribute of
     the <controller> element.true, add HTTP headers
     to every response intended to defeat browser caching of any response we
     generate or forward to.  [false]
     DEPRECATED - Configure this using the "nocache" attribute of
     the <controller> element.true, set our application
     resources to return null if an unknown message key is used.
     Otherwise, an error message including the offending message key will
     be returned.  [true]
     DEPRECATED - Configure this using the "null" attribute of
     the <message-resources> element.
| Field Summary | |
| protected  java.lang.String | configComma-separated list of context-relative path(s) to our configuration resource(s) for the default module. | 
| protected  org.apache.commons.digester.Digester | configDigesterThe Digester used to produce ModuleConfig objects from a Struts configuration file. | 
| protected  boolean | convertNullThe flag to request backwards-compatible conversions for form bean properties of the Java wrapper class types. | 
| protected  org.apache.commons.collections.FastHashMap | dataSourcesThe JDBC data sources that has been configured for this module, if any, keyed by the servlet context attribute under which they are stored. | 
| protected  int | debugDeprecated. | 
| protected  MessageResources | internalThe resources object for our internal resources. | 
| protected  java.lang.String | internalNameThe Java base name of our internal resources. | 
| protected static org.apache.commons.logging.Log | logCommons Logging instance. | 
| protected  RequestProcessor | processorThe RequestProcessorinstance we will use to process
 all incoming requests. | 
| protected  java.lang.String[] | registrationsThe set of public identifiers, and corresponding resource names, for the versions of the configuration file DTDs that we know about. | 
| protected  java.lang.String | servletMappingThe URL pattern to which we are mapped in our web application deployment descriptor. | 
| protected  java.lang.String | servletNameThe servlet name under which we are registered in our web application deployment descriptor. | 
| Fields inherited from class javax.servlet.http.HttpServlet | 
|  | 
| Constructor Summary | |
| ActionServlet() | |
| Method Summary | |
|  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. | 
| private  void | defaultControllerConfig(ModuleConfig config)Deprecated. Will be removed in a release after Struts 1.1. | 
| private  void | defaultFormBeansConfig(ModuleConfig config)Deprecated. Will be removed in a release after Struts 1.1. | 
| private  void | defaultForwardsConfig(ModuleConfig config)Deprecated. Will be removed in a release after Struts 1.1. | 
| private  void | defaultMappingsConfig(ModuleConfig config)Deprecated. Will be removed in a release after Struts 1.1. | 
| private  void | defaultMessageResourcesConfig(ModuleConfig config)Deprecated. Will be removed in a release after Struts 1.1. | 
|  void | destroy()Gracefully shut down this controller servlet, releasing any resources that were allocated at initialization. | 
| protected  void | destroyApplications()Deprecated. replaced by destroyModules() | 
| protected  void | destroyConfigDigester()Gracefully release any configDigester instance that we have created. | 
| protected  void | destroyDataSources()Deprecated. Will no longer be required with module support | 
| protected  void | destroyInternal()Gracefully terminate use of the internal MessageResources. | 
| protected  void | destroyModules()Gracefully terminate use of any modules associated with this application (if any). | 
|  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)Deprecated. Look up data sources directly in servlet context attributes | 
|  ActionFormBean | findFormBean(java.lang.String name)Deprecated. Replaced by ModuleConfig.findFormBeanConfig() | 
|  ActionForward | findForward(java.lang.String name)Deprecated. Replaced by ModuleConfig.findForwardConfig() | 
|  ActionMapping | findMapping(java.lang.String path)Deprecated. Replaced by ModuleConfig.findActionConfig() | 
| protected  ApplicationConfig | getApplicationConfig(javax.servlet.http.HttpServletRequest request)Deprecated. use getModuleConfig(HttpServletRequest) | 
|  int | getDebug()Deprecated. Configure the logging detail level in your underlying logging implementation | 
|  MessageResources | getInternal()Return the MessageResourcesinstance containing our
 internal message strings. | 
| protected  ModuleConfig | getModuleConfig(javax.servlet.http.HttpServletRequest request)Return the module configuration object for the currently selected module. | 
| protected  RequestProcessor | getRequestProcessor(ModuleConfig config)Look up and return the RequestProcessorresponsible for the
 specified module, creating a new one if necessary. | 
|  MessageResources | getResources()Deprecated. Actions should call Action.getResources(HttpServletRequest) instead of this method, in order to retrieve the resources for the current module. | 
| private  void | handleConfigException(java.lang.String paths,
                      java.lang.Exception e)Simplifies exception handling in the parseModuleConfigFile() method. | 
|  void | init()Initialize this servlet. | 
| protected  ApplicationConfig | initApplicationConfig(java.lang.String prefix,
                      java.lang.String path)Deprecated. use initModuleConfig(String,String) | 
| protected  void | initApplicationDataSources(ModuleConfig config)Deprecated. use initModuleDataSources(ModuleConfig) | 
| protected  void | initApplicationMessageResources(ModuleConfig config)Deprecated. use initModuleMessageResources() | 
| protected  void | initApplicationPlugIns(ModuleConfig config)Deprecated. use initModulePlugIns(ModuleConfig) | 
| protected  org.apache.commons.digester.Digester | initConfigDigester()Create (if needed) and return a new Digester instance that has been initialized to process Struts module configuraiton files and configure a corresponding ModuleConfig object (which must be pushed on to the evaluation stack before parsing begins). | 
| protected  void | initDataSources()Deprecated. Replaced by initApplicationDataSources() that takes an ModuleConfig argument. This method does nothing. | 
| protected  void | initInternal()Initialize our internal MessageResources bundle. | 
| protected  ModuleConfig | initModuleConfig(java.lang.String prefix,
                 java.lang.String paths)Initialize the application configuration information for the specified module. | 
| protected  void | initModuleDataSources(ModuleConfig config)Initialize the data sources for the specified module. | 
| protected  void | initModuleMessageResources(ModuleConfig config)Initialize the application MessageResources for the specified module. | 
| protected  void | initModulePlugIns(ModuleConfig config)Initialize the plug ins for the specified module. | 
| protected  void | initOther()Initialize other global characteristics of the controller servlet. | 
| protected  void | initServlet()Initialize the servlet mapping under which our controller servlet is being accessed. | 
|  void | log(java.lang.String message,
    int level)Deprecated. Use commons-logging instead. | 
| private  void | parseModuleConfigFile(java.lang.String prefix,
                      java.lang.String paths,
                      ModuleConfig config,
                      org.apache.commons.digester.Digester digester,
                      java.lang.String path)Parses one module config file. | 
| protected  void | process(javax.servlet.http.HttpServletRequest request,
        javax.servlet.http.HttpServletResponse response)Perform the standard request processing for this request, and create the corresponding response. | 
| Methods inherited from class javax.servlet.http.HttpServlet | 
| doDelete, doOptions, doPut, doTrace, getLastModified, 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, toString, wait, wait, wait | 
| Field Detail | 
protected java.lang.String config
protected org.apache.commons.digester.Digester configDigester
protected boolean convertNull
protected org.apache.commons.collections.FastHashMap dataSources
protected int debug
protected MessageResources internal
protected java.lang.String internalName
protected static org.apache.commons.logging.Log log
protected RequestProcessor processor
RequestProcessor instance we will use to process
 all incoming requests.
protected java.lang.String[] registrations
protected java.lang.String servletMapping
protected java.lang.String servletName
| Constructor Detail | 
public ActionServlet()
| Method Detail | 
public void destroy()
destroy in interface javax.servlet.Servletdestroy in class javax.servlet.GenericServlet
public void init()
          throws javax.servlet.ServletException
init in class javax.servlet.GenericServletjavax.servlet.ServletException - if we cannot configure ourselves correctly
public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws java.io.IOException,
                  javax.servlet.ServletException
doGet in class javax.servlet.http.HttpServletrequest - The servlet request we are processingresponse - The servlet response we are creating
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs
public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws java.io.IOException,
                   javax.servlet.ServletException
doPost in class javax.servlet.http.HttpServletrequest - The servlet request we are processingresponse - The servlet response we are creating
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs
public void addServletMapping(java.lang.String servletName,
                              java.lang.String urlPattern)
servletName - The name of the servlet being mappedurlPattern - The URL pattern to which this servlet is mappedpublic javax.sql.DataSource findDataSource(java.lang.String key)
key - The servlet context attribute key under which this data
  source is stored, or null for the default.public ActionFormBean findFormBean(java.lang.String name)
null.
name - Logical name of the requested form bean definitionpublic ActionForward findForward(java.lang.String name)
null.
name - Logical name of the requested forwardingpublic ActionMapping findMapping(java.lang.String path)
path - Request path for which a mapping is requestedpublic int getDebug()
public MessageResources getInternal()
MessageResources instance containing our
 internal message strings.
public MessageResources getResources()
Return the application resources for the default module, if any.
public void log(java.lang.String message,
                int level)
message - Message to be loggedlevel - Debugging detail level of this messageprotected void destroyApplications()
protected void destroyModules()
protected void destroyConfigDigester()
protected void destroyDataSources()
protected void destroyInternal()
protected ApplicationConfig getApplicationConfig(javax.servlet.http.HttpServletRequest request)
getModuleConfig(HttpServletRequest)
request - The servlet request we are processingprotected ModuleConfig getModuleConfig(javax.servlet.http.HttpServletRequest request)
request - The servlet request we are processing
protected RequestProcessor getRequestProcessor(ModuleConfig config)
                                        throws javax.servlet.ServletException
RequestProcessor responsible for the
 specified module, creating a new one if necessary.
config - The module configuration for which to
  acquire and return a RequestProcessor.
javax.servlet.ServletException - if we cannot instantiate a RequestProcessor
  instance
protected ApplicationConfig initApplicationConfig(java.lang.String prefix,
                                                  java.lang.String path)
                                           throws javax.servlet.ServletException
initModuleConfig(String,String)
Initialize the application configuration information for the specified module.
prefix - Module prefix for this modulepath - Context-relative resource path for this modules's
  configuration resource
javax.servlet.ServletException - if initialization cannot be performed
protected ModuleConfig initModuleConfig(java.lang.String prefix,
                                        java.lang.String paths)
                                 throws javax.servlet.ServletException
Initialize the application configuration information for the specified module.
prefix - Module prefix for this modulepaths - Comma-separated list of context-relative resource path(s)
  for this modules's configuration resource(s)
javax.servlet.ServletException - if initialization cannot be performed
private void parseModuleConfigFile(java.lang.String prefix,
                                   java.lang.String paths,
                                   ModuleConfig config,
                                   org.apache.commons.digester.Digester digester,
                                   java.lang.String path)
                            throws javax.servlet.UnavailableException
prefix - paths - config - digester - Digester instance that does the parsingpath - The path to the config file to parse.
javax.servlet.UnavailableException
private void handleConfigException(java.lang.String paths,
                                   java.lang.Exception e)
                            throws javax.servlet.UnavailableException
paths - e - 
javax.servlet.UnavailableException
protected void initApplicationDataSources(ModuleConfig config)
                                   throws javax.servlet.ServletException
Initialize the data sources for the specified module.
config - ModuleConfig information for this module
javax.servlet.ServletException - if initialization cannot be performed
protected void initModuleDataSources(ModuleConfig config)
                              throws javax.servlet.ServletException
Initialize the data sources for the specified module.
config - ModuleConfig information for this module
javax.servlet.ServletException - if initialization cannot be performed
protected void initApplicationPlugIns(ModuleConfig config)
                               throws javax.servlet.ServletException
initModulePlugIns(ModuleConfig)
Initialize the plug ins for the specified module.
config - ModuleConfig information for this module
javax.servlet.ServletException - if initialization cannot be performed
protected void initModulePlugIns(ModuleConfig config)
                          throws javax.servlet.ServletException
Initialize the plug ins for the specified module.
config - ModuleConfig information for this module
javax.servlet.ServletException - if initialization cannot be performed
protected void initApplicationMessageResources(ModuleConfig config)
                                        throws javax.servlet.ServletException
Initialize the application MessageResources for the specified module.
config - ModuleConfig information for this module
javax.servlet.ServletException - if initialization cannot be performed
protected void initModuleMessageResources(ModuleConfig config)
                                   throws javax.servlet.ServletException
Initialize the application MessageResources for the specified module.
config - ModuleConfig information for this module
javax.servlet.ServletException - if initialization cannot be performed
protected org.apache.commons.digester.Digester initConfigDigester()
                                                           throws javax.servlet.ServletException
Create (if needed) and return a new Digester instance that has been initialized to process Struts module configuraiton files and configure a corresponding ModuleConfig object (which must be pushed on to the evaluation stack before parsing begins).
javax.servlet.ServletException - if a Digester cannot be configured
protected void initDataSources()
                        throws javax.servlet.ServletException
javax.servlet.ServletException
protected void initInternal()
                     throws javax.servlet.ServletException
javax.servlet.ServletException - if we cannot initialize these resources
protected void initOther()
                  throws javax.servlet.ServletException
javax.servlet.ServletException - if we cannot initialize these resources
protected void initServlet()
                    throws javax.servlet.ServletException
&html:form>
 tag to generate correct destination URLs for form submissions.
javax.servlet.ServletException - if error happens while scanning web.xml
protected void process(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
                throws java.io.IOException,
                       javax.servlet.ServletException
request - The servlet request we are processingresponse - The servlet response we are creating
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception is thrownprivate void defaultControllerConfig(ModuleConfig config)
config - The ModuleConfig object for the default moduleprivate void defaultFormBeansConfig(ModuleConfig config)
config - The ModuleConfig object for the default appprivate void defaultForwardsConfig(ModuleConfig config)
config - The ModuleConfig object for the default appprivate void defaultMappingsConfig(ModuleConfig config)
config - The ModuleConfig object for the default appprivate void defaultMessageResourcesConfig(ModuleConfig config)
config - The ModuleConfig object for the default module| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||