6.2.5. 設定ファイルに指定する方法¶
パーツの組み合わせ方を静的に決定する場合、設定ファイルに記述します。手順は以下の通りです。
- 設定ファイルを配置する。
- 設定ファイルの内容を指定する。
設定ファイルは、WEB-INF/conf 配下の PageBuilder の実装毎のフォルダに配置します。ファイル名は任意です。
適用したい PageBuilder 指定する値 HeadWithFooterThemeBuilder WEB-INF/conf/theme-head-with-footer-path-config HeadWithContainerThemeBuilder WEB-INF/conf/theme-head-with-container-path-config HeadOnlyThemeBuilder WEB-INF/conf/theme-head-only-path-config BodyOnlyThemeBuilder WEB-INF/conf/theme-body-only-path-config NoThemeBuilder WEB-INF/conf/theme-no-theme-path-config FullThemeBuilder なし
注意
それぞれの設定ファイルは異なる XML Schema で定義されています。
いずれかの設定ファイルを別のフォルダにコピーしても動作しないので注意してください。
6.2.5.1. 設定ファイルに指定する例¶
設定ファイルで指定する方法の例として、http://hostname/iap/sample/page へのリクエストを head 、 body 、 footer を含んだ HTML としたい場合を取り上げます。この場合、使用する PageBuilder は、 HeadWithFooterThemeBuilder になります。HeadWithFooterThemeBuilder の設定ファイルは以下のようになります。
1 2 3 4 <?xml version="1.0" encoding="UTF-8"?> <theme-head-with-footer-path-config xmlns="http://www.intra-mart.jp/theme/theme-head-with-footer-path-config"> <path>/sample/page</path> </theme-head-only-path-config>path の中に、コンテキストパス以下のパスを、”/” から記述します。
別の例として、http://hostname/iap/example/{parameter1}、http://hostname/iap/example/{parameter1}/{parameter2} へのリクエストを異なるビルダーモジュールで表示する場合を取り上げます。この場合、正規表現を利用して path を表現します。path 要素に regex 属性を true として追加することで正規表現として扱われます。
1 2 3 4 <?xml version="1.0" encoding="UTF-8"?> <theme-head-with-container-path-config xmlns="http://www.intra-mart.jp/theme/theme-head-with-container-path-config"> <path regex="true">/example/[^/]+?</path> </theme-head-only-path-config>
1 2 3 4 <?xml version="1.0" encoding="UTF-8"?> <theme-head-with-footer-path-config xmlns="http://www.intra-mart.jp/theme/theme-head-with-footer-path-config"> <path regex="true">/example/[^/]+?/[^/]+?</path> </theme-head-only-path-config>