You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2005/08/21 19:51:07 UTC

svn commit: r234288 - in /geronimo/trunk/modules: jetty-builder/src/java/org/apache/geronimo/jetty/deployment/ jetty-builder/src/test-resources/plans/ tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/ tomcat-builder/src/test-resources/depl...

Author: djencks
Date: Sun Aug 21 10:50:58 2005
New Revision: 234288

URL: http://svn.apache.org/viewcvs?rev=234288&view=rev
Log:
GERONIMO-845. Support for virtual hosts in jetty, and specific xml element in geronimo-web.xml.  Need to check that tomcat changes are ok with jeff

Modified:
    geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
    geronimo/trunk/modules/jetty-builder/src/test-resources/plans/plan4.xml
    geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/geronimo-web.xml
    geronimo/trunk/modules/web-builder/src/schema/geronimo-web.xsd

Modified: geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?rev=234288&r1=234287&r2=234288&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java (original)
+++ geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java Sun Aug 21 10:50:58 2005
@@ -333,7 +333,6 @@
                 jettyWebApp = createDefaultPlan(defaultContextRoot);
             }
         } catch (XmlException e) {
-            e.printStackTrace();
             throw new DeploymentException("xml problem", e);
         }
         return jettyWebApp;
@@ -343,7 +342,7 @@
 
         if (webApp != null && webApp.getId() != null) {
             return webApp.getId();
-         }
+        }
 
         if (isStandAlone) {
             // default configId is based on the moduleFile name
@@ -371,7 +370,7 @@
     }
 
     private GerWebAppType createDefaultPlan(String contextRoot) {
-       GerWebAppType jettyWebApp = GerWebAppType.Factory.newInstance();
+        GerWebAppType jettyWebApp = GerWebAppType.Factory.newInstance();
 
         // set the parentId, configId and context root
         jettyWebApp.setParentId(defaultParentId.toString());
@@ -400,7 +399,7 @@
 
             // add the manifest classpath entries declared in the war to the class loader
             // we have to explicitly add these since we are unpacking the web module
-            // and the url class loader will not pick up a manifiest from an unpacked dir
+            // and the url class loader will not pick up a manifest from an unpacked dir
             earContext.addManifestClassPath(warFile, URI.create(module.getTargetPath()));
 
             // add the dependencies declared in the geronimo-web.xml file
@@ -427,16 +426,14 @@
         GerWebAppType jettyWebApp = (GerWebAppType) webModule.getVendorDD();
 
         boolean contextPriorityClassLoader = defaultContextPriorityClassloader;
-        if (jettyWebApp != null && jettyWebApp.isSetContextPriorityClassloader()) {
+        if (jettyWebApp.isSetContextPriorityClassloader()) {
             contextPriorityClassLoader = jettyWebApp.getContextPriorityClassloader();
         }
         // construct the webClassLoader
         ClassLoader webClassLoader = getWebClassLoader(earContext, webModule, cl, contextPriorityClassLoader);
 
-        if (jettyWebApp != null) {
-            GbeanType[] gbeans = jettyWebApp.getGbeanArray();
-            ServiceConfigBuilder.addGBeans(gbeans, webClassLoader, moduleJ2eeContext, earContext);
-        }
+        GbeanType[] gbeans = jettyWebApp.getGbeanArray();
+        ServiceConfigBuilder.addGBeans(gbeans, webClassLoader, moduleJ2eeContext, earContext);
 
         ObjectName webModuleName = null;
         try {
@@ -461,7 +458,14 @@
             Map rolePermissions = new HashMap();
 
             webModuleData.setAttribute("uri", URI.create(module.getTargetPath() + "/"));
-            webModuleData.setAttribute("componentContext", compContext);
+
+            String[] hosts = jettyWebApp.getVirtualHostArray();
+            for (int i = 0; i < hosts.length; i++) {
+                hosts[i] = hosts[i].trim();
+            }
+            webModuleData.setAttribute("virtualHosts", hosts);
+
+                webModuleData.setAttribute("componentContext", compContext);
             webModuleData.setAttribute("userTransaction", userTransaction);
             //classpath may have been augmented with enhanced classes
             webModuleData.setAttribute("webClassPath", webModule.getWebClasspath());

Modified: geronimo/trunk/modules/jetty-builder/src/test-resources/plans/plan4.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty-builder/src/test-resources/plans/plan4.xml?rev=234288&r1=234287&r2=234288&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty-builder/src/test-resources/plans/plan4.xml (original)
+++ geronimo/trunk/modules/jetty-builder/src/test-resources/plans/plan4.xml Sun Aug 21 10:50:58 2005
@@ -2,5 +2,8 @@
 <web-app xmlns="http://geronimo.apache.org/xml/ns/web/jetty"
     configId="goodservlet"
     parentId="org/apache/geronimo/DefaultDatabase">
+    <virtual-host>foo</virtual-host>
+    <virtual-host>bar</virtual-host>
+
     <context-priority-classloader>true</context-priority-classloader>
 </web-app>

Modified: geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=234288&r1=234287&r2=234288&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java (original)
+++ geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java Sun Aug 21 10:50:58 2005
@@ -203,7 +203,7 @@
         module.setContextRoot(contextRoot);
         return module;
     }
-        
+
     /**
      * Some servlets will have multiple url patterns.  However, webservice servlets
      * will only have one, which is what this method is intended for.
@@ -392,6 +392,10 @@
             webModuleData.setReferencePattern("Container", tomcatContainerObjectName);
 
             String virtualServer = null;
+            String[] hosts = tomcatWebApp.getVirtualHostArray();
+            if (hosts.length > 0) {
+                virtualServer = hosts[0].trim();
+            }
             // Process the Tomcat container-config elements
             if (tomcatWebApp != null && tomcatWebApp.sizeOfContainerConfigArray() > 0) {
                 Map values = new HashMap();
@@ -407,7 +411,7 @@
                         values.put(param.getName(), param.getStringValue());
                     }
                 }
-
+                //TODO remove and use only explicit virtual hosts?
                 //Is there a Tomcat virtual server declaration?
                 virtualServer = (String) values.remove("VirtualServer");
 

Modified: geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/geronimo-web.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/geronimo-web.xml?rev=234288&r1=234287&r2=234288&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/geronimo-web.xml (original)
+++ geronimo/trunk/modules/tomcat-builder/src/test-resources/deployables/war4/WEB-INF/geronimo-web.xml Sun Aug 21 10:50:58 2005
@@ -6,9 +6,9 @@
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
-  
+
        http://www.apache.org/licenses/LICENSE-2.0
-  
+
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,10 +21,11 @@
     configId="org/apache/geronimo/test">
 
     <context-root>/test</context-root>
+    <virtual-host>tomcathost</virtual-host>
     <context-priority-classloader>false</context-priority-classloader>
     <container-config container="Tomcat">
         <config-param name="TomcatRealm" >TomcatRealm</config-param>
-        <config-param name="TomcatValveChain">FirstValve</config-param> 
+        <config-param name="TomcatValveChain">FirstValve</config-param>
     </container-config>
 
     <security-realm-name>test</security-realm-name>
@@ -33,7 +34,7 @@
             <principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="metro"/>
         </default-principal>
     </security>
-     
+
     <gbean name="TomcatRealm" class="org.apache.geronimo.tomcat.RealmGBean">
         <attribute name="className">org.apache.geronimo.tomcat.realm.TomcatGeronimoRealm</attribute>
         <attribute name="initParams">
@@ -41,18 +42,18 @@
             roleClassNames=org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal
         </attribute>
     </gbean>
- 
+
     <gbean name="FirstValve" class="org.apache.geronimo.tomcat.ValveGBean">
         <attribute name="className">org.apache.catalina.authenticator.SingleSignOn</attribute>
         <reference name="NextValve"><moduleType>J2EEModule</moduleType><name>SecondValve</name></reference>
     </gbean>
-    
+
     <gbean name="SecondValve" class="org.apache.geronimo.tomcat.ValveGBean">
         <attribute name="className">org.apache.catalina.valves.AccessLogValve</attribute>
         <attribute name="initParams">
-            prefix=localhost_access_log. 
+            prefix=localhost_access_log.
             suffix=.txt
             pattern=common
         </attribute>
-    </gbean>   
+    </gbean>
 </web-app>

Modified: geronimo/trunk/modules/web-builder/src/schema/geronimo-web.xsd
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/web-builder/src/schema/geronimo-web.xsd?rev=234288&r1=234287&r2=234288&view=diff
==============================================================================
--- geronimo/trunk/modules/web-builder/src/schema/geronimo-web.xsd (original)
+++ geronimo/trunk/modules/web-builder/src/schema/geronimo-web.xsd Sun Aug 21 10:50:58 2005
@@ -81,6 +81,7 @@
             <xs:element ref="sys:dependency" minOccurs="0" maxOccurs="unbounded"/>
 
             <xs:element name="context-root" type="xs:string" minOccurs="0"/>
+            <xs:element name="virtual-host" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
             <xs:element name="context-priority-classloader" type="xs:boolean" minOccurs="0"/>
             <xs:element name="container-config" type="web:container-configType" minOccurs="0" maxOccurs="unbounded"/>