geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r784303 [1/2] - in /geronimo/external/trunk/tomcat-parent-6.0.18: ./ catalina-ha/src/main/java/org/apache/catalina/ha/ catalina/src/main/java/org/apache/catalina/ catalina/src/main/java/org/apache/catalina/core/ catalina/src/main/java/org/a...
Date Fri, 12 Jun 2009 22:47:34 GMT
Author: djencks
Date: Fri Jun 12 22:47:32 2009
New Revision: 784303

URL: http://svn.apache.org/viewvc?rev=784303&view=rev
Log:
GERONIMO-4685 Apply last good patch,  TOMCAT_6_0_16-G652117.patch, r660592 Merged from my sandbox copy r783555

Added:
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/DefaultInstanceManager.java
      - copied unchanged from r783555, geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/DefaultInstanceManager.java
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/Injectable.java
      - copied unchanged from r783555, geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/Injectable.java
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/InjectionTarget.java
      - copied unchanged from r783555, geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/InjectionTarget.java
    geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/runtime/InstanceManagerFactory.java
      - copied unchanged from r783555, geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/runtime/InstanceManagerFactory.java
    geronimo/external/trunk/tomcat-parent-6.0.18/shared/src/main/java/org/apache/InstanceManager.java
      - copied unchanged from r783555, geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/shared/src/main/java/org/apache/InstanceManager.java
Removed:
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/util/DefaultAnnotationProcessor.java
    geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/runtime/AnnotationHelper.java
    geronimo/external/trunk/tomcat-parent-6.0.18/shared/src/main/java/org/apache/AnnotationProcessor.java
Modified:
    geronimo/external/trunk/tomcat-parent-6.0.18/   (props changed)
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina-ha/src/main/java/org/apache/catalina/ha/   (props changed)
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/   (props changed)
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/ApplicationFilterConfig.java
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/StandardContext.java
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/StandardWrapper.java
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/mbeans-descriptors.xml
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/ContextEnvironment.java
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/MessageDestinationRef.java
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/ResourceBase.java
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/servlets/WebdavServlet.java
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/startup/ConnectorCreateRule.java
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/startup/WebRuleSet.java
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/coyote/   (props changed)
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/jk/   (props changed)
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/naming/   (props changed)
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/tomcat/jni/   (props changed)
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/tomcat/util/net/   (props changed)
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/resources/org/apache/catalina/core/LocalStrings.properties   (contents, props changed)
    geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/resources/org/apache/catalina/servlets/LocalStrings.properties   (contents, props changed)
    geronimo/external/trunk/tomcat-parent-6.0.18/jasper-el/src/main/java/org/apache/el/   (props changed)
    geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/   (props changed)
    geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/Constants.java
    geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/JspCompilationContext.java
    geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/compiler/Generator.java
    geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/runtime/TagHandlerPool.java
    geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/servlet/JspServletWrapper.java
    geronimo/external/trunk/tomcat-parent-6.0.18/juli/src/main/java/org/apache/juli/   (props changed)
    geronimo/external/trunk/tomcat-parent-6.0.18/shared/src/main/java/org/apache/PeriodicEventListener.java   (props changed)
    geronimo/external/trunk/tomcat-parent-6.0.18/tribes/src/main/java/org/apache/catalina/tribes/   (props changed)
    geronimo/external/trunk/tomcat-parent-6.0.18/util/src/main/java/org/apache/tomcat/util/   (props changed)

Propchange: geronimo/external/trunk/tomcat-parent-6.0.18/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Fri Jun 12 22:47:32 2009
@@ -0,0 +1 @@
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18:783483-783555

Propchange: geronimo/external/trunk/tomcat-parent-6.0.18/catalina-ha/src/main/java/org/apache/catalina/ha/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 12 22:47:32 2009
@@ -1 +1,2 @@
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina-ha/src/main/java/org/apache/catalina/ha:783483-783555
 /tomcat/trunk/java/org/apache/catalina/ha:673796,673820

Propchange: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 12 22:47:32 2009
@@ -1 +1,2 @@
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina:783483-783555
 /tomcat/trunk/java/org/apache/catalina:673796,673820

Modified: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/ApplicationFilterConfig.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/ApplicationFilterConfig.java?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/ApplicationFilterConfig.java (original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/ApplicationFilterConfig.java Fri Jun 12 22:47:32 2009
@@ -19,14 +19,12 @@
 package org.apache.catalina.core;
 
 
-import java.io.IOException;
-import java.io.InputStream;
 import java.io.Serializable;
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.Map;
-import java.util.Properties;
 
 import javax.naming.NamingException;
 import javax.servlet.Filter;
@@ -34,7 +32,7 @@
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 
-import org.apache.AnnotationProcessor;
+import org.apache.InstanceManager;
 import org.apache.catalina.Context;
 import org.apache.catalina.Globals;
 import org.apache.catalina.deploy.FilterDef;
@@ -58,7 +56,7 @@
 
     protected static StringManager sm =
         StringManager.getManager(Constants.Package);
-    
+
     // ----------------------------------------------------------- Constructors
 
 
@@ -78,8 +76,8 @@
      * @exception InstantiationException if an exception occurs while
      *  instantiating the filter object
      * @exception ServletException if thrown by the filter's init() method
-     * @throws NamingException 
-     * @throws InvocationTargetException 
+     * @throws NamingException
+     * @throws InvocationTargetException
      */
     public ApplicationFilterConfig(Context context, FilterDef filterDef)
         throws ClassCastException, ClassNotFoundException,
@@ -88,22 +86,6 @@
 
         super();
 
-        if (restrictedFilters == null) {
-            restrictedFilters = new Properties();
-            try {
-                InputStream is = 
-                    this.getClass().getClassLoader().getResourceAsStream
-                        ("org/apache/catalina/core/RestrictedFilters.properties");
-                if (is != null) {
-                    restrictedFilters.load(is);
-                } else {
-                    context.getLogger().error(sm.getString("applicationFilterConfig.restrictedFiltersResources"));
-                }
-            } catch (IOException e) {
-                context.getLogger().error(sm.getString("applicationFilterConfig.restrictedServletsResources"), e);
-            }
-        }
-        
         this.context = context;
         setFilterDef(filterDef);
 
@@ -130,13 +112,12 @@
      */
     private FilterDef filterDef = null;
 
-
     /**
-     * Restricted filters (which can only be loaded by a privileged webapp).
+     * the InstanceManager used to create and destroy filter instances.
      */
-    protected static Properties restrictedFilters = null;
+    private transient InstanceManager instanceManager;
+
 
-    
     // --------------------------------------------------- FilterConfig Methods
 
 
@@ -223,11 +204,11 @@
      * @exception InstantiationException if an exception occurs while
      *  instantiating the filter object
      * @exception ServletException if thrown by the filter's init() method
-     * @throws NamingException 
-     * @throws InvocationTargetException 
+     * @throws NamingException
+     * @throws InvocationTargetException
      */
     Filter getFilter() throws ClassCastException, ClassNotFoundException,
-        IllegalAccessException, InstantiationException, ServletException, 
+        IllegalAccessException, InstantiationException, ServletException,
         InvocationTargetException, NamingException {
 
         // Return the existing filter instance, if any
@@ -236,32 +217,10 @@
 
         // Identify the class loader we will be using
         String filterClass = filterDef.getFilterClass();
-        ClassLoader classLoader = null;
-        if (filterClass.startsWith("org.apache.catalina."))
-            classLoader = this.getClass().getClassLoader();
-        else
-            classLoader = context.getLoader().getClassLoader();
-
-        ClassLoader oldCtxClassLoader =
-            Thread.currentThread().getContextClassLoader();
+        this.filter = (Filter) getInstanceManager().newInstance(filterClass);
 
-        // Instantiate a new instance of this filter and return it
-        Class clazz = classLoader.loadClass(filterClass);
-        if (!isFilterAllowed(clazz)) {
-            throw new SecurityException
-                (sm.getString("applicationFilterConfig.privilegedFilter",
-                        filterClass));
-        }
-        this.filter = (Filter) clazz.newInstance();
-        if (!context.getIgnoreAnnotations()) {
-            if (context instanceof StandardContext) {
-               AnnotationProcessor processor = ((StandardContext)context).getAnnotationProcessor();
-               processor.processAnnotations(this.filter);
-               processor.postConstruct(this.filter);
-            }
-        }
         if (context instanceof StandardContext &&
-            ((StandardContext) context).getSwallowOutput()) {
+                context.getSwallowOutput()) {
             try {
                 SystemLogHandler.startCapture();
                 filter.init(this);
@@ -289,30 +248,6 @@
 
     }
 
-
-    /**
-     * Return <code>true</code> if loading this filter is allowed.
-     */
-    protected boolean isFilterAllowed(Class filterClass) {
-
-        // Privileged webapps may load all servlets without restriction
-        if (context.getPrivileged()) {
-            return true;
-        }
-
-        Class clazz = filterClass;
-        while (clazz != null && !clazz.getName().equals("javax.servlet.Filter")) {
-            if ("restricted".equals(restrictedFilters.getProperty(clazz.getName()))) {
-                return (false);
-            }
-            clazz = clazz.getSuperclass();
-        }
-        
-        return (true);
-
-    }
-
-
     /**
      * Release the Filter instance associated with this FilterConfig,
      * if there is one.
@@ -323,17 +258,17 @@
         {
             if (Globals.IS_SECURITY_ENABLED) {
                 try {
-                    SecurityUtil.doAsPrivilege("destroy", filter); 
-                } catch(java.lang.Exception ex){                    
+                    SecurityUtil.doAsPrivilege("destroy", filter);
+                } catch(java.lang.Exception ex){
                     context.getLogger().error("ApplicationFilterConfig.doAsPrivilege", ex);
                 }
                 SecurityUtil.remove(filter);
-            } else { 
+            } else {
                 filter.destroy();
             }
             if (!context.getIgnoreAnnotations()) {
                 try {
-                    ((StandardContext)context).getAnnotationProcessor().preDestroy(this.filter);
+                    ((StandardContext) context).getInstanceManager().destroyInstance(this.filter);
                 } catch (Exception e) {
                     context.getLogger().error("ApplicationFilterConfig.preDestroy", e);
                 }
@@ -358,8 +293,8 @@
      * @exception InstantiationException if an exception occurs while
      *  instantiating the filter object
      * @exception ServletException if thrown by the filter's init() method
-     * @throws NamingException 
-     * @throws InvocationTargetException 
+     * @throws NamingException
+     * @throws InvocationTargetException
      */
     void setFilterDef(FilterDef filterDef)
         throws ClassCastException, ClassNotFoundException,
@@ -373,17 +308,17 @@
             if (this.filter != null){
                 if( Globals.IS_SECURITY_ENABLED) {
                     try{
-                        SecurityUtil.doAsPrivilege("destroy", filter);  
-                    } catch(java.lang.Exception ex){    
+                        SecurityUtil.doAsPrivilege("destroy", filter);
+                    } catch(java.lang.Exception ex){
                         context.getLogger().error("ApplicationFilterConfig.doAsPrivilege", ex);
                     }
                     SecurityUtil.remove(filter);
-                } else { 
+                } else {
                     filter.destroy();
                 }
                 if (!context.getIgnoreAnnotations()) {
                     try {
-                        ((StandardContext)context).getAnnotationProcessor().preDestroy(this.filter);
+                        ((StandardContext) context).getInstanceManager().destroyInstance(this.filter);
                     } catch (Exception e) {
                         context.getLogger().error("ApplicationFilterConfig.preDestroy", e);
                     }
@@ -403,5 +338,18 @@
 
     // -------------------------------------------------------- Private Methods
 
+    private InstanceManager getInstanceManager() {
+        if (instanceManager == null) {
+            if (context instanceof StandardContext) {
+                instanceManager = ((StandardContext)context).getInstanceManager();
+            } else {
+                instanceManager = new DefaultInstanceManager(null,
+                        new HashMap<String, Map<String, String>>(),
+                        context,
+                        getClass().getClassLoader()); 
+            }
+        }
+        return instanceManager;
+    }
 
 }

Modified: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/StandardContext.java?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/StandardContext.java (original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/StandardContext.java Fri Jun 12 22:47:32 2009
@@ -31,6 +31,8 @@
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.Stack;
 import java.util.TreeMap;
 
@@ -59,7 +61,7 @@
 import javax.servlet.http.HttpSessionAttributeListener;
 import javax.servlet.http.HttpSessionListener;
 
-import org.apache.AnnotationProcessor;
+import org.apache.InstanceManager;
 import org.apache.catalina.Container;
 import org.apache.catalina.ContainerListener;
 import org.apache.catalina.Context;
@@ -77,6 +79,8 @@
 import org.apache.catalina.deploy.ErrorPage;
 import org.apache.catalina.deploy.FilterDef;
 import org.apache.catalina.deploy.FilterMap;
+import org.apache.catalina.deploy.Injectable;
+import org.apache.catalina.deploy.InjectionTarget;
 import org.apache.catalina.deploy.LoginConfig;
 import org.apache.catalina.deploy.MessageDestination;
 import org.apache.catalina.deploy.MessageDestinationRef;
@@ -88,7 +92,6 @@
 import org.apache.catalina.startup.ContextConfig;
 import org.apache.catalina.startup.TldConfig;
 import org.apache.catalina.util.CharsetMapper;
-import org.apache.catalina.util.DefaultAnnotationProcessor;
 import org.apache.catalina.util.ExtensionValidator;
 import org.apache.catalina.util.RequestUtil;
 import org.apache.catalina.util.URLEncoder;
@@ -174,9 +177,9 @@
 
 
     /**
-     * Annotation processor.
+     * Lifecycle provider.
      */
-    private AnnotationProcessor annotationProcessor = null;
+    private InstanceManager instanceManager = null;
 
 
    /**
@@ -679,13 +682,13 @@
     // ----------------------------------------------------- Context Properties
 
 
-    public AnnotationProcessor getAnnotationProcessor() {
-       return annotationProcessor;
+    public InstanceManager getInstanceManager() {
+       return instanceManager;
     }
 
 
-    public void setAnnotationProcessor(AnnotationProcessor annotationProcessor) {
-       this.annotationProcessor = annotationProcessor;
+    public void setInstanceManager(InstanceManager instanceManager) {
+       this.instanceManager = instanceManager;
     }
 
     
@@ -3774,7 +3777,6 @@
             log.debug("Configuring application event listeners");
 
         // Instantiate the required listeners
-        ClassLoader loader = getLoader().getClassLoader();
         String listeners[] = findApplicationListeners();
         Object results[] = new Object[listeners.length];
         boolean ok = true;
@@ -3783,13 +3785,7 @@
                 getLogger().debug(" Configuring event listener class '" +
                     listeners[i] + "'");
             try {
-                Class clazz = loader.loadClass(listeners[i]);
-                results[i] = clazz.newInstance();
-                // Annotation processing
-                if (!getIgnoreAnnotations()) {
-                    getAnnotationProcessor().processAnnotations(results[i]);
-                    getAnnotationProcessor().postConstruct(results[i]);
-                }
+                results[i] = instanceManager.newInstance(listeners[i]);
             } catch (Throwable t) {
                 getLogger().error
                     (sm.getString("standardContext.applicationListener",
@@ -3889,29 +3885,26 @@
                         ok = false;
                     }
                 }
-                // Annotation processing
-                if (!getIgnoreAnnotations()) {
-                    try {
-                        getAnnotationProcessor().preDestroy(listeners[j]);
-                    } catch (Throwable t) {
-                        getLogger().error
-                            (sm.getString("standardContext.listenerStop",
-                                listeners[j].getClass().getName()), t);
-                        ok = false;
-                    }
+                try {
+                    getInstanceManager().destroyInstance(listeners[j]);
+                } catch (Throwable t) {
+                    getLogger().error
+                       (sm.getString("standardContext.listenerStop",
+                            listeners[j].getClass().getName()), t);
+                    ok = false;
                 }
             }
         }
 
         // Annotation processing
         listeners = getApplicationEventListeners();
-        if (!getIgnoreAnnotations() && listeners != null) {
+        if (listeners != null) {
             for (int i = 0; i < listeners.length; i++) {
                 int j = (listeners.length - 1) - i;
                 if (listeners[j] == null)
                     continue;
                 try {
-                    getAnnotationProcessor().preDestroy(listeners[j]);
+                    getInstanceManager().destroyInstance(listeners[j]);
                 } catch (Throwable t) {
                     getLogger().error
                         (sm.getString("standardContext.listenerStop",
@@ -4308,21 +4301,18 @@
         // Binding thread
         oldCCL = bindThread();
 
-        // Set annotation processing parameter for Jasper (unfortunately, since
-        // this can be configured in many places and not just in /WEB-INF/web.xml,
-        // there are not many solutions)
-        // Initialize annotation processor
-        if (ok && !getIgnoreAnnotations()) {
-            if (annotationProcessor == null) {
+        if (ok ) {
+            if (instanceManager == null) {
+                javax.naming.Context context = null;
                 if (isUseNaming() && namingContextListener != null) {
-                    annotationProcessor = 
-                        new DefaultAnnotationProcessor(namingContextListener.getEnvContext());
-                } else {
-                    annotationProcessor = new DefaultAnnotationProcessor(null);
+                    context = namingContextListener.getEnvContext();
                 }
+                Map<String, Map<String, String>> injectionMap = 
+                	buildInjectionMap(getIgnoreAnnotations() ? new NamingResources(): getNamingResources());
+                instanceManager = new DefaultInstanceManager
+                	(context, injectionMap, this, this.getClass().getClassLoader());
+                getServletContext().setAttribute(InstanceManager.class.getName(), instanceManager);
             }
-            getServletContext().setAttribute
-                (AnnotationProcessor.class.getName(), annotationProcessor);
         }
 
         try {
@@ -4418,6 +4408,48 @@
         //cacheContext();
     }
 
+    private Map<String, Map<String, String>> buildInjectionMap(NamingResources namingResources) {
+        Map<String, Map<String, String>> injectionMap = new HashMap<String, Map<String, String>>();
+        for (Injectable resource: namingResources.findLocalEjbs()) {
+            addInjectionTarget(resource, injectionMap);
+        }
+        for (Injectable resource: namingResources.findEjbs()) {
+            addInjectionTarget(resource, injectionMap);
+        }
+        for (Injectable resource: namingResources.findEnvironments()) {
+            addInjectionTarget(resource, injectionMap);
+        }
+        for (Injectable resource: namingResources.findMessageDestinationRefs()) {
+            addInjectionTarget(resource, injectionMap);
+        }
+        for (Injectable resource: namingResources.findResourceEnvRefs()) {
+            addInjectionTarget(resource, injectionMap);
+        }
+        for (Injectable resource: namingResources.findResources()) {
+            addInjectionTarget(resource, injectionMap);
+        }
+        for (Injectable resource: namingResources.findServices()) {
+            addInjectionTarget(resource, injectionMap);
+        }
+        return injectionMap;
+    }
+
+    private void addInjectionTarget(Injectable resource, Map<String, Map<String, String>> injectionMap) {
+        List<InjectionTarget> injectionTargets = resource.getInjectionTargets();
+        if (injectionTargets != null && injectionTargets.size() > 0) {
+            String jndiName = resource.getName();
+            for (InjectionTarget injectionTarget: injectionTargets) {
+                String clazz = injectionTarget.getTargetClass();
+                Map<String, String> injections = injectionMap.get(clazz);
+                if (injections == null) {
+                    injections = new HashMap<String, String>();
+                    injectionMap.put(clazz, injections);
+                }
+                injections.put(injectionTarget.getTargetName(), jndiName);
+            }
+        }
+    }
+
     /**
      * Processes TLDs.
      *

Modified: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/StandardWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/StandardWrapper.java?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/StandardWrapper.java (original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/StandardWrapper.java Fri Jun 12 22:47:32 2009
@@ -18,27 +18,14 @@
 
 package org.apache.catalina.core;
 
-import java.lang.reflect.Method;
-import java.io.IOException;
-import java.io.InputStream;
 import java.io.PrintStream;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Properties;
 import java.util.Stack;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.SingleThreadModel;
-import javax.servlet.UnavailableException;
+
 import javax.management.ListenerNotFoundException;
 import javax.management.MBeanNotificationInfo;
 import javax.management.Notification;
@@ -47,6 +34,14 @@
 import javax.management.NotificationFilter;
 import javax.management.NotificationListener;
 import javax.management.ObjectName;
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.SingleThreadModel;
+import javax.servlet.UnavailableException;
 
 import org.apache.PeriodicEventListener;
 import org.apache.catalina.Container;
@@ -56,8 +51,8 @@
 import org.apache.catalina.InstanceEvent;
 import org.apache.catalina.InstanceListener;
 import org.apache.catalina.LifecycleException;
-import org.apache.catalina.Loader;
 import org.apache.catalina.Wrapper;
+import org.apache.InstanceManager;
 import org.apache.catalina.security.SecurityUtil;
 import org.apache.catalina.util.Enumerator;
 import org.apache.catalina.util.InstanceSupport;
@@ -96,22 +91,6 @@
         pipeline.setBasic(swValve);
         broadcaster = new NotificationBroadcasterSupport();
 
-        if (restrictedServlets == null) {
-            restrictedServlets = new Properties();
-            try {
-                InputStream is = 
-                    this.getClass().getClassLoader().getResourceAsStream
-                        ("org/apache/catalina/core/RestrictedServlets.properties");
-                if (is != null) {
-                    restrictedServlets.load(is);
-                } else {
-                    log.error(sm.getString("standardWrapper.restrictedServletsResource"));
-                }
-            } catch (IOException e) {
-                log.error(sm.getString("standardWrapper.restrictedServletsResource"), e);
-            }
-        }
-        
     }
 
 
@@ -287,12 +266,7 @@
                                                          ServletRequest.class,
                                                          ServletResponse.class};
     
-    /**
-     * Restricted servlets (which can only be loaded by a privileged webapp).
-     */
-    protected static Properties restrictedServlets = null;
-    
-    
+
     // ------------------------------------------------------------- Properties
 
 
@@ -1043,83 +1017,9 @@
                     (sm.getString("standardWrapper.notClass", getName()));
             }
 
-            // Acquire an instance of the class loader to be used
-            Loader loader = getLoader();
-            if (loader == null) {
-                unavailable(null);
-                throw new ServletException
-                    (sm.getString("standardWrapper.missingLoader", getName()));
-            }
-
-            ClassLoader classLoader = loader.getClassLoader();
-
-            // Special case class loader for a container provided servlet
-            //  
-            if (isContainerProvidedServlet(actualClass) && 
-                    ! ((Context)getParent()).getPrivileged() ) {
-                // If it is a priviledged context - using its own
-                // class loader will work, since it's a child of the container
-                // loader
-                classLoader = this.getClass().getClassLoader();
-            }
-
-            // Load the specified servlet class from the appropriate class loader
-            Class classClass = null;
-            try {
-                if (SecurityUtil.isPackageProtectionEnabled()){
-                    final ClassLoader fclassLoader = classLoader;
-                    final String factualClass = actualClass;
-                    try{
-                        classClass = (Class)AccessController.doPrivileged(
-                                new PrivilegedExceptionAction(){
-                                    public Object run() throws Exception{
-                                        if (fclassLoader != null) {
-                                            return fclassLoader.loadClass(factualClass);
-                                        } else {
-                                            return Class.forName(factualClass);
-                                        }
-                                    }
-                        });
-                    } catch(PrivilegedActionException pax){
-                        Exception ex = pax.getException();
-                        if (ex instanceof ClassNotFoundException){
-                            throw (ClassNotFoundException)ex;
-                        } else {
-                            getServletContext().log( "Error loading "
-                                + fclassLoader + " " + factualClass, ex );
-                        }
-                    }
-                } else {
-                    if (classLoader != null) {
-                        classClass = classLoader.loadClass(actualClass);
-                    } else {
-                        classClass = Class.forName(actualClass);
-                    }
-                }
-            } catch (ClassNotFoundException e) {
-                unavailable(null);
-                getServletContext().log( "Error loading " + classLoader + " " + actualClass, e );
-                throw new ServletException
-                    (sm.getString("standardWrapper.missingClass", actualClass),
-                     e);
-            }
-
-            if (classClass == null) {
-                unavailable(null);
-                throw new ServletException
-                    (sm.getString("standardWrapper.missingClass", actualClass));
-            }
-
-            // Instantiate and initialize an instance of the servlet class itself
+            InstanceManager instanceManager = ((StandardContext)getParent()).getInstanceManager();
             try {
-                servlet = (Servlet) classClass.newInstance();
-                // Annotation processing
-                if (!((Context) getParent()).getIgnoreAnnotations()) {
-                    if (getParent() instanceof StandardContext) {
-                       ((StandardContext)getParent()).getAnnotationProcessor().processAnnotations(servlet);
-                       ((StandardContext)getParent()).getAnnotationProcessor().postConstruct(servlet);
-                    }
-                }
+                servlet = (Servlet) instanceManager.newInstance(actualClass);
             } catch (ClassCastException e) {
                 unavailable(null);
                 // Restore the context ClassLoader
@@ -1127,7 +1027,7 @@
                     (sm.getString("standardWrapper.notServlet", actualClass), e);
             } catch (Throwable e) {
                 unavailable(null);
-              
+
                 // Added extra log statement for Bugzilla 36630:
                 // http://issues.apache.org/bugzilla/show_bug.cgi?id=36630
                 if(log.isDebugEnabled()) {
@@ -1139,14 +1039,6 @@
                     (sm.getString("standardWrapper.instantiate", actualClass), e);
             }
 
-            // Check if loading the servlet in this web application should be
-            // allowed
-            if (!isServletAllowed(servlet)) {
-                throw new SecurityException
-                    (sm.getString("standardWrapper.privilegedServlet",
-                                  actualClass));
-            }
-
             // Special handling for ContainerServlet instances
             if ((servlet instanceof ContainerServlet) &&
                   (isContainerProvidedServlet(actualClass) ||
@@ -1398,7 +1290,7 @@
 
             // Annotation processing
             if (!((Context) getParent()).getIgnoreAnnotations()) {
-               ((StandardContext)getParent()).getAnnotationProcessor().preDestroy(instance);
+               ((StandardContext)getParent()).getInstanceManager().destroyInstance(instance);
             }
 
         } catch (Throwable t) {
@@ -1441,7 +1333,7 @@
                     }
                     // Annotation processing
                     if (!((Context) getParent()).getIgnoreAnnotations()) {
-                       ((StandardContext)getParent()).getAnnotationProcessor().preDestroy(s);
+                       ((StandardContext)getParent()).getInstanceManager().destroyInstance(s);
                     }
                 }
             } catch (Throwable t) {
@@ -1619,33 +1511,6 @@
     }
 
 
-    /**
-     * Return <code>true</code> if loading this servlet is allowed.
-     */
-    protected boolean isServletAllowed(Object servlet) {
-
-        // Privileged webapps may load all servlets without restriction
-        if (((Context) getParent()).getPrivileged()) {
-            return true;
-        }
-        
-        if (servlet instanceof ContainerServlet) {
-            return (false);
-        }
-
-        Class clazz = servlet.getClass();
-        while (clazz != null && !clazz.getName().equals("javax.servlet.http.HttpServlet")) {
-            if ("restricted".equals(restrictedServlets.getProperty(clazz.getName()))) {
-                return (false);
-            }
-            clazz = clazz.getSuperclass();
-        }
-        
-        return (true);
-
-    }
-
-
     protected Method[] getAllDeclaredMethods(Class c) {
 
         if (c.equals(javax.servlet.http.HttpServlet.class)) {

Modified: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/mbeans-descriptors.xml
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/mbeans-descriptors.xml?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/mbeans-descriptors.xml (original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/mbeans-descriptors.xml Fri Jun 12 22:47:32 2009
@@ -41,9 +41,9 @@
                is="true"
                type="boolean"/>
       
-     <attribute name="annotationProcessor"
-                description="Object that processes things like injection annotations"
-                type="org.apache.AnnotationProcessor" />
+    <attribute name="instanceManager"
+                description="Object that creates and destroys servlets, filters, and listeners. Include dependency injection and postConstruct/preDestory handling"
+                type="org.apache.catalina.instanceManagement.InstanceManager" />
 
     <attribute name="antiJARLocking"
                description="Take care to not lock jar files"

Modified: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/ContextEnvironment.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/ContextEnvironment.java?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/ContextEnvironment.java (original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/ContextEnvironment.java Fri Jun 12 22:47:32 2009
@@ -19,6 +19,8 @@
 package org.apache.catalina.deploy;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 
 
 /**
@@ -29,7 +31,7 @@
  * @version $Revision$ $Date$
  */
 
-public class ContextEnvironment implements Serializable {
+public class ContextEnvironment implements Serializable, Injectable {
 
 
     // ------------------------------------------------------------- Properties
@@ -105,6 +107,18 @@
         this.value = value;
     }
 
+
+    private List<InjectionTarget> injectionTargets = new ArrayList<InjectionTarget>();
+
+    public void addInjectionTarget(String injectionTargetName, String jndiName) {
+        InjectionTarget target = new InjectionTarget(injectionTargetName, jndiName);
+        injectionTargets.add(target);
+    }
+
+    public List<InjectionTarget> getInjectionTargets() {
+        return injectionTargets;
+    }
+
     // --------------------------------------------------------- Public Methods
 
 

Modified: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/MessageDestinationRef.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/MessageDestinationRef.java?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/MessageDestinationRef.java (original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/MessageDestinationRef.java Fri Jun 12 22:47:32 2009
@@ -19,6 +19,8 @@
 package org.apache.catalina.deploy;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 
 
 /**
@@ -31,7 +33,7 @@
  * @since Tomcat 5.0
  */
 
-public class MessageDestinationRef implements Serializable {
+public class MessageDestinationRef implements Serializable, Injectable {
 
 
     // ------------------------------------------------------------- Properties
@@ -106,6 +108,16 @@
         this.usage = usage;
     }
 
+    private List<InjectionTarget> injectionTargets = new ArrayList<InjectionTarget>();
+
+    public void addInjectionTarget(String injectionTargetName, String jndiName) {
+        InjectionTarget target = new InjectionTarget(injectionTargetName, jndiName);
+        injectionTargets.add(target);
+    }
+
+    public List<InjectionTarget> getInjectionTargets() {
+        return injectionTargets;
+    }
 
     // --------------------------------------------------------- Public Methods
 

Modified: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/ResourceBase.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/ResourceBase.java?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/ResourceBase.java (original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/deploy/ResourceBase.java Fri Jun 12 22:47:32 2009
@@ -21,6 +21,8 @@
 import java.io.Serializable;
 import java.util.Iterator;
 import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
 
 
 /**
@@ -30,7 +32,7 @@
  * @version $Revision$ $Date$
  */
 
-public class ResourceBase implements Serializable {
+public class ResourceBase implements Serializable, Injectable {
 
 
     // ------------------------------------------------------------- Properties
@@ -111,8 +113,18 @@
     public Iterator listProperties() {
         return properties.keySet().iterator();
     }
-    
-    
+
+    private List<InjectionTarget> injectionTargets = new ArrayList<InjectionTarget>();
+
+    public void addInjectionTarget(String injectionTargetName, String jndiName) {
+        InjectionTarget target = new InjectionTarget(injectionTargetName, jndiName);
+        injectionTargets.add(target);
+    }
+
+    public List<InjectionTarget> getInjectionTargets() {
+        return injectionTargets;
+    }
+
     // -------------------------------------------------------- Package Methods
 
 

Modified: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/servlets/WebdavServlet.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/servlets/WebdavServlet.java?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/servlets/WebdavServlet.java (original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/servlets/WebdavServlet.java Fri Jun 12 22:47:32 2009
@@ -20,7 +20,6 @@
 
 
 import java.io.IOException;
-import java.io.StringReader;
 import java.io.StringWriter;
 import java.io.Writer;
 import java.security.MessageDigest;
@@ -37,7 +36,6 @@
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.DirContext;
-import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.UnavailableException;
 import javax.servlet.http.HttpServletRequest;
@@ -59,7 +57,6 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
-import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
@@ -290,8 +287,6 @@
             documentBuilderFactory.setNamespaceAware(true);
             documentBuilderFactory.setExpandEntityReferences(false);
             documentBuilder = documentBuilderFactory.newDocumentBuilder();
-            documentBuilder.setEntityResolver(
-                    new WebdavResolver(this.getServletContext()));
         } catch(ParserConfigurationException e) {
             throw new ServletException
                 (sm.getString("webdavservlet.jaxpfailed"));
@@ -2828,26 +2823,6 @@
     }
 
 
-    // --------------------------------------------- WebdavResolver Inner Class
-    /**
-     * Work around for XML parsers that don't fully respect
-     * {@link DocumentBuilderFactory#setExpandEntityReferences(false)}. External
-     * references are filtered out for security reasons. See CVE-2007-5461.
-     */
-    private class WebdavResolver implements EntityResolver {
-        private ServletContext context;
-        
-        public WebdavResolver(ServletContext theContext) {
-            context = theContext;
-        }
-     
-        public InputSource resolveEntity (String publicId, String systemId) {
-            context.log(sm.getString("webdavservlet.enternalEntityIgnored",
-                    publicId, systemId));
-            return new InputSource(
-                    new StringReader("Ignored external entity"));
-        }
-    }
 };
 
 
@@ -3170,4 +3145,3 @@
 
 };
 
-

Modified: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/startup/ConnectorCreateRule.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/startup/ConnectorCreateRule.java?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/startup/ConnectorCreateRule.java (original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/startup/ConnectorCreateRule.java Fri Jun 12 22:47:32 2009
@@ -53,18 +53,14 @@
             ex = svc.getExecutor(attributes.getValue("executor"));
         }
         Connector con = new Connector(attributes.getValue("protocol"));
-        if ( ex != null )  _setExecutor(con,ex);
+        if ( ex != null )  setExecutor(con,ex);
         
         digester.push(con);
     }
     
-    public void _setExecutor(Connector con, Executor ex) throws Exception {
-        Method m = IntrospectionUtils.findMethod(con.getProtocolHandler().getClass(),"setExecutor",new Class[] {java.util.concurrent.Executor.class});
-        if (m!=null) {
-            m.invoke(con.getProtocolHandler(), new Object[] {ex});
-        }else {
-            log.warn("Connector ["+con+"] does not support external executors. Method setExecutor(java.util.concurrent.Executor) not found.");
-        }
+    public void setExecutor(Connector con, Executor ex) throws Exception {
+        IntrospectionUtils.callMethod1(con.getProtocolHandler(), "setExecutor", 
+            ex, java.util.concurrent.Executor.class.getName(), getClass().getClassLoader());
     }
 
 
@@ -72,7 +68,7 @@
      * Process the end of this element.
      */
     public void end() throws Exception {
-        Object top = digester.pop();
+        digester.pop();
     }
 
 

Modified: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/startup/WebRuleSet.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/startup/WebRuleSet.java?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/startup/WebRuleSet.java (original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/startup/WebRuleSet.java Fri Jun 12 22:47:32 2009
@@ -139,58 +139,7 @@
         digester.addRule(prefix + "web-app/distributable",
                          new SetDistributableRule());
 
-        digester.addObjectCreate(prefix + "web-app/ejb-local-ref",
-                                 "org.apache.catalina.deploy.ContextLocalEjb");
-        digester.addRule(prefix + "web-app/ejb-local-ref",
-                new SetNextNamingRule("addLocalEjb",
-                            "org.apache.catalina.deploy.ContextLocalEjb"));
-
-        digester.addCallMethod(prefix + "web-app/ejb-local-ref/description",
-                               "setDescription", 0);
-        digester.addCallMethod(prefix + "web-app/ejb-local-ref/ejb-link",
-                               "setLink", 0);
-        digester.addCallMethod(prefix + "web-app/ejb-local-ref/ejb-ref-name",
-                               "setName", 0);
-        digester.addCallMethod(prefix + "web-app/ejb-local-ref/ejb-ref-type",
-                               "setType", 0);
-        digester.addCallMethod(prefix + "web-app/ejb-local-ref/local",
-                               "setLocal", 0);
-        digester.addCallMethod(prefix + "web-app/ejb-local-ref/local-home",
-                               "setHome", 0);
-
-        digester.addObjectCreate(prefix + "web-app/ejb-ref",
-                                 "org.apache.catalina.deploy.ContextEjb");
-        digester.addRule(prefix + "web-app/ejb-ref",
-                new SetNextNamingRule("addEjb",
-                            "org.apache.catalina.deploy.ContextEjb"));
-
-        digester.addCallMethod(prefix + "web-app/ejb-ref/description",
-                               "setDescription", 0);
-        digester.addCallMethod(prefix + "web-app/ejb-ref/ejb-link",
-                               "setLink", 0);
-        digester.addCallMethod(prefix + "web-app/ejb-ref/ejb-ref-name",
-                               "setName", 0);
-        digester.addCallMethod(prefix + "web-app/ejb-ref/ejb-ref-type",
-                               "setType", 0);
-        digester.addCallMethod(prefix + "web-app/ejb-ref/home",
-                               "setHome", 0);
-        digester.addCallMethod(prefix + "web-app/ejb-ref/remote",
-                               "setRemote", 0);
-
-        digester.addObjectCreate(prefix + "web-app/env-entry",
-                                 "org.apache.catalina.deploy.ContextEnvironment");
-        digester.addRule(prefix + "web-app/env-entry",
-                new SetNextNamingRule("addEnvironment",
-                            "org.apache.catalina.deploy.ContextEnvironment"));
-
-        digester.addCallMethod(prefix + "web-app/env-entry/description",
-                               "setDescription", 0);
-        digester.addCallMethod(prefix + "web-app/env-entry/env-entry-name",
-                               "setName", 0);
-        digester.addCallMethod(prefix + "web-app/env-entry/env-entry-type",
-                               "setType", 0);
-        digester.addCallMethod(prefix + "web-app/env-entry/env-entry-value",
-                               "setValue", 0);
+        configureNamingRules(digester);
 
         digester.addObjectCreate(prefix + "web-app/error-page",
                                  "org.apache.catalina.deploy.ErrorPage");
@@ -279,6 +228,160 @@
         digester.addCallParam(prefix + "web-app/mime-mapping/extension", 0);
         digester.addCallParam(prefix + "web-app/mime-mapping/mime-type", 1);
 
+
+        digester.addObjectCreate(prefix + "web-app/security-constraint",
+                                 "org.apache.catalina.deploy.SecurityConstraint");
+        digester.addSetNext(prefix + "web-app/security-constraint",
+                            "addConstraint",
+                            "org.apache.catalina.deploy.SecurityConstraint");
+
+        digester.addRule(prefix + "web-app/security-constraint/auth-constraint",
+                         new SetAuthConstraintRule());
+        digester.addCallMethod(prefix + "web-app/security-constraint/auth-constraint/role-name",
+                               "addAuthRole", 0);
+        digester.addCallMethod(prefix + "web-app/security-constraint/display-name",
+                               "setDisplayName", 0);
+        digester.addCallMethod(prefix + "web-app/security-constraint/user-data-constraint/transport-guarantee",
+                               "setUserConstraint", 0);
+
+        digester.addObjectCreate(prefix + "web-app/security-constraint/web-resource-collection",
+                                 "org.apache.catalina.deploy.SecurityCollection");
+        digester.addSetNext(prefix + "web-app/security-constraint/web-resource-collection",
+                            "addCollection",
+                            "org.apache.catalina.deploy.SecurityCollection");
+        digester.addCallMethod(prefix + "web-app/security-constraint/web-resource-collection/http-method",
+                               "addMethod", 0);
+        digester.addCallMethod(prefix + "web-app/security-constraint/web-resource-collection/url-pattern",
+                               "addPattern", 0);
+        digester.addCallMethod(prefix + "web-app/security-constraint/web-resource-collection/web-resource-name",
+                               "setName", 0);
+
+        digester.addCallMethod(prefix + "web-app/security-role/role-name",
+                               "addSecurityRole", 0);
+
+        digester.addRule(prefix + "web-app/servlet",
+                         new WrapperCreateRule());
+        digester.addSetNext(prefix + "web-app/servlet",
+                            "addChild",
+                            "org.apache.catalina.Container");
+
+        digester.addCallMethod(prefix + "web-app/servlet/init-param",
+                               "addInitParameter", 2);
+        digester.addCallParam(prefix + "web-app/servlet/init-param/param-name",
+                              0);
+        digester.addCallParam(prefix + "web-app/servlet/init-param/param-value",
+                              1);
+
+        digester.addCallMethod(prefix + "web-app/servlet/jsp-file",
+                               "setJspFile", 0);
+        digester.addCallMethod(prefix + "web-app/servlet/load-on-startup",
+                               "setLoadOnStartupString", 0);
+        digester.addCallMethod(prefix + "web-app/servlet/run-as/role-name",
+                               "setRunAs", 0);
+
+        digester.addRule(prefix + "web-app/servlet/security-role-ref",
+                new SecurityRoleRefCreateRule());
+        digester.addCallMethod(
+                prefix + "web-app/servlet/security-role-ref/role-link",
+                "setLink", 0);
+        digester.addCallMethod(
+                prefix + "web-app/servlet/security-role-ref/role-name",
+                "setName", 0);
+
+        digester.addCallMethod(prefix + "web-app/servlet/servlet-class",
+                              "setServletClass", 0);
+        digester.addCallMethod(prefix + "web-app/servlet/servlet-name",
+                              "setName", 0);
+
+        digester.addRule(prefix + "web-app/servlet-mapping",
+                               new CallMethodMultiRule("addServletMapping", 2, 0));
+        digester.addCallParam(prefix + "web-app/servlet-mapping/servlet-name", 1);
+        digester.addRule(prefix + "web-app/servlet-mapping/url-pattern", new CallParamMultiRule(0));
+
+        digester.addRule(prefix + "web-app/session-config",
+                         sessionConfig);
+        
+        digester.addCallMethod(prefix + "web-app/session-config/session-timeout",
+                               "setSessionTimeout", 1,
+                               new Class[] { Integer.TYPE });
+        digester.addCallParam(prefix + "web-app/session-config/session-timeout", 0);
+
+        digester.addCallMethod(prefix + "web-app/taglib",
+                               "addTaglib", 2);
+        digester.addCallParam(prefix + "web-app/taglib/taglib-location", 1);
+        digester.addCallParam(prefix + "web-app/taglib/taglib-uri", 0);
+
+        digester.addCallMethod(prefix + "web-app/welcome-file-list/welcome-file",
+                               "addWelcomeFile", 0);
+
+        digester.addCallMethod(prefix + "web-app/locale-encoding-mapping-list/locale-encoding-mapping",
+                              "addLocaleEncodingMappingParameter", 2);
+        digester.addCallParam(prefix + "web-app/locale-encoding-mapping-list/locale-encoding-mapping/locale", 0);
+        digester.addCallParam(prefix + "web-app/locale-encoding-mapping-list/locale-encoding-mapping/encoding", 1);
+
+    }
+
+    protected void configureNamingRules(Digester digester) {
+        //ejb-local-ref
+        digester.addObjectCreate(prefix + "web-app/ejb-local-ref",
+                                 "org.apache.catalina.deploy.ContextLocalEjb");
+        digester.addRule(prefix + "web-app/ejb-local-ref",
+                new SetNextNamingRule("addLocalEjb",
+                            "org.apache.catalina.deploy.ContextLocalEjb"));
+
+        digester.addCallMethod(prefix + "web-app/ejb-local-ref/description",
+                               "setDescription", 0);
+        digester.addCallMethod(prefix + "web-app/ejb-local-ref/ejb-link",
+                               "setLink", 0);
+        digester.addCallMethod(prefix + "web-app/ejb-local-ref/ejb-ref-name",
+                               "setName", 0);
+        digester.addCallMethod(prefix + "web-app/ejb-local-ref/ejb-ref-type",
+                               "setType", 0);
+        digester.addCallMethod(prefix + "web-app/ejb-local-ref/local",
+                               "setLocal", 0);
+        digester.addCallMethod(prefix + "web-app/ejb-local-ref/local-home",
+                               "setHome", 0);
+        configureInjectionRules(digester, "web-app/ejb-local-ref/");
+
+        //ejb-ref
+        digester.addObjectCreate(prefix + "web-app/ejb-ref",
+                                 "org.apache.catalina.deploy.ContextEjb");
+        digester.addRule(prefix + "web-app/ejb-ref",
+                new SetNextNamingRule("addEjb",
+                            "org.apache.catalina.deploy.ContextEjb"));
+
+        digester.addCallMethod(prefix + "web-app/ejb-ref/description",
+                               "setDescription", 0);
+        digester.addCallMethod(prefix + "web-app/ejb-ref/ejb-link",
+                               "setLink", 0);
+        digester.addCallMethod(prefix + "web-app/ejb-ref/ejb-ref-name",
+                               "setName", 0);
+        digester.addCallMethod(prefix + "web-app/ejb-ref/ejb-ref-type",
+                               "setType", 0);
+        digester.addCallMethod(prefix + "web-app/ejb-ref/home",
+                               "setHome", 0);
+        digester.addCallMethod(prefix + "web-app/ejb-ref/remote",
+                               "setRemote", 0);
+        configureInjectionRules(digester, "web-app/ejb-ref/");
+
+        //env-entry
+        digester.addObjectCreate(prefix + "web-app/env-entry",
+                                 "org.apache.catalina.deploy.ContextEnvironment");
+        digester.addRule(prefix + "web-app/env-entry",
+                new SetNextNamingRule("addEnvironment",
+                            "org.apache.catalina.deploy.ContextEnvironment"));
+
+        digester.addCallMethod(prefix + "web-app/env-entry/description",
+                               "setDescription", 0);
+        digester.addCallMethod(prefix + "web-app/env-entry/env-entry-name",
+                               "setName", 0);
+        digester.addCallMethod(prefix + "web-app/env-entry/env-entry-type",
+                               "setType", 0);
+        digester.addCallMethod(prefix + "web-app/env-entry/env-entry-value",
+                               "setValue", 0);
+        configureInjectionRules(digester, "web-app/env-entry/");
+
+        //resource-env-ref
         digester.addObjectCreate(prefix + "web-app/resource-env-ref",
             "org.apache.catalina.deploy.ContextResourceEnvRef");
         digester.addRule(prefix + "web-app/resource-env-ref",
@@ -289,7 +392,9 @@
                 "setName", 0);
         digester.addCallMethod(prefix + "web-app/resource-env-ref/resource-env-ref-type",
                 "setType", 0);
+        configureInjectionRules(digester, "web-app/ejb-local-ref/");
 
+        //message-destination
         digester.addObjectCreate(prefix + "web-app/message-destination",
                                  "org.apache.catalina.deploy.MessageDestination");
         digester.addSetNext(prefix + "web-app/message-destination",
@@ -307,6 +412,7 @@
         digester.addCallMethod(prefix + "web-app/message-destination/message-destination-name",
                                "setName", 0);
 
+        //message-destination-ref
         digester.addObjectCreate(prefix + "web-app/message-destination-ref",
                                  "org.apache.catalina.deploy.MessageDestinationRef");
         digester.addSetNext(prefix + "web-app/message-destination-ref",
@@ -324,6 +430,9 @@
         digester.addCallMethod(prefix + "web-app/message-destination-ref/message-destination-usage",
                                "setUsage", 0);
 
+        configureInjectionRules(digester, "web-app/message-destination-ref/");
+
+        //resource-ref
         digester.addObjectCreate(prefix + "web-app/resource-ref",
                                  "org.apache.catalina.deploy.ContextResource");
         digester.addRule(prefix + "web-app/resource-ref",
@@ -340,37 +449,9 @@
                                "setScope", 0);
         digester.addCallMethod(prefix + "web-app/resource-ref/res-type",
                                "setType", 0);
+        configureInjectionRules(digester, "web-app/resource-ref/");
 
-        digester.addObjectCreate(prefix + "web-app/security-constraint",
-                                 "org.apache.catalina.deploy.SecurityConstraint");
-        digester.addSetNext(prefix + "web-app/security-constraint",
-                            "addConstraint",
-                            "org.apache.catalina.deploy.SecurityConstraint");
-
-        digester.addRule(prefix + "web-app/security-constraint/auth-constraint",
-                         new SetAuthConstraintRule());
-        digester.addCallMethod(prefix + "web-app/security-constraint/auth-constraint/role-name",
-                               "addAuthRole", 0);
-        digester.addCallMethod(prefix + "web-app/security-constraint/display-name",
-                               "setDisplayName", 0);
-        digester.addCallMethod(prefix + "web-app/security-constraint/user-data-constraint/transport-guarantee",
-                               "setUserConstraint", 0);
-
-        digester.addObjectCreate(prefix + "web-app/security-constraint/web-resource-collection",
-                                 "org.apache.catalina.deploy.SecurityCollection");
-        digester.addSetNext(prefix + "web-app/security-constraint/web-resource-collection",
-                            "addCollection",
-                            "org.apache.catalina.deploy.SecurityCollection");
-        digester.addCallMethod(prefix + "web-app/security-constraint/web-resource-collection/http-method",
-                               "addMethod", 0);
-        digester.addCallMethod(prefix + "web-app/security-constraint/web-resource-collection/url-pattern",
-                               "addPattern", 0);
-        digester.addCallMethod(prefix + "web-app/security-constraint/web-resource-collection/web-resource-name",
-                               "setName", 0);
-
-        digester.addCallMethod(prefix + "web-app/security-role/role-name",
-                               "addSecurityRole", 0);
-
+        //service-ref
         digester.addObjectCreate(prefix + "web-app/service-ref",
                                  "org.apache.catalina.deploy.ContextService");
         digester.addRule(prefix + "web-app/service-ref",
@@ -403,7 +484,7 @@
         digester.addRule(prefix + "web-app/service-ref/handler",
                          new SetNextRule("addHandler",
                          "org.apache.catalina.deploy.ContextHandler"));
-        
+
         digester.addCallMethod(prefix + "web-app/service-ref/handler/handler-name",
                                "setName", 0);
         digester.addCallMethod(prefix + "web-app/service-ref/handler/handler-class",
@@ -422,69 +503,20 @@
                                "addSoapRole", 0);
         digester.addCallMethod(prefix + "web-app/service-ref/handler/port-name",
                                "addPortName", 0);
-        
-        digester.addRule(prefix + "web-app/servlet",
-                         new WrapperCreateRule());
-        digester.addSetNext(prefix + "web-app/servlet",
-                            "addChild",
-                            "org.apache.catalina.Container");
-
-        digester.addCallMethod(prefix + "web-app/servlet/init-param",
-                               "addInitParameter", 2);
-        digester.addCallParam(prefix + "web-app/servlet/init-param/param-name",
-                              0);
-        digester.addCallParam(prefix + "web-app/servlet/init-param/param-value",
-                              1);
-
-        digester.addCallMethod(prefix + "web-app/servlet/jsp-file",
-                               "setJspFile", 0);
-        digester.addCallMethod(prefix + "web-app/servlet/load-on-startup",
-                               "setLoadOnStartupString", 0);
-        digester.addCallMethod(prefix + "web-app/servlet/run-as/role-name",
-                               "setRunAs", 0);
-
-        digester.addRule(prefix + "web-app/servlet/security-role-ref",
-                new SecurityRoleRefCreateRule());
-        digester.addCallMethod(
-                prefix + "web-app/servlet/security-role-ref/role-link",
-                "setLink", 0);
-        digester.addCallMethod(
-                prefix + "web-app/servlet/security-role-ref/role-name",
-                "setName", 0);
-
-        digester.addCallMethod(prefix + "web-app/servlet/servlet-class",
-                              "setServletClass", 0);
-        digester.addCallMethod(prefix + "web-app/servlet/servlet-name",
-                              "setName", 0);
+        configureInjectionRules(digester, "web-app/service-ref/");
 
-        digester.addRule(prefix + "web-app/servlet-mapping",
-                               new CallMethodMultiRule("addServletMapping", 2, 0));
-        digester.addCallParam(prefix + "web-app/servlet-mapping/servlet-name", 1);
-        digester.addRule(prefix + "web-app/servlet-mapping/url-pattern", new CallParamMultiRule(0));
-
-        digester.addRule(prefix + "web-app/session-config",
-                         sessionConfig);
-        
-        digester.addCallMethod(prefix + "web-app/session-config/session-timeout",
-                               "setSessionTimeout", 1,
-                               new Class[] { Integer.TYPE });
-        digester.addCallParam(prefix + "web-app/session-config/session-timeout", 0);
 
-        digester.addCallMethod(prefix + "web-app/taglib",
-                               "addTaglib", 2);
-        digester.addCallParam(prefix + "web-app/taglib/taglib-location", 1);
-        digester.addCallParam(prefix + "web-app/taglib/taglib-uri", 0);
+    }
 
-        digester.addCallMethod(prefix + "web-app/welcome-file-list/welcome-file",
-                               "addWelcomeFile", 0);
+    protected void configureInjectionRules(Digester digester, String base) {
 
-        digester.addCallMethod(prefix + "web-app/locale-encoding-mapping-list/locale-encoding-mapping",
-                              "addLocaleEncodingMappingParameter", 2);
-        digester.addCallParam(prefix + "web-app/locale-encoding-mapping-list/locale-encoding-mapping/locale", 0);
-        digester.addCallParam(prefix + "web-app/locale-encoding-mapping-list/locale-encoding-mapping/encoding", 1);
+        digester.addCallMethod(prefix + base + "injection-target", "addInjectionTarget", 2);
+        digester.addCallParam(prefix + base + "injection-target/injection-target-class", 0);
+        digester.addCallParam(prefix + base + "injection-target/injection-target-name", 1);
 
     }
 
+
     /**
      * Reset counter used for validating the web.xml file.
      */

Propchange: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/coyote/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 12 22:47:32 2009
@@ -1 +1,2 @@
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/coyote:783483-783555
 /tomcat/trunk/java/org/apache/coyote:673796,673820

Propchange: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/jk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 12 22:47:32 2009
@@ -1 +1,2 @@
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/jk:783483-783555
 /tomcat/trunk/java/org/apache/jk:673796,673820

Propchange: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/naming/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 12 22:47:32 2009
@@ -1 +1,2 @@
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/naming:783483-783555
 /tomcat/trunk/java/org/apache/naming:673796,673820

Propchange: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/tomcat/jni/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 12 22:47:32 2009
@@ -1 +1,2 @@
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/tomcat/jni:783483-783555
 /tomcat/trunk/java/org/apache/tomcat/jni:673796,673820

Propchange: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/tomcat/util/net/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 12 22:47:32 2009
@@ -1 +1,2 @@
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/tomcat/util/net:783483-783555
 /tomcat/trunk/java/org/apache/tomcat/util/net:673796,673820

Modified: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/resources/org/apache/catalina/core/LocalStrings.properties
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/resources/org/apache/catalina/core/LocalStrings.properties?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/resources/org/apache/catalina/core/LocalStrings.properties (original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/resources/org/apache/catalina/core/LocalStrings.properties Fri Jun 12 22:47:32 2009
@@ -201,7 +201,6 @@
 standardWrapper.notContext=Parent container of a Wrapper must be a Context
 standardWrapper.notFound=Servlet {0} is not available
 standardWrapper.notServlet=Class {0} is not a Servlet
-standardWrapper.privilegedServlet=Servlet of class {0} is privileged and cannot be loaded by this web application
 standardWrapper.releaseFilters=Release filters exception for servlet {0}
 standardWrapper.serviceException=Servlet.service() for servlet {0} threw exception
 standardWrapper.statusHeader=HTTP Status {0} - {1}
@@ -210,7 +209,9 @@
 standardWrapper.unloadException=Servlet {0} threw unload() exception
 standardWrapper.unloading=Cannot allocate servlet {0} because it is being unloaded
 standardWrapper.waiting=Waiting for {0} instance(s) to be deallocated
-standardWrapper.restrictedServletsResource=Restricted servlets property file not found
 
-applicationFilterConfig.restrictedFiltersResource=Restricted filters property file not found
-applicationFilterConfig.privilegedFilter=Filter of class {0} is privileged and cannot be loaded by this web application
+defaultInstanceManager.restrictedServletsResource=Restricted servlets property file not found
+defaultInstanceManager.privilegedServlet=Servlet of class {0} is privileged and cannot be loaded by this web application
+defaultInstanceManager.restrictedFiltersResource=Restricted filters property file not found
+defaultInstanceManager.privilegedFilter=Filter of class {0} is privileged and cannot be loaded by this web application
+defaultInstanceManager.restrictedListenersResources="Restricted listeners property file not found
\ No newline at end of file

Propchange: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/resources/org/apache/catalina/core/LocalStrings.properties
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Fri Jun 12 22:47:32 2009
@@ -0,0 +1,2 @@
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/LocalStrings.properties:783483-783555
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/resources/org/apache/catalina/core/LocalStrings.properties:783483-783555

Modified: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/resources/org/apache/catalina/servlets/LocalStrings.properties
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/resources/org/apache/catalina/servlets/LocalStrings.properties?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/resources/org/apache/catalina/servlets/LocalStrings.properties (original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/resources/org/apache/catalina/servlets/LocalStrings.properties Fri Jun 12 22:47:32 2009
@@ -25,7 +25,6 @@
 invokerServlet.notNamed=Cannot call invoker servlet with a named dispatcher
 invokerServlet.noWrapper=Container has not called setWrapper() for this servlet
 webdavservlet.jaxpfailed=JAXP initialization failed
-webdavservlet.enternalEntityIgnored=The request included a reference to an external entity with PublicID {0} and SystemID {1} which was ignored
 directory.filename=Filename
 directory.lastModified=Last Modified
 directory.parent=Up To {0}

Propchange: geronimo/external/trunk/tomcat-parent-6.0.18/catalina/src/main/resources/org/apache/catalina/servlets/LocalStrings.properties
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Fri Jun 12 22:47:32 2009
@@ -0,0 +1,2 @@
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/servlets/LocalStrings.properties:783483-783555
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/resources/org/apache/catalina/servlets/LocalStrings.properties:783483-783555

Propchange: geronimo/external/trunk/tomcat-parent-6.0.18/jasper-el/src/main/java/org/apache/el/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 12 22:47:32 2009
@@ -1 +1,2 @@
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/jasper-el/src/main/java/org/apache/el:783483-783555
 /tomcat/trunk/java/org/apache/el:673796,673820

Propchange: geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 12 22:47:32 2009
@@ -1 +1,2 @@
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper:783483-783555
 /tomcat/trunk/java/org/apache/jasper:673796,673820

Modified: geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/Constants.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/Constants.java?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/Constants.java (original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/Constants.java Fri Jun 12 22:47:32 2009
@@ -199,4 +199,7 @@
      */
     public static final String SESSION_PARAMETER_NAME = "jsessionid";
 
+    public static final boolean USE_INSTANCE_MANAGER_FOR_TAGS =
+        Boolean.valueOf(System.getProperty("org.apache.jasper.Constants.USE_INSTANCE_MANAGER_FOR_TAGS", "false")).booleanValue();
+
 }

Modified: geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/JspCompilationContext.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/JspCompilationContext.java?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/JspCompilationContext.java (original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/JspCompilationContext.java Fri Jun 12 22:47:32 2009
@@ -609,12 +609,7 @@
         try {
             getJspLoader();
             
-            String name;
-            if (isTagFile()) {
-                name = tagInfo.getTagClassName();
-            } else {
-                name = getServletPackageName() + "." + getServletClassName();
-            }
+            String name = getFQCN();
             servletClass = jspLoader.loadClass(name);
         } catch (ClassNotFoundException cex) {
             throw new JasperException(Localizer.getMessage("jsp.error.unable.load"),
@@ -627,6 +622,16 @@
         return servletClass;
     }
 
+    public String getFQCN() {
+        String name;
+        if (isTagFile()) {
+            name = tagInfo.getTagClassName();
+        } else {
+            name = getServletPackageName() + "." + getServletClassName();
+        }
+        return name;
+    }
+
     // ==================== protected methods ==================== 
 
     static Object outputDirLock = new Object();

Modified: geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/compiler/Generator.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/compiler/Generator.java?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/compiler/Generator.java (original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/compiler/Generator.java Fri Jun 12 22:47:32 2009
@@ -73,8 +73,8 @@
 
     private static final String VAR_EXPRESSIONFACTORY = 
         System.getProperty("org.apache.jasper.compiler.Generator.VAR_EXPRESSIONFACTORY", "_el_expressionfactory");
-    private static final String VAR_ANNOTATIONPROCESSOR = 
-        System.getProperty("org.apache.jasper.compiler.Generator.VAR_ANNOTATIONPROCESSOR", "_jsp_annotationprocessor");
+    private static final String VAR_INSTANCEMANAGER =
+        System.getProperty("org.apache.jasper.compiler.Generator.VAR_INSTANCEMANAGER", "_jsp_instancemanager");
 
     private ServletWriter out;
 
@@ -413,14 +413,14 @@
         }
         out.println(".getServletContext()).getExpressionFactory();");
 
-        out.printin(VAR_ANNOTATIONPROCESSOR);
-        out.print(" = (org.apache.AnnotationProcessor) ");
+        out.printin(VAR_INSTANCEMANAGER);
+        out.print(" = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(");
         if (ctxt.isTagFile()) {
             out.print("config");
         } else {
             out.print("getServletConfig()");
         }
-        out.println(".getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());");
+        out.println(");");
 
         out.popIndent();
         out.printil("}");
@@ -524,8 +524,8 @@
         out.printin("private javax.el.ExpressionFactory ");
         out.print(VAR_EXPRESSIONFACTORY);
         out.println(";");
-        out.printin("private org.apache.AnnotationProcessor ");
-        out.print(VAR_ANNOTATIONPROCESSOR);
+        out.printin("private org.apache.InstanceManager ");
+        out.print(VAR_INSTANCEMANAGER);
         out.println(";");
         out.println();
     }
@@ -2135,11 +2135,11 @@
 
             String tagHandlerClassName = JspUtil
                     .getCanonicalName(tagHandlerClass);
-            out.printin(tagHandlerClassName);
-            out.print(" ");
-            out.print(tagHandlerVar);
-            out.print(" = ");
             if (isPoolingEnabled && !(n.implementsJspIdConsumer())) {
+                out.printin(tagHandlerClassName);
+                out.print(" ");
+                out.print(tagHandlerVar);
+                out.print(" = ");
                 out.print("(");
                 out.print(tagHandlerClassName);
                 out.print(") ");
@@ -2148,14 +2148,7 @@
                 out.print(tagHandlerClassName);
                 out.println(".class);");
             } else {
-                out.print("new ");
-                out.print(tagHandlerClassName);
-                out.println("();");
-                out.printin("org.apache.jasper.runtime.AnnotationHelper.postConstruct(");
-                out.print(VAR_ANNOTATIONPROCESSOR);
-                out.print(", ");
-                out.print(tagHandlerVar);
-                out.println(");");
+                writeNewInstance(tagHandlerVar, tagHandlerClassName);
             }
 
             // includes setting the context
@@ -2213,8 +2206,7 @@
                         out.println("[0]++;");
                     }
                     out.printin(tagHandlerVar);
-                    out
-                            .println(".setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);");
+                    out.println(".setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);");
                     out.printin(tagHandlerVar);
                     out.println(".doInitBody();");
 
@@ -2240,6 +2232,40 @@
             n.setEndJavaLine(out.getJavaLine());
         }
 
+        private void writeNewInstance(String tagHandlerVar, String tagHandlerClassName) {
+        	if (Constants.USE_INSTANCE_MANAGER_FOR_TAGS) {
+        		out.printin(tagHandlerClassName);
+        		out.print(" ");
+        		out.print(tagHandlerVar);
+        		out.print(" = (");
+        		out.print(tagHandlerClassName);
+        		out.print(")");
+        		out.print(VAR_INSTANCEMANAGER);
+        		out.print(".newInstance(\"");
+        		out.print(tagHandlerClassName);
+        		out.println("\", this.getClass().getClassLoader());");
+        	} else {
+        		out.printin(tagHandlerClassName);
+        		out.print(" ");
+        		out.print(tagHandlerVar);
+        		out.print(" = (");
+        		out.print("new ");
+        		out.print(tagHandlerClassName);
+        		out.println("());");
+        		out.printin(VAR_INSTANCEMANAGER);
+        		out.print(".newInstance(");
+        		out.print(tagHandlerVar);
+        		out.println(");");
+        	}
+        }
+
+        private void writeDestroyInstance(String tagHandlerVar) {
+            out.printin(VAR_INSTANCEMANAGER);
+            out.print(".destroyInstance(");
+            out.print(tagHandlerVar);
+            out.println(");");
+        }
+
         private void generateCustomEnd(Node.CustomTag n, String tagHandlerVar,
                 String tagEvalVar, String tagPushBodyCountVar) {
 
@@ -2301,11 +2327,7 @@
                 } else {
                     out.printin(tagHandlerVar);
                     out.println(".release();");
-                    out.printin("org.apache.jasper.runtime.AnnotationHelper.preDestroy(");
-                    out.print(VAR_ANNOTATIONPROCESSOR);
-                    out.print(", ");
-                    out.print(tagHandlerVar);
-                    out.println(");");
+                    writeDestroyInstance(tagHandlerVar);
                 }
             }
             if (isTagFile || isFragment) {
@@ -2348,11 +2370,7 @@
             } else {
                 out.printin(tagHandlerVar);
                 out.println(".release();");
-                out.printin("org.apache.jasper.runtime.AnnotationHelper.preDestroy(");
-                out.print(VAR_ANNOTATIONPROCESSOR);
-                out.print(", ");
-                out.print(tagHandlerVar);
-                out.println(");");
+                writeDestroyInstance(tagHandlerVar);
             }
 
             if (n.implementsTryCatchFinally()) {
@@ -2384,21 +2402,8 @@
 
             String tagHandlerClassName = JspUtil
                     .getCanonicalName(tagHandlerClass);
-            out.printin(tagHandlerClassName);
-            out.print(" ");
-            out.print(tagHandlerVar);
-            out.print(" = ");
-            out.print("new ");
-            out.print(tagHandlerClassName);
-            out.println("();");
+            writeNewInstance(tagHandlerVar, tagHandlerClassName);
 
-            // Resource injection
-            out.printin("org.apache.jasper.runtime.AnnotationHelper.postConstruct(");
-            out.print(VAR_ANNOTATIONPROCESSOR);
-            out.print(", ");
-            out.print(tagHandlerVar);
-            out.println(");");
-            
             generateSetters(n, tagHandlerVar, handlerInfo, true);
 
             // JspIdConsumer (after context has been set)
@@ -2451,11 +2456,7 @@
             syncScriptingVars(n, VariableInfo.AT_END);
 
             // Resource injection
-            out.printin("org.apache.jasper.runtime.AnnotationHelper.preDestroy(");
-            out.print(VAR_ANNOTATIONPROCESSOR);
-            out.print(", ");
-            out.print(tagHandlerVar);
-            out.println(");");
+            writeDestroyInstance(tagHandlerVar);
 
             n.setEndJavaLine(out.getJavaLine());
         }



Mime
View raw message