tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r439330 - /tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java
Date Fri, 01 Sep 2006 14:17:58 GMT
Author: remm
Date: Fri Sep  1 07:17:58 2006
New Revision: 439330

URL: http://svn.apache.org/viewvc?rev=439330&view=rev
Log:
- Patch submitted by Bill Burke (who thinks annotations should occur for JSPs) to do JSP annotation
processing.

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java?rev=439330&r1=439329&r2=439330&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java Fri Sep  1
07:17:58 2006
@@ -37,6 +37,7 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.jsp.tagext.TagInfo;
 
+import org.apache.AnnotationProcessor;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jasper.JasperException;
@@ -146,10 +147,17 @@
                     try {
                         servletClass = ctxt.load();
                         theServlet = (Servlet) servletClass.newInstance();
-                    } catch( IllegalAccessException ex1 ) {
-                        throw new JasperException( ex1 );
-                    } catch( InstantiationException ex ) {
-                        throw new JasperException( ex );
+                        AnnotationProcessor annotationProcessor = (AnnotationProcessor) config.getServletContext().getAttribute(AnnotationProcessor.class.getName());
+                        if (annotationProcessor != null) {
+                           annotationProcessor.processAnnotations(theServlet);
+                           annotationProcessor.postConstruct(theServlet);
+                        }
+                    } catch (IllegalAccessException e) {
+                        throw new JasperException(e);
+                    } catch (InstantiationException e) {
+                        throw new JasperException(e);
+                    } catch (Exception e) {
+                        throw new JasperException(e);
                     }
                     
                     theServlet.init(config);
@@ -402,6 +410,16 @@
     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);
+                }
+            }
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message