org.apache.struts.action
クラス ActionServlet

java.lang.Object
  拡張javax.servlet.GenericServlet
      拡張javax.servlet.http.HttpServlet
          拡張org.apache.struts.action.ActionServlet
すべての実装インタフェース:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
直系の既知のサブクラス:
ActionComponentServlet

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. Several of these were deprecated between the 1.0 and 1.1 releases. The deprecated parameters are listed after the nominal parameters.

The following parameters may still be used with the Struts 1.1 release but are deprecated.

バージョン:
$Revision: 1.3 $ $Date: 2003/12/16 04:55:05 $
作成者:
Craig R. McClanahan, Ted Husted, Martin Cooper, David Graham
関連項目:
直列化された形式
翻訳者:
田中 良浩
校正者:
翻訳状況:
翻訳中
翻訳更新日:
2003/12/15

フィールドの概要
protected  java.lang.String config
          Comma-separated list of context-relative path(s) to our configuration resource(s) for the default module.
protected  org.apache.commons.digester.Digester configDigester
          The Digester used to produce ModuleConfig objects from a Struts configuration file.
protected  boolean convertNull
          The flag to request backwards-compatible conversions for form bean properties of the Java wrapper class types.
protected  org.apache.commons.collections.FastHashMap dataSources
          The 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 debug
          推奨されていません。  
protected  MessageResources internal
          The resources object for our internal resources.
protected  java.lang.String internalName
          The Java base name of our internal resources.
protected static org.apache.commons.logging.Log log
          Commons Logging instance.
protected  RequestProcessor processor
          The RequestProcessor instance we will use to process all incoming requests.
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.
 
クラス javax.servlet.http.HttpServlet から継承したフィールド
 
コンストラクタの概要
ActionServlet()
           
 
メソッドの概要
 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)
          推奨されていません。 Will be removed in a release after Struts 1.1.
private  void defaultFormBeansConfig(ModuleConfig config)
          推奨されていません。 Will be removed in a release after Struts 1.1.
private  void defaultForwardsConfig(ModuleConfig config)
          推奨されていません。 Will be removed in a release after Struts 1.1.
private  void defaultMappingsConfig(ModuleConfig config)
          推奨されていません。 Will be removed in a release after Struts 1.1.
private  void defaultMessageResourcesConfig(ModuleConfig config)
          推奨されていません。 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()
          推奨されていません。 replaced by destroyModules()
protected  void destroyConfigDigester()
          Gracefully release any configDigester instance that we have created.
protected  void destroyDataSources()
          推奨されていません。 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)
          推奨されていません。 Look up data sources directly in servlet context attributes
 ActionFormBean findFormBean(java.lang.String name)
          推奨されていません。 Replaced by ModuleConfig.findFormBeanConfig()
 ActionForward findForward(java.lang.String name)
          推奨されていません。 Replaced by ModuleConfig.findForwardConfig()
 ActionMapping findMapping(java.lang.String path)
          推奨されていません。 Replaced by ModuleConfig.findActionConfig()
protected  ApplicationConfig getApplicationConfig(javax.servlet.http.HttpServletRequest request)
          推奨されていません。 use getModuleConfig(HttpServletRequest)
 int getDebug()
          推奨されていません。 Configure the logging detail level in your underlying logging implementation
 MessageResources getInternal()
          Return the MessageResources instance 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 RequestProcessor responsible for the specified module, creating a new one if necessary.
 MessageResources getResources()
          推奨されていません。 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)
          推奨されていません。 use initModuleConfig(String,String)
protected  void initApplicationDataSources(ModuleConfig config)
          推奨されていません。 use initModuleDataSources(ModuleConfig)
protected  void initApplicationMessageResources(ModuleConfig config)
          推奨されていません。 use initModuleMessageResources()
protected  void initApplicationPlugIns(ModuleConfig config)
          推奨されていません。 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()
          推奨されていません。 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)
          推奨されていません。 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.
 
クラス javax.servlet.http.HttpServlet から継承したメソッド
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
クラス javax.servlet.GenericServlet から継承したメソッド
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

config

protected java.lang.String config
Comma-separated list of context-relative path(s) to our configuration resource(s) for the default module.


configDigester

protected org.apache.commons.digester.Digester configDigester
The Digester used to produce ModuleConfig objects from a Struts configuration file.

導入されたバージョン:
Struts 1.1

convertNull

protected boolean convertNull
The flag to request backwards-compatible conversions for form bean properties of the Java wrapper class types.

導入されたバージョン:
Struts 1.1

dataSources

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


debug

protected int debug
推奨されていません。  

The debugging detail level for this servlet.


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.

導入されたバージョン:
Struts 1.1

log

protected static org.apache.commons.logging.Log log
Commons Logging instance.

導入されたバージョン:
Struts 1.1

processor

protected RequestProcessor processor
The RequestProcessor instance we will use to process all incoming requests.

導入されたバージョン:
Struts 1.1

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. FIXME - multiples???


servletName

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

コンストラクタの詳細

ActionServlet

public ActionServlet()
メソッドの詳細

destroy

public void destroy()
Gracefully shut down this controller servlet, releasing any resources that were allocated at initialization.


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.

例外:
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.

パラメータ:
request - The servlet request we are processing
response - The servlet response we are creating
例外:
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.

パラメータ:
request - The servlet request we are processing
response - The servlet response we are creating
例外:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

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.

パラメータ:
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)
推奨されていません。 Look up data sources directly in servlet context attributes

Return a JDBC data source associated with this module, if any.

パラメータ:
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)
推奨されていません。 Replaced by ModuleConfig.findFormBeanConfig()

Return the form bean definition associated with the specified logical name, if any; otherwise return null.

パラメータ:
name - Logical name of the requested form bean definition

findForward

public ActionForward findForward(java.lang.String name)
推奨されていません。 Replaced by ModuleConfig.findForwardConfig()

Return the forwarding associated with the specified logical name, if any; otherwise return null.

パラメータ:
name - Logical name of the requested forwarding

findMapping

public ActionMapping findMapping(java.lang.String path)
推奨されていません。 Replaced by ModuleConfig.findActionConfig()

Return the ActionMapping for the specified path, for the default module.

パラメータ:
path - Request path for which a mapping is requested

getDebug

public int getDebug()
推奨されていません。 Configure the logging detail level in your underlying logging implementation

Return the debugging detail level for this servlet.


getInternal

public MessageResources getInternal()
Return the MessageResources instance containing our internal message strings.

導入されたバージョン:
Struts 1.1

getResources

public MessageResources getResources()
推奨されていません。 Actions should call Action.getResources(HttpServletRequest) instead of this method, in order to retrieve the resources for the current module.

Return the application resources for the default module, if any.


log

public void log(java.lang.String message,
                int level)
推奨されていません。 Use commons-logging instead.

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.

パラメータ:
message - Message to be logged
level - Debugging detail level of this message

destroyApplications

protected void destroyApplications()
推奨されていません。 replaced by destroyModules()

Gracefully terminate use of any modules associated with this application (if any).

導入されたバージョン:
Struts 1.1

destroyModules

protected void destroyModules()
Gracefully terminate use of any modules associated with this application (if any).

導入されたバージョン:
Struts 1.1

destroyConfigDigester

protected void destroyConfigDigester()
Gracefully release any configDigester instance that we have created.

導入されたバージョン:
Struts 1.1

destroyDataSources

protected void destroyDataSources()
推奨されていません。 Will no longer be required with module support

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


destroyInternal

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


getApplicationConfig

protected ApplicationConfig getApplicationConfig(javax.servlet.http.HttpServletRequest request)
推奨されていません。 use getModuleConfig(HttpServletRequest)

Return the module configuration object for the currently selected module.

パラメータ:
request - The servlet request we are processing
導入されたバージョン:
Struts 1.1

getModuleConfig

protected ModuleConfig getModuleConfig(javax.servlet.http.HttpServletRequest request)
Return the module configuration object for the currently selected module.

パラメータ:
request - The servlet request we are processing
導入されたバージョン:
Struts 1.1

getRequestProcessor

protected RequestProcessor getRequestProcessor(ModuleConfig config)
                                        throws javax.servlet.ServletException
Look up and return the 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
導入されたバージョン:
Struts 1.1

initApplicationConfig

protected ApplicationConfig initApplicationConfig(java.lang.String prefix,
                                                  java.lang.String path)
                                           throws javax.servlet.ServletException
推奨されていません。 use initModuleConfig(String,String)

Initialize the application configuration information for the specified module.

パラメータ:
prefix - Module prefix for this module
path - Context-relative resource path for this modules's configuration resource
例外:
javax.servlet.ServletException - if initialization cannot be performed
導入されたバージョン:
Struts 1.1

initModuleConfig

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 module
paths - Comma-separated list of context-relative resource path(s) for this modules's configuration resource(s)
例外:
javax.servlet.ServletException - if initialization cannot be performed
導入されたバージョン:
Struts 1.1

parseModuleConfigFile

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
Parses one module config file.

パラメータ:
prefix -
paths -
config -
digester - Digester instance that does the parsing
path - The path to the config file to parse.
例外:
javax.servlet.UnavailableException

handleConfigException

private void handleConfigException(java.lang.String paths,
                                   java.lang.Exception e)
                            throws javax.servlet.UnavailableException
Simplifies exception handling in the parseModuleConfigFile() method.

パラメータ:
paths -
e -
例外:
javax.servlet.UnavailableException

initApplicationDataSources

protected void initApplicationDataSources(ModuleConfig config)
                                   throws javax.servlet.ServletException
推奨されていません。 use initModuleDataSources(ModuleConfig)

Initialize the data sources for the specified module.

パラメータ:
config - ModuleConfig information for this module
例外:
javax.servlet.ServletException - if initialization cannot be performed
導入されたバージョン:
Struts 1.1

initModuleDataSources

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
導入されたバージョン:
Struts 1.1

initApplicationPlugIns

protected void initApplicationPlugIns(ModuleConfig config)
                               throws javax.servlet.ServletException
推奨されていません。 use initModulePlugIns(ModuleConfig)

Initialize the plug ins for the specified module.

パラメータ:
config - ModuleConfig information for this module
例外:
javax.servlet.ServletException - if initialization cannot be performed
導入されたバージョン:
Struts 1.1

initModulePlugIns

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
導入されたバージョン:
Struts 1.1

initApplicationMessageResources

protected void initApplicationMessageResources(ModuleConfig config)
                                        throws javax.servlet.ServletException
推奨されていません。 use initModuleMessageResources()

Initialize the application MessageResources for the specified module.

パラメータ:
config - ModuleConfig information for this module
例外:
javax.servlet.ServletException - if initialization cannot be performed
導入されたバージョン:
Struts 1.1

initModuleMessageResources

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
導入されたバージョン:
Struts 1.1

initConfigDigester

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
導入されたバージョン:
Struts 1.1

initDataSources

protected void initDataSources()
                        throws javax.servlet.ServletException
推奨されていません。 Replaced by initApplicationDataSources() that takes an ModuleConfig argument. This method does nothing.

Initialize data sources for the default module. This method signature is maintained only for backwards compatibility, and will be removed in a subsequent release.

例外:
javax.servlet.ServletException

initInternal

protected void initInternal()
                     throws javax.servlet.ServletException
Initialize our internal MessageResources bundle.

例外:
javax.servlet.ServletException - if we cannot initialize these resources

initOther

protected void initOther()
                  throws javax.servlet.ServletException
Initialize other global characteristics of the controller servlet.

例外:
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.

例外:
javax.servlet.ServletException - if error happens while scanning web.xml

process

protected void process(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
                throws java.io.IOException,
                       javax.servlet.ServletException
Perform the standard request processing for this request, and create the corresponding response.

パラメータ:
request - The servlet request we are processing
response - The servlet response we are creating
例外:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception is thrown

defaultControllerConfig

private void defaultControllerConfig(ModuleConfig config)
推奨されていません。 Will be removed in a release after Struts 1.1.

Perform backwards-compatible configuration of the default module's controller configuration from servlet initialization parameters (as were used in Struts 1.0).

パラメータ:
config - The ModuleConfig object for the default module
導入されたバージョン:
Struts 1.1

defaultFormBeansConfig

private void defaultFormBeansConfig(ModuleConfig config)
推奨されていません。 Will be removed in a release after Struts 1.1.

Perform backwards-compatible configuration of an ActionFormBeans collection, and expose it as a servlet context attribute (as was used in Struts 1.0). Note that the current controller code does not (and should not) reference this attribute for any reason.

パラメータ:
config - The ModuleConfig object for the default app
導入されたバージョン:
Struts 1.1

defaultForwardsConfig

private void defaultForwardsConfig(ModuleConfig config)
推奨されていません。 Will be removed in a release after Struts 1.1.

Perform backwards-compatible configuration of an ActionForwards collection, and expose it as a servlet context attribute (as was used in Struts 1.0). Note that the current controller code does not (and should not) reference this attribute for any reason.

パラメータ:
config - The ModuleConfig object for the default app
導入されたバージョン:
Struts 1.1

defaultMappingsConfig

private void defaultMappingsConfig(ModuleConfig config)
推奨されていません。 Will be removed in a release after Struts 1.1.

Perform backwards-compatible configuration of an ActionMappings collection, and expose it as a servlet context attribute (as was used in Struts 1.0). Note that the current controller code does not (and should not) reference this attribute for any reason.

パラメータ:
config - The ModuleConfig object for the default app
導入されたバージョン:
Struts 1.1

defaultMessageResourcesConfig

private void defaultMessageResourcesConfig(ModuleConfig config)
推奨されていません。 Will be removed in a release after Struts 1.1.

Perform backwards-compatible configuration of the default module's message resources configuration from servlet initialization parameters (as were used in Struts 1.0).

パラメータ:
config - The ModuleConfig object for the default module
導入されたバージョン:
Struts 1.1


このドキュメントは、Ja-Jakartaにより訳されました。コメントがある場合は、report@jajakarta.orgまでお願いします。
Copyright (C) 2000-2003 - Apache Software Foundation