[jboss-cvs] JBossAS SVN: r75629 - trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jul 10 10:45:25 EDT 2008
Author: remy.maucherat at jboss.com
Date: 2008-07-10 10:45:25 -0400 (Thu, 10 Jul 2008)
New Revision: 75629
Modified:
trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
Log:
- JBAS-2558: No hardcoding of default host (will instead deploy to the
default host for all engines).
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java 2008-07-10 14:05:28 UTC (rev 75628)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java 2008-07-10 14:45:25 UTC (rev 75629)
@@ -135,6 +135,12 @@
if (hostNames.hasNext())
{
hostName = hostNames.next().toString();
+ } else {
+ hostNames = getDefaultHosts();
+ if (hostNames.hasNext())
+ {
+ hostName = hostNames.next().toString();
+ }
}
performDeployInternal(hostName, webApp, warUrl);
while (hostNames.hasNext())
@@ -729,4 +735,29 @@
return hosts.iterator();
}
+ /**
+ * Find the default hosts for all existing engines
+ */
+ protected synchronized Iterator getDefaultHosts() throws Exception
+ {
+ // Map the virtual host names to the hosts
+ HashSet defaultHosts = new HashSet();
+ // Query the configured Engine mbeans
+ String engineQuery = config.getCatalinaDomain() + ":type=Engine,*";
+ ObjectName query = new ObjectName(engineQuery);
+ Set engines = server.queryNames(query, null);
+ Iterator iter = engines.iterator();
+ while (iter.hasNext())
+ {
+ ObjectName engine = (ObjectName)iter.next();
+
+ String defaultHost = (String) server.getAttribute(engine, "defaultHost");
+ if (defaultHost != null)
+ {
+ defaultHosts.add(defaultHost);
+ }
+ }
+ return defaultHosts.iterator();
+ }
+
}
More information about the jboss-cvs-commits
mailing list