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
直系の既知のサブクラス:
RedeployableActionServlet

public class ActionServlet
extends javax.servlet.http.HttpServlet

ActionServletは、 "モデル2"として一般に知られている、 WEBアプリケーションのためのモデル-ビュー-コントローラ(MVC)デザインパターンの"コントローラ"を提供します。 この命名の起源はJavaServerPages仕様の0.92の記述であり、 (他に適当な名前がないため)それ以来ずっと続いています。

ActionServlet provides 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).

"モデル2"アプリケーションのアーキテクチャは概ね次の通りです。:

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

RequestsProcessorの標準バージョンは、 各HTTPリクエストに対する以下のようなロジックを実装しています。 このオブジェクトをサブクラス化して独自の処理を実装するために、 いくつかまたは全ての機能をオーバーライドすることができます。

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

ActionServletの標準バージョンは、 Webアプリケーション用の配備記述ファイル(/WEB-INF/web.xml)で規定された、 以下のサーブレット初期化パラメータをもとに初期化されます。 このサーブレットのサブクラスでは、 追加の初期化パラメータを自由に定義できます。

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.

バージョン:
$Revision: 1.5 $ $Date: 2005/05/09 13:23:57 $
関連項目:
直列化された形式
翻訳者:
田中 良浩, 棚澤 昌幸
校正者:
翻訳状況:
初稿(校正者募集中)

フィールドの概要
protected  java.lang.String config
          デフォルトモジュールのための設定リソースへのコンテキスト相対パスのカンマで区切られたリスト。
protected  org.apache.commons.digester.Digester configDigester
          Struts設定ファイルからModuleConfigオブジェクトを生成するために使用されるDigester。
protected  boolean convertNull
          ラッパクラス型に関するフォームBeanのプロパティにおける振る舞いの下位互換性の対応要求フラグ。
protected  org.apache.commons.collections.FastHashMap dataSources
          もしあれば、 保存される際のサーブレットコンテキスト属性名をキーとする、 このモジュールで設定されたJDBCデータソース。
protected  MessageResources internal
          内部リソースのためのリソースオブジェクト。
protected  java.lang.String internalName
          内部リソースの基本クラス名。
protected static org.apache.commons.logging.Log log
          Commons Loggingのインスタンス。
protected  RequestProcessor processor
          全てのリクエストを処理するために使用するRequestProcessorのインスタンス。
protected  java.lang.String[] registrations
          使用すべき設定ファイルのDTDのバージョンを表すための、 公開された識別子と対応するリソース名のセットです。
protected  java.lang.String servletMapping
          Webアプリケーションの配備記述子で設定されたURLパターン。
protected  java.lang.String servletName
          Webアプリケーションの配備記述子で登録されているサーブレット名。
 
クラス javax.servlet.http.HttpServlet から継承したフィールド
 
コンストラクタの概要
ActionServlet()
           
 
メソッドの概要
private  void addRuleSets()
          rulesets初期化パラメータで指定されたconfigDigesterに、 全てのカスタムRuleSetのインスタンスを追加します {@primary Add any custom RuleSet instances to configDigester that have been specified in the rulesets init parameter.
 void addServletMapping(java.lang.String servletName, java.lang.String urlPattern)
          このサーブレット用である場合、 Webアプリケーションの配備記述子からサーブレットマッピングを設定します。
 void destroy()
          このコントローラサーブレットを速やかに停止し、 初期化時に確保されたあらゆるリソースを解放します。
protected  void destroyConfigDigester()
          生成されたconfigDigesterのインスタンスを全て速やかに解放します。
protected  void destroyInternal()
          内部のMessageResourcesの使用を速やかに終了します。
protected  void destroyModules()
          (もしあれば) このアプリケーションに関連づけられた全てのモジュールの使用を速やかに終了します。
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          HTTPの"GET"リクエストを処理します。
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           HTTPの"POST"リクエストを処理します。
 MessageResources getInternal()
          内部メッセージの文字列を含むMessageResourcesのインスタンスを返します。
protected  ModuleConfig getModuleConfig(javax.servlet.http.HttpServletRequest request)
          現在選択されているモジュールのモジュール設定オブジェクトを返します。
private  RequestProcessor getProcessorForModule(ModuleConfig config)
          与えられたモジュールのRequestProcessorを返し、 存在しない場合はnullを返します。
protected  RequestProcessor getRequestProcessor(ModuleConfig config)
          指定されたモジュールに関係するRequestProcessorを探して、 必要に応じて新たに生成し、 返します。
private  void handleConfigException(java.lang.String path, java.lang.Exception e)
          parseModuleConfigFileメソッドにおける例外の扱いを簡略化します。
 void init()
          このサーブレットを初期化します。
protected  org.apache.commons.digester.Digester initConfigDigester()
          Strutsモジュール設定ファイルの処理されて、 (解析が行われる前に評価スタックに入れられるべき) 対応するModuleConfigオブジェクトの設定で初期化された、 新たなDigesterインスタンスを(必要に応じて)生成して返します。
protected  void initInternal()
          内部のMessageResourcesの纏まりを初期化します。
protected  ModuleConfig initModuleConfig(java.lang.String prefix, java.lang.String paths)
          指定されたモジュールのモジュール設定情報を初期化します。
protected  void initModuleConfigFactory()
          モジュール設定を生成するために使用されるファクトリを初期化します。
protected  void initModuleDataSources(ModuleConfig config)
          指定されたモジュールのデータソースを初期化します。
protected  void initModuleMessageResources(ModuleConfig config)
          指定されたモジュールのアプリケーションMessageResourcesを初期化します。
protected  void initModulePlugIns(ModuleConfig config)
          指定されたモジュールのプラグインを初期化します。
protected  void initModulePrefixes(javax.servlet.ServletContext context)
          Globals.MODULE_PREFIXES_KEYに基づき、 サーブレットコンテキスト内のモジュールプレフィックスであるString[]を保存します 注意 - デフォルトモジュールのためのプレフィックスである""はこのリスト中に含まれません。
protected  void initOther()
          コントローラサーブレットの他のグローバル特性を初期化します。
protected  void initServlet()
          コントローラサーブレットがアクセスするサーブレットマッピングを初期化します。
private  boolean isValidating()
          validatingの初期化パラメータの状態を確認します。
protected  void parseModuleConfigFile(org.apache.commons.digester.Digester digester, java.lang.String path)
          モジュール設定ファイルを解析します。
protected  void process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse 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

Struts設定ファイルからModuleConfigオブジェクトを生成するために使用されるDigester。

The Digester used to produce ModuleConfig objects from a Struts configuration file.

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

convertNull

protected boolean convertNull

ラッパクラス型に関するフォームBeanのプロパティにおける振る舞いの下位互換性の対応要求フラグ。

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

もしあれば、 保存される際のサーブレットコンテキスト属性名をキーとする、 このモジュールで設定されたJDBCデータソース。

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


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のインスタンス。

Commons Logging instance.

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

processor

protected RequestProcessor processor

全てのリクエストを処理するために使用するRequestProcessorのインスタンス。

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

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

registrations

protected java.lang.String[] registrations

使用すべき設定ファイルのDTDのバージョンを表すための、 公開された識別子と対応するリソース名のセットです。 このリストの数は必ず偶数であること!

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

Webアプリケーションの配備記述子で設定されたURLパターン。

The URL pattern to which we are mapped in our web application deployment descriptor.


servletName

protected java.lang.String servletName

Webアプリケーションの配備記述子で登録されているサーブレット名。

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 - 正しく初期化できなかった場合
@exception ServletException if we cannot configure ourselves correctly

initModulePrefixes

protected void initModulePrefixes(javax.servlet.ServletContext context)

Globals.MODULE_PREFIXES_KEYに基づき、 サーブレットコンテキスト内のモジュールプレフィックスであるString[]を保存します 注意 - デフォルトモジュールのためのプレフィックスである""はこのリスト中に含まれません。

Saves a String[] of module prefixes in the ServletContext under Globals.MODULE_PREFIXES_KEY. NOTE - the "" prefix for the default module is not included in this list.

パラメータ:
context - サーブレットコンテキスト
@param context The servlet context.
導入されたバージョン:
Struts 1.2

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws java.io.IOException,
                  javax.servlet.ServletException

HTTPの"GET"リクエストを処理します。

Process an HTTP "GET" request.

パラメータ:
request - 処理中のサーブレットリクエスト
@param request The servlet request we are processing
response - 生成するサーブレットレスポンス
@param response The servlet response we are creating
例外:
java.io.IOException - 入出力エラーが発生した場合
@exception IOException if an input/output error occurs
javax.servlet.ServletException - サーブレットで例外が発生した場合
@exception 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

HTTPの"POST"リクエストを処理します。

Process an HTTP "POST" request.

パラメータ:
request - 処理中のサーブレットリクエスト
@param request The servlet request we are processing
response - 生成するサーブレットレスポンス
@param response The servlet response we are creating
例外:
java.io.IOException - 入出力エラーが発生した場合
@exception IOException if an input/output error occurs
javax.servlet.ServletException - サーブレットで例外が発生した場合
@exception ServletException if a servlet exception occurs

addServletMapping

public void addServletMapping(java.lang.String servletName,
                              java.lang.String urlPattern)

このサーブレット用である場合、 Webアプリケーションの配備記述子からサーブレットマッピングを設定します。

Remember a servlet mapping from our web application deployment descriptor, if it is for this servlet.

パラメータ:
servletName - マップされているサーブレットの名前
@param servletName The name of the servlet being mapped
urlPattern - このサーブレットにマップされているURLパターン
@param urlPattern The URL pattern to which this servlet is mapped

getInternal

public MessageResources getInternal()

内部メッセージの文字列を含むMessageResourcesのインスタンスを返します。

Return the MessageResources instance containing our internal message strings.

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

生成されたconfigDigesterのインスタンスを全て速やかに解放します。

Gracefully release any configDigester instance that we have created.

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

destroyInternal

protected void destroyInternal()

内部のMessageResourcesの使用を速やかに終了します。

Gracefully terminate use of the internal MessageResources.


getModuleConfig

protected ModuleConfig getModuleConfig(javax.servlet.http.HttpServletRequest request)

現在選択されているモジュールのモジュール設定オブジェクトを返します。

Return the module configuration object for the currently selected module.

パラメータ:
request - 処理中のサーブレットリクエスト
@param request The servlet request we are processing
導入されたバージョン:
Struts 1.1

getRequestProcessor

protected RequestProcessor getRequestProcessor(ModuleConfig config)
                                        throws javax.servlet.ServletException

指定されたモジュールに関係するRequestProcessorを探して、 必要に応じて新たに生成し、 返します。

Look up and return the {@link RequestProcessor} responsible for the specified module, creating a new one if necessary.

パラメータ:
config - 取得してRequestProcessorを返すためのモジュールの設定
@param config The module configuration for which to acquire and return a RequestProcessor.
例外:
javax.servlet.ServletException - RequestProcessorのインスタンスを生成できない場合
@exception ServletException if we cannot instantiate a RequestProcessor instance
導入されたバージョン:
Struts 1.1

getProcessorForModule

private RequestProcessor getProcessorForModule(ModuleConfig config)

与えられたモジュールのRequestProcessorを返し、 存在しない場合はnullを返します。 このメソッドはRequestProcessorを生成しません。

Returns the RequestProcessor for the given module or null if one does not exist. This method will not create a RequestProcessor.

パラメータ:
config - ModuleConfig
@param config The ModuleConfig.

initModuleConfigFactory

protected void initModuleConfigFactory()

モジュール設定を生成するために使用されるファクトリを初期化します。

Initialize the factory used to create the module configuration.

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

initModuleConfig

protected ModuleConfig initModuleConfig(java.lang.String prefix,
                                        java.lang.String paths)
                                 throws javax.servlet.ServletException

指定されたモジュールのモジュール設定情報を初期化します。

Initialize the module configuration information for the specified module.

パラメータ:
prefix - このモジュールのモジュールプレフィックス
@param prefix Module prefix for this module
paths - このモジュールの設定リソースのためのコンテキスト相対パスのカンマで区切られたリスト
@param paths Comma-separated list of context-relative resource path(s) for this modules's configuration resource(s)
例外:
javax.servlet.ServletException - 初期化が実行できなかった場合
@exception ServletException if initialization cannot be performed
導入されたバージョン:
Struts 1.1

parseModuleConfigFile

protected void parseModuleConfigFile(org.apache.commons.digester.Digester digester,
                                     java.lang.String path)
                              throws javax.servlet.UnavailableException

モジュール設定ファイルを解析します。

Parses one module config file.

パラメータ:
digester - 解析するためのDigesterインスタンス
@param digester Digester instance that does the parsing
path - 解析する設定ファイルへのパス
@param path The path to the config file to parse.
例外:
javax.servlet.UnavailableException - ファイルが読めないかまたは解析できない場合
@throws UnavailableException if file cannot be read or parsed
導入されたバージョン:
Struts 1.2

handleConfigException

private void handleConfigException(java.lang.String path,
                                   java.lang.Exception e)
                            throws javax.servlet.UnavailableException

parseModuleConfigFileメソッドにおける例外の扱いを簡略化します。

Simplifies exception handling in the parseModuleConfigFile method.

パラメータ:
path -
e -
例外:
javax.servlet.UnavailableException - 例外のラッパ
@throws UnavailableException as a wrapper around Exception

initModuleDataSources

protected void initModuleDataSources(ModuleConfig config)
                              throws javax.servlet.ServletException

指定されたモジュールのデータソースを初期化します。

Initialize the data sources for the specified module.

パラメータ:
config - このモジュールのModuleConfig情報
@param config ModuleConfig information for this module
例外:
javax.servlet.ServletException - 初期化が実行できなかった場合
@exception 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情報
@param config ModuleConfig information for this module
例外:
javax.servlet.ServletException - 初期化が実行できなかった場合
@exception ServletException if initialization cannot be performed
導入されたバージョン:
Struts 1.1

initModuleMessageResources

protected void initModuleMessageResources(ModuleConfig config)
                                   throws javax.servlet.ServletException

指定されたモジュールのアプリケーションMessageResourcesを初期化します。

Initialize the application MessageResources for the specified module.

パラメータ:
config - このモジュールのModuleConfig情報
@param config ModuleConfig information for this module
例外:
javax.servlet.ServletException - 初期化が実行できなかった場合
@exception ServletException if initialization cannot be performed
導入されたバージョン:
Struts 1.1

initConfigDigester

protected org.apache.commons.digester.Digester initConfigDigester()
                                                           throws javax.servlet.ServletException

Strutsモジュール設定ファイルの処理されて、 (解析が行われる前に評価スタックに入れられるべき) 対応するModuleConfigオブジェクトの設定で初期化された、 新たなDigesterインスタンスを(必要に応じて)生成して返します。

Create (if needed) and return a new Digester instance that has been initialized to process Struts module configuration files and configure a corresponding ModuleConfig object (which must be pushed on to the evaluation stack before parsing begins).

例外:
javax.servlet.ServletException - Digesterが設定できなかった場合
@exception ServletException if a Digester cannot be configured
導入されたバージョン:
Struts 1.1

addRuleSets

private void addRuleSets()
                  throws javax.servlet.ServletException

rulesets初期化パラメータで指定されたconfigDigesterに、 全てのカスタムRuleSetのインスタンスを追加します

Add any custom RuleSet instances to configDigester that have been specified in the rulesets init parameter.

例外:
javax.servlet.ServletException

isValidating

private boolean isValidating()

validatingの初期化パラメータの状態を確認します。

Check the status of the validating initialization parameter.

戻り値:
true モジュールDigesterが妥当性検証すべき場合
@return true if the module Digester should validate.

initInternal

protected void initInternal()
                     throws javax.servlet.ServletException

内部のMessageResourcesの纏まりを初期化します。

Initialize our internal MessageResources bundle.

例外:
javax.servlet.ServletException - これらのリソースを初期化できなかった場合
@exception 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 - これらのリソースを初期化できなかった場合
@exception ServletException if we cannot initialize these resources

initServlet

protected void initServlet()
                    throws javax.servlet.ServletException

コントローラサーブレットがアクセスするサーブレットマッピングを初期化します。 これは、 フォームを送信するための適切な遷移先のURLを生成する、 &html:form>タグで使用されます。

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 - web.xmlを調べている間にエラーが発生した場合
@throws 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.

パラメータ:
response - 生成するサーブレットレスポンス
@param response The servlet response we are creating
例外:
java.io.IOException - 入出力エラーが生じた場合
@exception IOException if an input/output error occurs
javax.servlet.ServletException - サーブレット例外が生じた場合
@exception ServletException if a servlet exception is thrown


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