Forums: Open Discussion (Thread #19435)

Strutsのモジュール単位のプロパティファイル (2008-07-28 14:19 by Anonymous #37855)

お世話になります。

 「TERASOLUNA Server Framework for Java 2.0.1.0」を使用させて頂いておりますが、PropertyUtilに関して質問致します。
 
 PropertyUtilは、プロパティファイルの設定内容を取得できますが、Strutsのモジュールが複数ある場合も、プロパティファイルは、モジュール全体で共通と思います。
 そこで、モジュール単位で別のプロパティファイルを読む仕組みは無いでしょうか?
 できれば、モジュールとプロパティファイル名を、何かで関連付けて、プロパティを取得する側は、プロパティファイル名を意識しないで済む仕組みがあればと思います。

 よろしくお願い致します。

Reply to #37855×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: Strutsのモジュール単位のプロパティファイル (2008-07-30 20:49 by kimumasa #37946)

PropertyUtilにモジュール単位で読む仕掛けはございません。
また、PropertyUtil自体はプロパティファイルを意識させる事もできますが
getProperty(java.lang.String key)
でデータ取得する場合はプロパティファイルを意識しません。

現状であれば、プロパティファイル内のキーに
モジュール名を付与して管理する等の手立てで対応する事になると思われます。

拡張する場合、単純なユーティリティクラスであるPropertyUtilからはURLやリクエストデータからモジュール名を取ることが出来ないため、
・FilterやRequestProcessorでモジュール名を取ってThreadLocalにデータ設定
・PropertyUtilからThreadLocalを読み上げてモジュール名をキーにし、データを取る
という事になると思いますが、
Filterの設定ミスのリスク等を考えるとあまり良い拡張とは思えないと
個人的には思います。
Reply to #37855

Reply to #37946×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: Strutsのモジュール単位のプロパティファイル (2008-07-31 09:02 by Anonymous #37960)

 返信ありがとうございます。

 現状、Strutsのモジュール単位でプロパティを管理するとなると、メッセージリソース定義ファイル(Struts設定ファイルのmessage-resources要素のparameterで指定)しかないかと、考えております。
Reply to #37855

Reply to #37960×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login