ページの先頭行へ戻る
Interstage Application Server/Interstage Web Server J2EE ユーザーズガイド

7.5 Webアプリケーション環境定義ファイル(deployment descriptor)

Webアプリケーション環境定義ファイル(deployment descriptor)は、Webアプリケーションの動作環境を設定します。
Webアプリケーションが複数の場合は、Webアプリケーションの数だけ用意してください。


Webアプリケーション環境定義ファイル(deployment descriptor)の記述形式

deployment descriptorの記述形式はXML形式(XMLスキーマベース)です。deployment descriptorの記述形式を以下に示します。

  <?xml version="1.0" encoding="UTF-8" ?>
  <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
        http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
      version="2.4">
    <display-name>display_name</display-name>
    <context-param>
      <param-name>name</param-name>
      <param-value>value</param-value>
    </context-param>
    <filter>
      <filter-name>name</filter-name>
      <filter-class>class</filter-class>
      <init-param>
        <param-name>name</param-name>
        <param-value>value</param-value>
      </init-param>
    </filter>
    <filter-mapping>
      <filter-name>value</filter-name>
      <servlet-name>name</servlet-name>
      <dispatcher>value</dispatcher>
    </filter-mapping>
    <filter-mapping>
      <filter-name>value</filter-name>
      <url-pattern>pattern</url-pattern>
      <dispatcher>value</dispatcher>
    </filter-mapping>
    <listener>
      <listener-class>class</listener-class>
    </listener>
    <servlet>
      <servlet-name>name</servlet-name>
      <servlet-class>class</servlet-class> または <jsp-file>file-name</jsp-file>
      <init-param>
        <param-name>name</param-name>
        <param-value>value</param-value>
      </init-param>
      <load-on-startup>priority</load-on-startup>
      <security-role-ref>
        <role-name>name</role-name>
        <role-link>name</role-link>
      </security-role-ref>
    </servlet>
    <servlet-mapping>
      <servlet-name>name</servlet-name>
      <url-pattern>pattern</url-pattern>
    </servlet-mapping>
    <session-config>
      <session-timeout>time</session-timeout>
    </session-config>
    <mime-mapping>
      <extension>ext</extension>
      <mime-type>mime</mime-type>
    </mime-mapping>
    <welcome-file-list>
      <welcome-file>filename</welcome-file>
    </welcome-file-list>
    <error-page>
      <error-code>code</error-code> または <exception-type>type</exception-type>
      <location>resource</location>
    </error-page>
    <resource-env-ref>
      <resource-env-ref-name>env-ref-name</resource-env-ref-name>
      <resource-env-ref-type>type</resource-env-ref-type>
    </resource-env-ref>
    <resource-ref>
      <res-ref-name>ref-name</res-ref-name>
      <res-type>type</res-type>
      <res-auth>signon</res-auth>
    </resource-ref>
    <security-constraint>
      <web-resource-collection>
        <web-resource-name>resource-name</web-resource-name>
        <url-pattern>pattern</url-pattern>
        <http-method>method</http-method>
      </web-resource-collection>
      <auth-constraint>
        <role-name>name</role-name>
      </auth-constraint>
      <user-data-constraint>
        <transport-guarantee>guarantee-type</transport-guarantee>
      </user-data-constraint>
    </security-constraint>
    <login-config>
      <auth-method>method</auth-method>
      <realm-name>name</realm-name>
      <form-login-config>
        <form-login-page>login-page</form-login-page>
        <form-error-page>error-page</form-error-page>
      </form-login-config>
    </login-config>
    <security-role>
      <role-name>name</role-name>
    </security-role>
    <env-entry>
      <env-entry-name>entry-name</env-entry-name>
      <env-entry-type>entry-type</env-entry-type>
      <env-entry-value>entry-value</env-entry-value>
    </env-entry>
    <ejb-ref>
      <ejb-ref-name>ref-name</ejb-ref-name>
      <ejb-ref-type>ref-type</ejb-ref-type>
      <home>ejb-home</home>
      <remote>ejb-remote</remote>
      <ejb-link>name</ejb-link>
    </ejb-ref>
    <ejb-local-ref>
      <description>description</description>
      <ejb-ref-name>name</ejb-ref-name>
      <ejb-ref-type>type</ejb-ref-type>
      <local-home>home</local-home>
      <local>remote</local>
      <ejb-link>link</ejb-link>
    </ejb-local-ref>
    <message-destination-ref>
      <description>description</description>
      <message-destination-ref-name>name</message-destination-ref-name>
      <message-destination-type>type</message-destination-type>
      <message-destination-usage>usage</message-destination-usage>
      <message-destination-link>link</message-destination-link>
    </message-destination-ref>
    <message-destination>
      <description>description</description>
      <message-destination-name>name</message-destination-name>
    </message-destination>
    <service-ref>
      <service-ref-name>name</service-ref-name>
      <service-interface>interface</service-interface>
      <wsdl-file>file</wsdl-file>
      <jaxrpc-mapping-file>file</jaxrpc-mapping-file>
    </service-ref>
    <locale-encoding-mapping-list>
      <locale-encoding-mapping>
        <locale>locale</locale>
        <encoding>encoding</encoding>
      </locale-encoding-mapping>
    </locale-encoding-mapping-list>
    <jsp-config>
      <taglib>
        <taglib-uri>uri</taglib-uri>
        <taglib-location>location</taglib-location>
      </taglib>
      <jsp-property-group>
        <url-pattern>pattern</url-pattern>
        <el-ignored>true または false</el-ignored>
        <page-encoding>value</page-encoding>
        <scripting-invalid>true または false</scripting-invalid>
        <is-xml>true または false</is-xml>
        <include-prelude>uri</include-prelude>
        <include-coda>uri</include-coda>
      </jsp-property-group>
    </jsp-config>
  </web-app>

注意

記述にあたっての注意事項

  • マニュアルに記載した定義以外はサポートしていません。

  • 先頭の<?xml...>と<web-app xmlns...>は、XML宣言、およびschemaLocationを記述しているため、deployment descriptorファイルの先頭で必ず記述してください。

  • deployment descriptorにマルチバイト文字を使用(コメントも含む)する場合は、<?xml...>のエンコード形式(「encoding=」部分)にUTF-8を指定してください。

  • 各タグの記載順序は、上記の記載順序に従ってください。

  • 省略が“×”であるタグは省略できません。
    省略した場合、タグの定義が無効、またはエラーとなります。

  • 複数の指定が“×”であるタグを重複して指定した場合は、最後に指定したタグが有効、またはエラーとなります。

  • 大文字・小文字は区別します。

  • マニュアルに記載した定義以外を指定した場合、エラーメッセージが出力されずにServletサービスが起動する場合がありますので注意してください。

  • Servlet2.2または2.3のdeployment descriptorの記述形式も使用できます。

  • 配備済みのアプリケーションのdeployment descriptorの記述形式を、Servlet2.2または2.3からServlet2.4の記述形式に変更する場合は、アプリケーションを配備しなおしてください。

  • 名前空間プレフィックスつきのタグは指定しないでください。
    指定した場合、配備に失敗したり、名前変換機能が使用できなくなることがあります。
      例:<pfx:servlet>

  • パス名に指定できる文字は以下のとおりです。
    英数字、'+'、'-'、'_'、'.'、' ’、'$'、'%'、':'、'\'、'~'

  • パス名は最大255バイトまでです。

  • パス名に指定できる文字は以下のとおりです。
    英数字、'+'、'-'、'_'、'.'、'$'、'%'、'/'、'~'

  • パス名は最大1023バイトまでです。

Webアプリケーション環境定義ファイル(deployment descriptor)のタグ

Webアプリケーション環境定義ファイル(deployment descriptor)には、以下のタグを指定することができます。
web-app以外のタグは省略可能です。必要に応じて定義してください。
各タグの開始タグと終了タグの間に下位階層のタグを設定し、詳細を定義することができます。

タグ名

説明

タグの省略

複数の指定

web-app

Webアプリケーション環境定義ファイル(deployment descriptor)の開始と終了を定義します。

×

×

display-name

サーブレットコンテキストの名前を定義します。

×

context-param

サーブレットコンテキストに設定する初期化パラメタを定義します。サーブレットコンテキストには、Webアプリケーションのすべてのサーブレットに共通の情報を設定し、取り出すことができます。

filter

フィルタクラスを定義します。

filter-mapping

フィルタクラスを適用する対象を定義します。

listener

Webアプリケーションで発生したイベントに応じて何らかの処理を行いたい場合、ここに実装クラス名を定義します。

servlet

サーブレットの初期化パラメタ、エイリアスなどの、サーブレットの属性を定義します。

servlet-mapping

URLをサーブレットやJSPに対応するためのサーブレット・マッピングの定義をします。

session-config

セション管理を使用する場合、セションパラメタの定義をします。

×

mime-mapping

サーブレットAPIで取り出すmimeタイプを定義します。

welcome-file-list

URLにファイル名を指定しなかった場合に表示するwelcome fileを定義します。

error-page

エラーコードやJavaの例外タイプに対応するリソースを定義します。

security-constraint

Webアプリケーションのアクセス制限を定義します。

login-config

ユーザ認証の方法を定義します。

×

security-role

アクセス制限で使用するセキュリティロールを定義します。

locale-encoding-mapping-list

ロケールと文字コードの対応を定義します。

jsp-config

Webアプリケーション内のJSPで共通の値を定義します。

×

参照

以下のタグについては、“4.9 deployment descriptorファイルへの記述”を参照してください。

  • resource-env-ref

  • resource-ref

  • env-entry

  • ejb-ref

  • ejb-local-ref

  • message-destination-ref

  • message-destination

  • service-ref

ポイント

各タグ説明の記述例では、説明しているタグ以外のタグの記述は省略しています。
なお、記述例は、Solarisシステムの場合で記述しています。
Windows(R)システムの場合は、適宜、パスを読み替えてください。