Applied fix from trunk for revision: 1858347

===

Fixed: Failed registration for virtual hosts with similar mount points
(OFBIZ-10765)

The default host is now retrieved using the API instead of simply
retrieving the 1st host through Tomcat.getHost().


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1858348 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Brohl
2019-04-29 08:48:54 +00:00
parent 8e9ed5c5d9
commit ef6ec58bb6
@@ -218,7 +218,10 @@ public class CatalinaContainer implements Container {
Host host;
if (UtilValidate.isEmpty(virtualHosts)) {
host = tomcat.getHost();
host = (Host) tomcat.getEngine().findChild(tomcat.getEngine().getDefaultHost());
if(host == null) {
host = tomcat.getHost();
}
} else {
host = prepareVirtualHost(tomcat, virtualHosts);
}
@@ -484,6 +487,7 @@ public class CatalinaContainer implements Container {
return () -> {
StandardContext context = prepareContext(host, configuration, appInfo, clusterProp);
Debug.logInfo("host[" + host + "].addChild(" + context + ")", module);
host.addChild(context);
return context;
};
@@ -500,7 +504,6 @@ public class CatalinaContainer implements Container {
context.setParent(host);
context.setDocBase(location);
context.setName(appInfo.name);
context.setDisplayName(appInfo.name);
context.setPath(getWebappMountPoint(appInfo));
context.addLifecycleListener(new ContextConfig());