geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r905523 - in /geronimo/server/trunk/plugins: jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/ myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/ tomcat/geronimo-tomcat7-...
Date Tue, 02 Feb 2010 05:59:56 GMT
Author: gawor
Date: Tue Feb  2 05:59:17 2010
New Revision: 905523

URL: http://svn.apache.org/viewvc?rev=905523&view=rev
Log:
GERONIMO-5051: Pass listeners discovered in tlds during deployment to Tomcat. Tomcat won't
have to scan for TLDs at startup and it is closer to what we do for Jetty

Modified:
    geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
    geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContext.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java

Modified: geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java?rev=905523&r1=905522&r2=905523&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
(original)
+++ geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
Tue Feb  2 05:59:17 2010
@@ -182,8 +182,7 @@
 
             webAppData.setReferencePattern("ContextCustomizer", jspLifecycleName);
         }
-        //add listeners if possible
-        //we may need to add them in another way for tomcat
+        // add listeners
         Object value = webAppData.getAttribute("listenerClassNames");
         if (value instanceof Collection) {
             ((Collection<String>) value).addAll(listenerNames);

Modified: geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java?rev=905523&r1=905522&r2=905523&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java
(original)
+++ geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java
Tue Feb  2 05:59:17 2010
@@ -57,7 +57,6 @@
 import org.apache.geronimo.xbeans.javaee.FacesConfigManagedBeanType;
 import org.apache.geronimo.xbeans.javaee.FacesConfigType;
 import org.apache.geronimo.xbeans.javaee.FullyQualifiedClassType;
-import org.apache.geronimo.xbeans.javaee.ListenerType;
 import org.apache.geronimo.xbeans.javaee.ParamValueType;
 import org.apache.geronimo.xbeans.javaee.ServletType;
 import org.apache.geronimo.xbeans.javaee.WebAppType;
@@ -135,15 +134,10 @@
         Map sharedContext = module.getSharedContext();
         //add the ServletContextListener to the web app context
         GBeanData webAppData = (GBeanData) sharedContext.get(WebModule.WEB_APP_DATA);
-        //jetty specific support
+        // add myfaces listener
         Object value = webAppData.getAttribute("listenerClassNames");
         if (value instanceof Collection && !((Collection) value).contains(CONTEXT_LISTENER_NAME))
{
             ((Collection<String>) value).add(CONTEXT_LISTENER_NAME);
-        } else {
-            //try to add listener to the web app xml
-            ListenerType listenerType = webApp.addNewListener();
-            FullyQualifiedClassType className = listenerType.addNewListenerClass();
-            className.setStringValue(CONTEXT_LISTENER_NAME);
         }
         AbstractName moduleName = moduleContext.getModuleName();
         Map<NamingBuilder.Key, Object> buildingContext = new HashMap<NamingBuilder.Key,
Object>();

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=905523&r1=905522&r2=905523&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Tue Feb  2 05:59:17 2010
@@ -23,6 +23,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -454,6 +455,9 @@
                 }
             }
 
+            Collection<String> listeners = new ArrayList<String>();
+            webModuleData.setAttribute("listenerClassNames", listeners);
+            
             //Handle the role permissions and webservices on the servlets.
             ServletType[] servletTypes = webApp.getServletArray();
             Map<String, AbstractName> webServices = new HashMap<String, AbstractName>();

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java?rev=905523&r1=905522&r2=905523&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
Tue Feb  2 05:59:17 2010
@@ -96,6 +96,8 @@
 
     public GeronimoStandardContext() {
         setXmlNamespaceAware(true);
+        // disable Tomcat startup TLD scanning 
+        setProcessTlds(false);
     }
 
     public void setContextProperties(TomcatContext ctx) throws DeploymentException {

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java?rev=905523&r1=905522&r2=905523&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
Tue Feb  2 05:59:17 2010
@@ -19,6 +19,7 @@
 import java.io.File;
 import java.net.URL;
 import java.net.URLStreamHandlerFactory;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
@@ -345,6 +346,13 @@
                 context.addApplicationListener(listener);
             }
         }
+        
+        Collection<String> listeners = contextInfo.getListeners();
+        if (listeners != null) {
+            for (String listener : listeners) {
+                context.addApplicationListener(listener);
+            }
+        }
 
         try {
             host.addChild(context);

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContext.java?rev=905523&r1=905522&r2=905523&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContext.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContext.java
Tue Feb  2 05:59:17 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.geronimo.tomcat;
 
+import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -90,4 +91,6 @@
     String getModulePath();
     
     String getDeploymentDescriptor();
+    
+    Collection<String> getListeners();
 }

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java?rev=905523&r1=905522&r2=905523&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
Tue Feb  2 05:59:17 2010
@@ -19,6 +19,7 @@
 
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -121,6 +122,7 @@
     private final String modulePath;
     private final Holder holder;
     private final RuntimeCustomizer contextCustomizer;
+    private final Collection<String> listeners;
     private String displayName;
 
     // JSR 77
@@ -165,6 +167,7 @@
             @ParamReference(name = "J2EEServer") J2EEServer server,
             @ParamReference(name = "J2EEApplication") J2EEApplication application,
             @ParamReference(name = "ContextSource") ContextSource contextSource,
+            @ParamAttribute(name = "listenerClassNames") Collection<String> listenerClassNames,
             @ParamSpecial(type = SpecialAttributeType.kernel) Kernel kernel)
             throws Exception {
         assert classLoader != null;
@@ -226,6 +229,7 @@
         }
 
         this.displayName = displayName;
+        this.listeners = listenerClassNames;
 
         //Add the valve list
         if (tomcatValveChain != null) {
@@ -252,7 +256,7 @@
         } else {
             listenerChain = null;
         }
-
+        
         //Add the cluster
         if (cluster != null) {
             catalinaCluster = (CatalinaCluster) cluster.getInternalObject();
@@ -469,6 +473,10 @@
         return result;
     }
 
+    public Collection<String> getListeners() {
+        return listeners;
+    }
+    
     public String getDisplayName() {
         return displayName;
     }

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java?rev=905523&r1=905522&r2=905523&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
Tue Feb  2 05:59:17 2010
@@ -115,6 +115,7 @@
                 null,
                 null,
                 contextSource,
+                null,
                 null);
         app.doStart();
         return app;



Mime
View raw message