We're updating the issue view to help you get more done. 

Upgrade to Servlet Spec 2.4 breaks web.xml merging capabilities for NodeMerge strategy

Description

When the below merge.xml is used:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 <?xml version="1.0" encoding="UTF-8"?> <uberwar> <wars> <war>com.example.uberwar:uberwar-base-webapp</war> <war>com.example.uberwar:uberwar-overlay-webapp</war> </wars> <merges> <merge> <type>web.xml</type> <parameters> <default> <tag name="context-param"> <strategy name="ChooseByName"> <default> <strategy name="Overwrite"/> </default> <choice name="contextConfigLocation"> <strategy name="NodeMerge"> <context-param> <param-name>$left:param-name</param-name> <param-value>$left:param-value,$right:param-value</param-value> </context-param> </strategy> </choice> </strategy> </tag> </default> </parameters> </merge> </merges> </uberwar>

Change of merged web.xml headers from

1 2 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app>

to

1 2 3 4 <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">

results in incorrect context-param merge.

Result for 2.3 format (correct):

1 2 3 4 5 6 7 8 9 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>UberWar Test - Overlay</display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/config/base-config.xml,/WEB-INF/config/overlay-config.xml</param-value> </context-param> </web-app>

Result for 2.4 format (incorrect):

1 2 3 4 5 6 7 8 9 10 11 12 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <display-name>UberWar Test - Overlay</display-name> <context-param> <param-name /> <param-value>,</param-value> </context-param> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/config/overlay-config.xml</param-value> </context-param> </web-app>

See attached sample projects that merge web.xml of both formats.

Status

Assignee

Savas Ali Tokmen

Reporter

Anton Khitrenovich

Components

Fix versions

Affects versions

1.3.2

Priority

Major