WebSphere 확장을 사용하여 가상 디렉토리 맵핑 정의

WebLogic 가상 디렉토리 맵핑을 이용하면 애플리케이션의 문서 루트 외부에 있는 정적 파일이나 이미지와 같은 파일을 애플리케이션에서 제공할 수 있습니다. WebSphere 파일 제공 기능을 사용하여 이러한 파일을 제공할 수 있습니다. 이 규칙은 weblogic.xml 파일에서 <virtual-directory-mapping> 요소를 발견합니다. 소스 스캐너에서 빠른 수정사항을 사용할 수 있습니다. 빠른 수정사항을 사용하여 WebSphere traditional 또는 Liberty 웹 확장 파일에서 해당 <fileServingAttributes> 요소를 작성할 수 있습니다.

예를 들어 weblogic.xml 파일에는 다음 맵핑이 포함될 수 있습니다.

<virtual-directory-mapping>
<local-path>c:/usr/files</local-path>
<url-pattern>/images/*</url-pattern>
<url-pattern>*.jpg</url-pattern>
</virtual-directory-mapping>

다음 예제에 표시된 것과 동일한 정보를 WebSphere Application Server 웹 확장에서 정의할 수 있습니다.

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

extendedDocumentRoot 파일 제공 속성은 애플리케이션 웹 모듈 외부에 있는 둘 이상의 루트에 대한 쉼표로 구분된 문자열입니다.

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="*"/>

자세한 정보 및 예제는 다음 자원을 참조하십시오.