-
Enhancement
-
Resolution: Done
-
Major
-
None
-
None
-
None
-
False
-
False
-
-
Untriaged
So, if the same file is available on more than one overlay, which one should we look into first?
Maybe this is already the current behavior? I'll have to check that.
Update: It turns out that it is the current behavior after all: the order in which overlays are declared in the XML is the priority order when looking for a resource.
External overlays are processed here: https://github.com/wildfly/wildfly/blob/27.0.0.Alpha1/undertow/src/main/java/org/wildfly/extension/undertow/deployment/ServletResourceManager.java#L62
The ServletResourceManager is responsible for reading the resource and returning it, and it iterates through the list created above, returning the first resource it finds: https://github.com/wildfly/wildfly/blob/27.0.0.Alpha1/undertow/src/main/java/org/wildfly/extension/undertow/deployment/ServletResourceManager.java#L92
The overlays that are processed by ServletResourceManager constructor are created when parsing the XML, at: https://github.com/jboss/metadata/blob/15.1.0.Alpha1/web/src/main/java/org/jboss/metadata/parser/jbossweb/JBossWebMetaDataParser.java#L170
Because they are added to an ArrayList, it means they are added to the end of such array list, and hence the order in which they are declared in the xml is maintained. (later on during deployment, the JBossWebMetaData is merged here https://github.com/jboss/metadata/blob/15.1.0.Alpha1/web/src/main/java/org/jboss/metadata/merge/web/jboss/JBossWebMetaDataMerger.java#L243 where only the override overlay list is read and hence the order is maintened; the resulting JBossWebMetaData is set in the WarMetaData here: https://github.com/wildfly/wildfly/blob/27.0.0.Alpha1/undertow/src/main/java/org/wildfly/extension/undertow/deployment/WarMetaDataProcessor.java#L330; this very same metadata is fed into ServletResourceManager when UndertowDeploymentProcessor reads it https://github.com/wildfly/wildfly/blob/27.0.0.Alpha1/undertow/src/main/java/org/wildfly/extension/undertow/deployment/UndertowDeploymentProcessor.java#L424 ; finally this processor creates the ServletResourceManager with the overlays collection during start: https://github.com/wildfly/wildfly/blob/27.0.0.Alpha1/undertow/src/main/java/org/wildfly/extension/undertow/deployment/UndertowDeploymentInfoService.java#L495 )
- relates to
-
JBMETA-429 Document that overlays in jboss-web do not override
- Resolved