Modified: tomcat/trunk/java/org/apache/jasper/Constants.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/Constants.java?rev=605000&r1=604999&r2=605000&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/Constants.java (original)
+++ tomcat/trunk/java/org/apache/jasper/Constants.java Mon Dec 17 12:55:56 2007
@@ -193,6 +193,9 @@
     public static final boolean IS_SECURITY_ENABLED = 
         (System.getSecurityManager() != null);
 
+    public static final boolean USE_INSTANCE_MANAGER_FOR_TAGS =
+        
Boolean.valueOf(System.getProperty("org.apache.jasper.Constants.USE_INSTANCE_MANAGER_FOR_TAGS",
 "false")).booleanValue();
+
     /**
      * The name of the path parameter used to pass the session identifier
      * back and forth with the client.

Modified: tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java?rev=605000&r1=604999&r2=605000&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java (original)
+++ tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java Mon Dec 17 
12:55:56 2007
@@ -589,12 +589,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"),
@@ -605,6 +600,16 @@
         }
         removed = 0;
         return servletClass;
+    }
+
+    public String getFQCN() {
+        String name;
+        if (isTagFile()) {
+            name = tagInfo.getTagClassName();
+        } else {
+            name = getServletPackageName() + "." + getServletClassName();
+        }
+        return name;
     }
 
     // ==================== protected methods ==================== 

Modified: tomcat/trunk/java/org/apache/jasper/compiler/Generator.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Generator.java?rev=605000&r1=604999&r2=605000&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Generator.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Generator.java Mon Dec 17 
12:55:56 2007
@@ -48,20 +48,20 @@
 
 /**
  * Generate Java source from Nodes
- * 
+ *
  * @author Anil K. Vijendran
  * @author Danno Ferrin
  * @author Mandar Raje
  * @author Rajiv Mordani
  * @author Pierre Delisle
- * 
+ *
  * Tomcat 4.1.x and Tomcat 5:
  * @author Kin-man Chung
  * @author Jan Luehe
  * @author Shawn Bayern
  * @author Mark Roth
  * @author Denis Benoit
- * 
+ *
  * Tomcat 6.x
  * @author Jacob Hookom
  * @author Remy Maucherat
@@ -71,10 +71,10 @@
 
     private static final Class[] OBJECT_CLASS = { Object.class };
 
-    private static final String VAR_EXPRESSIONFACTORY = 
+    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;
 
@@ -186,7 +186,7 @@
             /*
              * Generates getServletInfo() method that returns the value of the
              * page directive's 'info' attribute, if present.
-             * 
+             *
              * The Validator has already ensured that if the translation unit
              * contains more than one page directive with an 'info' attribute,
              * their values match.
@@ -251,7 +251,7 @@
 
             /*
              * Constructor
-             * 
+             *
              * @param v Vector of tag handler pool names to populate
              */
             TagHandlerPoolVisitor(Vector v) {
@@ -280,7 +280,7 @@
             /*
              * Creates the name of the tag handler pool whose tag handlers may
              * be (re)used to service this action.
-             * 
+             *
              * @return The name of the tag handler pool
              */
             private String createTagHandlerPoolName(String prefix,
@@ -376,7 +376,7 @@
      * Generates the _jspInit() method for instantiating the tag handler pools.
      * For tag file, _jspInit has to be invoked manually, and the ServletConfig
      * object explicitly passed.
-     * 
+     *
      * In JSP 2.1, we also instantiate an ExpressionFactory
      */
     private void generateInit() {
@@ -400,7 +400,7 @@
                 out.println(");");
             }
         }
-        
+
         out.printin(VAR_EXPRESSIONFACTORY);
         out.print(" = _jspxFactory.getJspApplicationContext(");
         if (ctxt.isTagFile()) {
@@ -410,14 +410,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("}");
@@ -432,14 +432,14 @@
 
         out.printil("public void _jspDestroy() {");
         out.pushIndent();
-        
+
         if (isPoolingEnabled) {
             for (int i = 0; i < tagHandlerPoolNames.size(); i++) {
                                 out.printin((String) 
tagHandlerPoolNames.elementAt(i));
                                 out.println(".release();");
             }
         }
-        
+
         out.popIndent();
         out.printil("}");
         out.println();
@@ -506,7 +506,7 @@
      * Declare tag handler pools (tags of the same type and with the same
      * attribute set share the same tag handler pool) (shared by servlet and 
tag
      * handler preamble generation)
-     * 
+     *
      * In JSP 2.1, we also scope an instance of ExpressionFactory
      */
     private void genPreambleClassVariableDeclarations(String className)
@@ -521,8 +521,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();
     }
@@ -539,7 +539,7 @@
         out.popIndent();
         out.printil("}");
         out.println();
-        
+
         generateInit();
         generateDestroy();
     }
@@ -781,7 +781,7 @@
          * interpreter. If the result is a Named Attribute we insert the
          * generated variable name. Otherwise the result is a string literal,
          * quoted and escaped.
-         * 
+         *
          * @param attr
          *            An JspAttribute object
          * @param encode
@@ -829,7 +829,7 @@
         /**
          * Prints the attribute value specified in the param action, in the 
form
          * of name=value string.
-         * 
+         *
          * @param n
          *            the parent node for the param action nodes.
          */
@@ -2142,11 +2142,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(") ");
@@ -2155,14 +2155,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
@@ -2220,8 +2213,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();");
 
@@ -2247,6 +2239,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) {
 
@@ -2308,11 +2334,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) {
@@ -2355,11 +2377,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()) {
@@ -2391,21 +2409,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)
@@ -2458,11 +2463,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());
         }
@@ -2504,7 +2505,7 @@
 
         /*
          * This method is called as part of the custom tag's start element.
-         * 
+         *
          * If the given custom tag has a custom nesting level greater than 0,
          * save the current values of its scripting variables to temporary
          * variables, so those values may be restored in the tag's end element.
@@ -2566,7 +2567,7 @@
 
         /*
          * This method is called as part of the custom tag's end element.
-         * 
+         *
          * If the given custom tag has a custom nesting level greater than 0,
          * restore its scripting variables to their original values that were
          * saved in the tag's start element.
@@ -2771,14 +2772,14 @@
 
                 // reset buffer
                 sb.setLength(0);
-                
+
                 // create our mark
                 sb.append(n.getStart().toString());
                 sb.append(" '");
                 sb.append(attrValue);
-                sb.append('\'');                
+                sb.append('\'');
                 String mark = sb.toString();
-                
+
                 // reset buffer
                 sb.setLength(0);
 
@@ -2865,7 +2866,7 @@
 
         /**
          * Generate code to create a map for the alias variables
-         * 
+         *
          * @return the name of the map
          */
         private String generateAliasMap(Node.CustomTag n, String tagHandlerVar)
@@ -2964,7 +2965,7 @@
             for (int i = 0; attrs != null && i < attrs.length; i++) {
                 String attrValue = evaluateAttribute(handlerInfo, attrs[i], n,
                         tagHandlerVar);
-                
+
                 Mark m = n.getStart();
                 out.printil("// 
"+m.getFile()+"("+m.getLineNumber()+","+m.getColumnNumber()+") "+ 
attrs[i].getTagAttributeInfo());
                 if (attrs[i].isDynamic()) {
@@ -3129,7 +3130,7 @@
         /**
          * Generate the code required to obtain the runtime value of the given
          * named attribute.
-         * 
+         *
          * @return The name of the temporary variable the result is stored in.
          */
         public String generateNamedAttributeValue(Node.NamedAttribute n)
@@ -3180,7 +3181,7 @@
         /**
          * Similar to generateNamedAttributeValue, but create a JspFragment
          * instead.
-         * 
+         *
          * @param n
          *            The parent node of the named attribute
          * @param tagHandlerVar
@@ -3335,7 +3336,7 @@
 
     /**
      * The main entry for Generator.
-     * 
+     *
      * @param out
      *            The servlet output writer
      * @param compiler
@@ -3452,7 +3453,7 @@
          * share the code generator with JSPs.
          */
         out.printil("PageContext _jspx_page_context = 
(PageContext)jspContext;");
-        
+
         // Declare implicit objects.
         out.printil("HttpServletRequest request = "
                 + "(HttpServletRequest) _jspx_page_context.getRequest();");
@@ -3463,10 +3464,10 @@
         out.printil("ServletConfig config = 
_jspx_page_context.getServletConfig();");
         out.printil("JspWriter out = jspContext.getOut();");
         out.printil("_jspInit(config);");
-        
+
         // set current JspContext on ELContext
         
out.printil("jspContext.getELContext().putContext(JspContext.class,jspContext);");
-        
+
         generatePageScopedVariables(tagInfo);
 
         declareTemporaryScriptingVars(tag);
@@ -3495,7 +3496,7 @@
         out.popIndent();
         out.printil("} finally {");
         out.pushIndent();
-        
+
         // handle restoring VariableMapper
         TagAttributeInfo[] attrInfos = tagInfo.getAttributes();
         for (int i = 0; i < attrInfos.length; i++) {
@@ -3507,10 +3508,10 @@
                 out.println(");");
             }
         }
-        
+
         // restore nested JspContext on ELContext
         
out.printil("jspContext.getELContext().putContext(JspContext.class,super.getJspContext());");
-        
+
         out.printil("((org.apache.jasper.runtime.JspContextWrapper) 
jspContext).syncEndTagFile();");
         if (isPoolingEnabled && !tagHandlerPoolNames.isEmpty()) {
             out.printil("_jspDestroy();");
@@ -3725,17 +3726,17 @@
         boolean variableMapperVar = false;
         for (int i = 0; i < attrInfos.length; i++) {
             String attrName = attrInfos[i].getName();
-            
+
             // handle assigning deferred vars to VariableMapper, storing
             // previous values under '_el_ve[i]' for later re-assignment
             if (attrInfos[i].isDeferredValue() || 
attrInfos[i].isDeferredMethod()) {
-                
+
                 // we need to scope the modified VariableMapper for 
consistency and performance
                 if (!variableMapperVar) {
                     out.printil("javax.el.VariableMapper _el_variablemapper = 
jspContext.getELContext().getVariableMapper();");
                     variableMapperVar = true;
                 }
-                
+
                 out.printin("javax.el.ValueExpression _el_ve");
                 out.print(i);
                 out.print(" = _el_variablemapper.setVariable(");
@@ -3801,7 +3802,7 @@
 
         /**
          * Constructor.
-         * 
+         *
          * @param n
          *            The custom tag whose tag handler class is to be
          *            introspected

Added: tomcat/trunk/java/org/apache/jasper/runtime/InstanceManagerFactory.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/InstanceManagerFactory.java?rev=605000&view=auto
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/InstanceManagerFactory.java 
(added)
+++ tomcat/trunk/java/org/apache/jasper/runtime/InstanceManagerFactory.java Mon 
Dec 17 12:55:56 2007
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.jasper.runtime;
+
+import javax.servlet.ServletConfig;
+
+import org.apache.InstanceManager;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class InstanceManagerFactory {
+
+    private InstanceManagerFactory() {
+    }
+
+    public static InstanceManager getInstanceManager(ServletConfig config) {
+        InstanceManager instanceManager = 
+               (InstanceManager) 
config.getServletContext().getAttribute(InstanceManager.class.getName());
+        if (instanceManager == null) {
+            throw new IllegalStateException("No org.apache.InstanceManager set 
in ServletContext");
+        }
+        return instanceManager;
+    }
+
+}

Propchange: 
tomcat/trunk/java/org/apache/jasper/runtime/InstanceManagerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tomcat/trunk/java/org/apache/jasper/runtime/TagHandlerPool.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/TagHandlerPool.java?rev=605000&r1=604999&r2=605000&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/TagHandlerPool.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/TagHandlerPool.java Mon Dec 17 
12:55:56 2007
@@ -21,7 +21,7 @@
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.Tag;
 
-import org.apache.AnnotationProcessor;
+import org.apache.InstanceManager;
 import org.apache.jasper.Constants;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -42,7 +42,7 @@
     
     // index of next available tag handler
     private int current;
-    protected AnnotationProcessor annotationProcessor = null;
+    protected InstanceManager instanceManager = null;
 
     public static TagHandlerPool getTagHandlerPool( ServletConfig config) {
         TagHandlerPool result=null;
@@ -78,8 +78,7 @@
         }
         this.handlers = new Tag[maxSize];
         this.current = -1;
-        this.annotationProcessor = 
-            (AnnotationProcessor) 
config.getServletContext().getAttribute(AnnotationProcessor.class.getName());
+        instanceManager = InstanceManagerFactory.getInstanceManager(config);
     }
 
     /**
@@ -112,7 +111,7 @@
      * @throws JspException if a tag handler cannot be instantiated
      */
     public Tag get(Class handlerClass) throws JspException {
-       Tag handler = null;
+       Tag handler;
         synchronized( this ) {
             if (current >= 0) {
                 handler = handlers[current--];
@@ -123,9 +122,13 @@
         // Out of sync block - there is no need for other threads to
         // wait for us to construct a tag for this thread.
         try {
-            Tag instance = (Tag) handlerClass.newInstance();
-            AnnotationHelper.postConstruct(annotationProcessor, instance);
-            return instance;
+               if (Constants.USE_INSTANCE_MANAGER_FOR_TAGS) {
+                       return (Tag) 
instanceManager.newInstance(handlerClass.getName(), 
handlerClass.getClassLoader());
+               } else {
+                Tag instance = (Tag) handlerClass.newInstance();
+                instanceManager.newInstance(instance);
+                return instance;
+               }
         } catch (Exception e) {
             throw new JspException(e.getMessage(), e);
         }
@@ -147,13 +150,11 @@
         }
         // There is no need for other threads to wait for us to release
         handler.release();
-        if (annotationProcessor != null) {
-            try {
-                AnnotationHelper.preDestroy(annotationProcessor, handler);
-            } catch (Exception e) {
-                log.warn("Error processing preDestroy on tag instance of " 
-                        + handler.getClass().getName(), e);
-            }
+        try {
+            instanceManager.destroyInstance(handler);
+        } catch (Exception e) {
+            log.warn("Error processing preDestroy on tag instance of "
+                    + handler.getClass().getName(), e);
         }
     }
 
@@ -164,13 +165,11 @@
     public synchronized void release() {
         for (int i = current; i >= 0; i--) {
             handlers[i].release();
-            if (annotationProcessor != null) {
-                try {
-                    AnnotationHelper.preDestroy(annotationProcessor, 
handlers[i]);
-                } catch (Exception e) {
-                    log.warn("Error processing preDestroy on tag instance of " 
-                            + handlers[i].getClass().getName(), e);
-                }
+            try {
+                instanceManager.destroyInstance(handlers[i]);
+            } catch (Exception e) {
+                log.warn("Error processing preDestroy on tag instance of "
+                        + handlers[i].getClass().getName(), e);
             }
         }
     }

Modified: tomcat/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java?rev=605000&r1=604999&r2=605000&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java 
(original)
+++ tomcat/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java Mon Dec 
17 12:55:56 2007
@@ -31,7 +31,7 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.jsp.tagext.TagInfo;
 
-import org.apache.AnnotationProcessor;
+import org.apache.InstanceManager;
 import org.apache.jasper.JasperException;
 import org.apache.jasper.JspCompilationContext;
 import org.apache.jasper.Options;
@@ -39,6 +39,7 @@
 import org.apache.jasper.compiler.JavacErrorDetail;
 import org.apache.jasper.compiler.JspRuntimeContext;
 import org.apache.jasper.compiler.Localizer;
+import org.apache.jasper.runtime.InstanceManagerFactory;
 import org.apache.jasper.runtime.JspSourceDependent;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -68,7 +69,6 @@
 
     private Servlet theServlet;
     private String jspUri;
-    private Class servletClass;
     private Class tagHandlerClass;
     private JspCompilationContext ctxt;
     private long available = 0L;
@@ -139,15 +139,10 @@
                     destroy();
                     
                     Servlet servlet = null;
-                    
+
                     try {
-                        servletClass = ctxt.load();
-                        servlet = (Servlet) servletClass.newInstance();
-                        AnnotationProcessor annotationProcessor = 
(AnnotationProcessor) 
config.getServletContext().getAttribute(AnnotationProcessor.class.getName());
-                        if (annotationProcessor != null) {
-                           annotationProcessor.processAnnotations(servlet);
-                           annotationProcessor.postConstruct(servlet);
-                        }
+                        InstanceManager instanceManager = 
InstanceManagerFactory.getInstanceManager(config);
+                        servlet = (Servlet) 
instanceManager.newInstance(ctxt.getFQCN(), ctxt.getJspLoader());
                     } catch (IllegalAccessException e) {
                         throw new JasperException(e);
                     } catch (InstantiationException e) {
@@ -423,15 +418,13 @@
     public void destroy() {
         if (theServlet != null) {
             theServlet.destroy();
-            AnnotationProcessor annotationProcessor = (AnnotationProcessor) 
config.getServletContext().getAttribute(AnnotationProcessor.class.getName());
-            if (annotationProcessor != null) {
-                try {
-                    annotationProcessor.preDestroy(theServlet);
-                } catch (Exception e) {
-                    // Log any exception, since it can't be passed along
-                    log.error(Localizer.getMessage("jsp.error.file.not.found",
-                           e.getMessage()), e);
-                }
+            InstanceManager instanceManager = 
InstanceManagerFactory.getInstanceManager(config);
+            try {
+                instanceManager.destroyInstance(theServlet);
+            } catch (Exception e) {
+                // Log any exception, since it can't be passed along
+                log.error(Localizer.getMessage("jsp.error.file.not.found",
+                        e.getMessage()), e);
             }
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to