Java EE 배치 디스크립터를 사용하여 컨텍스트 매개변수 정의

이 규칙은 다음을 플래그 지정합니다. Context <Parameter> 요소가 META-INF/context.xml 파일에 있습니다.

Apache Tomcat 은 다음을 허용합니다. Context <Parameter> 다음 위치에 정의될 요소:

마이그레이션 도구는 META-INF/context.xml 파일의 매개변수 요소만 마이그레이션합니다. 기타 위치에 정의되어 있는 매개변수 정보를 META-INF/context.xml 파일에 복사하여 마이그레이션 도구로 처리할 수 있습니다.

WEB-INF/web.xml 파일이 웹 프로젝트에 존재하는 경우,

Context <Parameter> 요소는 다음 조건 중 하나에 따라 플래그가 지정됩니다:

자동화된 수정은 새로운 <context-param> 요소는 web.xml 파일에서 는 Context <Parameter> 요소에 아직 존재하지 않는 경우 web.xml 파일에 존재하지 않으면 이 항목이 존재하는 경우에는 해당 항목이 업데이트됩니다.

WEB-INF/web.xml 파일이 존재하지 않는 경우,

모두 Context <Parameter> 요소에 플래그가 지정됩니다.

자동화된 수정은 WEB-INF/web.xml 파일 파일이 생성되며, 여기에는 적절한 <context-param> 요소가 웹 프로젝트가 Java EE 5 이상인 경우. 자동화된 수정은 웹 프로젝트가 가 J2EE 1.4 이하인 경우 오류를 보고합니다.

예를 들어, 다음 컨텐츠가 있는 META-INF/context.xml 파일과

<파라미터
description="Trigger because it does not exist"
name="newEntry"
override="false"
value=" abc123 "/>
<Parameter
description="Trigger because of different value"
name="parameter_1"
override="false"
value="new Value"/>
<Parameter
description="Will not trigger because of override set to true"
name="parameter_2"
override="true"
value="123"/>

애플리케이션의 web.xml 파일을 생각해 보십시오.

<컨텍스트-파라미터>
<description>다른 값으로 인해 트리거</description>
<param-name>parameter_1</param-name>
<param-value>oldValue</param-value>
</context-param>

<context-param>
<description>True로 설정된 오버라이드로 인해 트리거되지 않습니다</description>
<param-name>parameter_2</param-name>
<param-value>123456789</param-value>
</context-param>

자동 수정이 적용되면 web.xml 는 다음과 같이 업데이트됩니다 포함:

<컨텍스트-파라미터>
<description>존재하지 않기 때문에 트리거</description>
<param-name>newEntry</param-name>
<param-value>abc123</param-value>
</context-param>

<context-param>
<description>다른 값으로 인해 트리거</description>
<param-name>parameter_1</param-name>
<param-value>새로운 가치</param-value>
</context-param>

<context-param>
<description>True로 설정된 오버라이드로 인해 트리거되지 않습니다</description>
<param-name>parameter_2</param-name>
<param-value>123456789</param-value>
</context-param>

Tomcat의 컨텍스트 매개변수에 대한 추가 정보는 다음을 참조하십시오.