この規則により、META-INF/context.xml ファイル内に見つかった Context <Parameter> エレメントにフラグを立てます。
Apache Tomcat では、Context <Parameter> エレメントを以下の場所で定義できます。
マイグレーション・ツールがマイグレーションするのは、META-INF/context.xml ファイル内のパラメーター・エレメントのみです。 その他の場所で定義されたパラメーター情報は、処理できるように META-INF/context.xml ファイルにコピーできます。
Web プロジェクトに WEB-INF/web.xml が存在するとします。
以下のいずれかの条件が該当すると、Context <Parameter> エレメントにフラグが立てられます。
ソース・スキャナーで、この規則のクイック・フィックスが使用可能です。web.xml ファイル内に Context <Parameter> エレメントを表す <context-param> エレメントがまだ存在していなければ、クイック・フィックスは、そのエレメントを新規に web.xml ファイルに追加します。 エントリーが存在する場合は、更新されます。
WEB-INF/web.xml が存在しない場合は、以下のようになります。
すべての Context <Parameter> エレメントにフラグが立てられます。
Web プロジェクトが Java EE 5 以降である場合、クイック・フィックスが適切な <context-param> エレメントを含む WEB-INF/web.xml ファイルを作成します。Web プロジェクトが J2EE 1.4 以下である場合、クイック・フィックスはエラーを報告します。
例えば、META-INF/context.xml ファイルに以下のようなコンテンツがあります。
|
<Parameter description="Trigger because it does not exist" name="newEntry" override="false" value="abc123"/> <Parameter description="Trigger because of different value" name="parameter_1" override="false" value="new Value"/> <Parameter description="Will not trigger because of override set to true" name="parameter_2" override="true" value="123"/> |
このファイルに関連して、アプリケーションには以下の web.xml ファイルがあります。
|
<context-param> <description>Trigger because of different value</description> <param-name>parameter_1</param-name> <param-value>oldValue</param-value> </context-param> <context-param> <description>Will not trigger because of override set to true</description> <param-name>parameter_2</param-name> <param-value>123456789</param-value> </context-param> |
クイック・フィックスが適用されると、web.xml は、以下を含むように更新されます。
|
<context-param> <description>Trigger because it does not exist</description> <param-name>newEntry</param-name> <param-value>abc123</param-value> </context-param> <context-param> <description>Trigger because of different value</description> <param-name>parameter_1</param-name> <param-value>new Value</param-value> </context-param> <context-param> <description>Will not trigger because of override set to true</description> <param-name>parameter_2</param-name> <param-value>123456789</param-value> </context-param> |
Tomcat でのコンテキスト・パラメーターについて詳しくは、以下を参照してください。