デプロイメントディスクリプタ
デプロイメントディスクリプタに関する tips
デプロイメントディスクリプタの構成
以下は、デプロイメントディスクリプタの記述例。
<?xml version="1.0" encoding="Shift_JIS"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <!-- コンテナを分散可能にする --> <disributable/> <!-- Web アプリケーションの説明 --> <description>KnowledgeFort Web Experiment</description> <!-- コンテキストの表示名 --> <display-name>KnowledgeFort Web Experiment</display-name> <!-- コンテキストの初期化パラメータ(複数指定可能) --> <context-param> <!-- 説明 --> <description>Web アプリケーションの URL</description> <!-- パラメータ名 --> <param-name>context</param-name> <!-- パラメータ値 --> <param-value>http://localhost:8080/KnowledgeFortExp/</param-value> </context-param> <!-- セッションの設定 --> <session-config> <!-- タイムアウト値を分単位で設定する。 0 以下の値を設定した場合、タイムアウトは無効となる。 小数の設定は不可。 --> <session-timeout>10</session-timeout> </session-config> <!-- フィルタの登録(複数指定可能) --> <filter> <!-- フィルタ名 --> <filter-name>Html</filter-name> <!-- フィルタの完全修飾クラス名 --> <filter-class>knowledgefort.serverside.filter.HtmlFilter</filter-class> <!-- フィルタの初期化パラメータ(複数指定可能) --> <init-param> <!-- 説明 --> <description>パラメータ1</description> <!-- パラメータ名 --> <param-name>filter-param1</param-name> <!-- パラメータ値 --> <param-value>フィルタのパラメータ1</param-value> </init-param> </filter> <!-- フィルタとサーブレットの関連付け(複数指定可能) --> <filter-mapping> <!-- フィルタ名 --> <filter-name>Html</filter-name> <!-- URL パターンを設定する。 "/*" を設定した場合、JSP を含む全てのサーブレットにフィルタが適用される。 --> <url-pattern>/sample</url-pattern> <!-- フィルタを適用する動作を設定する(複数指定可能)。 以下の価を指定可能。 ・FORWARD ・INCLUDE ・REQUEST ・ERROR 何も指定しない場合は REQUEST が適用される。 --> <!-- <dispathcer>REQUEST</dispathcer>--> <dispathcer>FORWARD</dispathcer> <!-- <dispathcer>ERROR</dispathcer>--> </filter-mapping> <!-- サーブレットの登録(複数指定可能) --> <servlet> <!-- 説明 --> <description>サンプルサーブレット</description> <!-- サーブレット名 --> <servlet-name>SampleServlet</servlet-name> <!-- サーブレットの完全修飾クラス名 --> <servlet-class>knowledgefort.web.servlet.SampleServlet</servlet-class> <!-- サーブレットの初期化パラメータ(複数指定可能) --> <init-param> <!-- 説明 --> <description></description> <!-- パラメータ名 --> <param-name>param1</param-name> <!-- パラメータ値 --> <param-value>hoge</param-value> </init-param> <!-- サーブレットコンテナ起動時のサーブレット起動順序を設定する。 設定しない場合は、サーブレットは最初のリクエスト時に起動される。 0 未満の値を設定した場合は、設定しない場合と同じ。 --> <load-on-startup>2</load-on-startup> </servlet> <!-- サーブレットと URI のマッピング(複数指定可能) --> <servlet-mapping> <servlet-name>SampleServlet</servlet-name> <url-pattern>/sample</url-pattern> </servlet-mapping> <!-- JSP 設定 --> <jsp-config> <!-- JSP ページに関する設定 --> <jsp-property-group> <!-- 説明 --> <description></description> <url-pattern>*.jsp</url-pattern> <el-ignored>false</el-ignored> <!-- ページの先頭にインクルードするファイルを設定 --> <include-prelude>/WEB-INF/jsp/common/taglibs.jsp</include-prelude> </jsp-property-group> <!-- タグライブラリと URL のマッピング(複数指定可能) --> <taglib> <taglib-uri>/knowledgefort</taglib-uri> <taglib-location>/WEB-INF/tld/knowledgefort.tld</taglib-location> </taglib> <taglib> <taglib-uri>/core</taglib-uri> <taglib-location>/WEB-INF/tld/c.tld</taglib-location> </taglib> </jsp-config> <!-- Welcome ファイルのリスト --> <welcome-file-list> <!-- Welcome ファイル名(複数指定可能) --> <welcome-file>index.jsp</welcome-file> <welcome-file>index.html</welcome-file> </welcome-file-list> <!-- リスナの登録 --> <listener> <!-- リスナの完全修飾名(複数指定可能) --> <listener-class> knowledgefort.web.listener.KnowledgeFortContextListener </listener-class> <listener-class> knowledgefort.web.listener.KnowledgeFortContextAttrListener </listener-class> <listener-class> knowledgefort.web.listener.KnowledgeFortHttpSessionListener </listener-class> <listener-class> knowledgefort.web.listener.KnowledgeFortHttpSessionAttributeListener </listener-class> </listener> <!-- エラーページ(複数指定可能) --> <error-page> <!-- エラーコードを設定 --> <error-code>404</error-code> <!-- 遷移先の URI を設定 --> <location>/sample?mode=info</location> </error-page> <!-- セキュリティ制約 --> <!-- login-config より前に定義しなければならない --> <security-constraint> <!-- 表示名 --> <display-name>管理者用</display-name> <!-- セキュリティ制約の対象となるリソースを定義 --> <web-resource-collection> <!-- リソース名 --> <web-resource-name>管理者用</web-resource-name> <!-- リソースの範囲を表す URL パターン --> <url-pattern>/admin/*</url-pattern> </web-resource-collection> <!-- 制約の対象となるロールを設定。 --> <auth-constraint> <!-- ロール名を設定。 --> <role-name>worker</role-name> </auth-constraint> <user-data-constraint> <!-- クライアントとコンテナ間のデータ通信の保護種類を設定。 以下の値を設定可能。 ・NONE: 指定なし ・INTEGRAL: 完全性 ・CONFIDENTIAL: 機密性 認証方式に CLIENT-CERT を設定する場合、CONFIDENTIAL を設定すること。 --> <transport-guarantee>NONE</transport-guarantee> </user-data-constraint> </security-constraint> <!-- 認証に関する設定 --> <login-config> <!-- 認証方式を設定する。 以下の値を設定可能。 ・BASIC ・FORM ・DIGEST ・CLIENT-CERT --> <auth-method>BASIC</auth-method> <realm-name>UserDatabaseRealm</realm-name> </login-config> <!-- セキュリティロールの設定 --> <security-role> <!-- ロール名 --> <role-name>worker</role-name> </security-role> </web-app>