geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1064044 - /geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
Date Thu, 27 Jan 2011 09:11:49 GMT
Author: xuhaihong
Date: Thu Jan 27 09:11:49 2011
New Revision: 1064044

URL: http://svn.apache.org/viewvc?rev=1064044&view=rev
Log:
a. No need to register the url stream handler since OSGi framework has already done it
b. Recover the actions for adding application listener, do not see a reason that we could
remove it.

Modified:
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java

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=1064044&r1=1064043&r2=1064044&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
Thu Jan 27 09:11:49 2011
@@ -17,8 +17,6 @@
 package org.apache.geronimo.tomcat;
 
 import java.io.File;
-import java.net.URL;
-import java.net.URLStreamHandlerFactory;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
@@ -55,7 +53,6 @@ import org.apache.geronimo.web.WebAttrib
 import org.apache.geronimo.web.info.WebAppInfo;
 import org.apache.geronimo.webservices.SoapHandler;
 import org.apache.geronimo.webservices.WebServiceContainer;
-import org.apache.naming.resources.DirContextURLStreamHandlerFactory;
 import org.apache.tomcat.InstanceManager;
 import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
@@ -93,7 +90,6 @@ public class TomcatContainer implements 
     private final String objectName;
     private final String[] applicationListeners;
     private final WebManager manager;
-    private static boolean first = true;
     private final BundleContext bundleContext;
     private final ClassLoader classLoader;
 
@@ -121,22 +117,6 @@ public class TomcatContainer implements 
 
         this.bundleContext = bundleContext;
         this.classLoader = classLoader;
-        // Register a stream handler factory for the JNDI protocol
-        URLStreamHandlerFactory streamHandlerFactory =
-            new DirContextURLStreamHandlerFactory();
-        if (first) {
-            first = false;
-            try {
-                URL.setURLStreamHandlerFactory(streamHandlerFactory);
-            } catch (Exception e) {
-                // Log and continue anyway, this is not critical
-                log.error("Error registering jndi stream handler", e);
-            } catch (Throwable t) {
-                // This is likely a dual registration
-                log.info("Dual registration of jndi stream handler: "
-                         + t.getMessage());
-            }
-        }
 
         if (catalinaHome == null)
             catalinaHome = DEFAULT_CATALINA_HOME;
@@ -311,12 +291,18 @@ public class TomcatContainer implements 
 
         // Set the context for the Tomcat implementation
         contextInfo.setContext(context);
-
         // Have the context to set its properties if its a GeronimoStandardContext
         if (context instanceof GeronimoStandardContext) {
             ((GeronimoStandardContext) context).setContextProperties(contextInfo);
         }
 
+        // add application listeners to the new context
+        if (applicationListeners != null) {
+            for (String listener : applicationListeners) {
+                context.addApplicationListener(listener);
+            }
+        }
+
         try {
             host.addChild(context);
         } catch (IllegalArgumentException ex) {



Mime
View raw message