仮想ディレクトリー・マッピングの定義に WebSphere 拡張を使用する

WebLogic 仮想ディレクトリー・マッピングにより、アプリケーションはアプリケーションの文書ルートの外部にあるイメージ・ファイルや静的ファイルなどのファイルを処理できます。 WebSphere ファイル・サービス・フィーチャーを使用してこれらのファイルを処理できます。 このルールは、<virtual-directory-mapping>要素の存在を検出します。 weblogic.xml ファイルに存在することを検出します。 この自動修正機能は 対応する <fileServingAttributes> 要素を WebSphere 伝統的な、または Liberty ウェブ拡張ファイルに対応する要素を作成するのに役立ちます。

例えば、weblogic.xml ファイルは以下のマッピングを含むことができます。

< < span class="tag"> 仮想ディレクトリー・マッピング < /span>>
<ローカルパス >c :/usr / files</ローカルパス
< url-pattern >/images/*</ url-pattern >
<url-pattern >*. jpg </url-pattern>
</バーチャル・ディレクトリ・マッピング

以下の例に示されるように、同じ情報を WebSphere Application Server Web 拡張で定義することができます。

<fileServing属性 xmi: id = "FileServingAttribute_1" name= "extendedDocumentRoot" value="c:/usr/files"/>
<fileServingAttributes xmi:id ="FileServingAttribute_2" name=" file.serving.patterns.allow " value="/images/* *.jpg"/>

extendedDocumentRoot ファイル・サービス属性は、アプリケーション Web モジュールの外部に存在する複数のルートを表す、コンマで区切ったストリングです。

file.serving.patterns.allow ファイル・サービス属性は、複数のパターンを表すスペースで区切ったストリングです。

複数の場所に静的コンテンツのあるアプリケーションからのコンテンツを処理するのに 問題が起きることがあります。 WebLogic では、定義された virtual-directory-mapping はどれも コンテキスト・ルートとディレクトリーの場所の両方から使用可能です。 WebSphere Application Server では、file.serving.patterns.allow プロパティーが、 拡張された文書ルートまたはコンテキスト・ルート内の指定されたパターンに一致する静的コンテンツへの アクセスを制限します。

ファイルの編成方法によっては、 file.serving.patterns.allow プロパティー値の変更が必要な場合があります。例えば、

<fileServingAttributes xmi:id ="FileServingAttribute_1" name="extendedDocumentRoot" value="/common/files"/>
<fileServingAttributes xmi:id ="FileServingAttribute_2" name=" file.serving.patterns.allow " value="/images/*"/>

コンテキスト・ルートの /common/files および /common/files/imagesimages ディレクトリーがある場合、 /common/files/imagesfile.serving.patterns.allow プロパティー値に追加します。

<fileServingAttributes xmi:id ="FileServingAttribute_1" name="extendedDocumentRoot" value="/common/files"/>
<fileServingAttributes xmi:id ="FileServingAttribute_2" name=" file.serving.patterns.allow " value="/images/* /common/files/images/*"/>

以下の例の設定を使用してファイルへの幅広いアクセスを許可できますが、この設定を使用すると 意図したよりも多くのコンテンツがアプリケーションで使用可能になることがあります。

<fileServingAttributes xmi:id ="FileServingAttribute_2" name=" file.serving.patterns.allow " value="*"/>

詳細と例については、以下のリソースを参照してください。