tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject svn commit: r1542822 - in /tomcat/trunk: conf/ java/org/apache/catalina/core/ java/org/apache/jasper/ java/org/apache/jasper/compiler/ java/org/apache/jasper/servlet/ webapps/docs/config/
Date Sun, 17 Nov 2013 21:13:37 GMT
Author: jboynes
Date: Sun Nov 17 21:13:36 2013
New Revision: 1542822

URL: http://svn.apache.org/r1542822
Log:
Initialize the JSP runtime in Jasper's initializer to eliminate the need for a Jasper-specific
listener in the container.

Removed:
    tomcat/trunk/java/org/apache/catalina/core/JasperListener.java
Modified:
    tomcat/trunk/conf/server.xml
    tomcat/trunk/java/org/apache/jasper/JspC.java
    tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java
    tomcat/trunk/java/org/apache/jasper/servlet/JasperInitializer.java
    tomcat/trunk/webapps/docs/config/listeners.xml

Modified: tomcat/trunk/conf/server.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/conf/server.xml?rev=1542822&r1=1542821&r2=1542822&view=diff
==============================================================================
--- tomcat/trunk/conf/server.xml (original)
+++ tomcat/trunk/conf/server.xml Sun Nov 17 21:13:36 2013
@@ -25,8 +25,6 @@
   -->
   <!--APR library loader. Documentation at /docs/apr.html -->
   <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
-  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html
-->
-  <Listener className="org.apache.catalina.core.JasperListener" />
   <!-- Prevent memory leaks due to use of particular java/javax APIs-->
   <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
   <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

Modified: tomcat/trunk/java/org/apache/jasper/JspC.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/JspC.java?rev=1542822&r1=1542821&r2=1542822&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/JspC.java (original)
+++ tomcat/trunk/java/org/apache/jasper/JspC.java Sun Nov 17 21:13:36 2013
@@ -42,6 +42,7 @@ import java.util.Stack;
 import java.util.StringTokenizer;
 import java.util.Vector;
 
+import javax.servlet.jsp.JspFactory;
 import javax.servlet.jsp.tagext.TagLibraryInfo;
 
 import org.apache.jasper.compiler.Compiler;
@@ -50,6 +51,7 @@ import org.apache.jasper.compiler.JspRun
 import org.apache.jasper.compiler.Localizer;
 import org.apache.jasper.compiler.TagPluginManager;
 import org.apache.jasper.compiler.TldCache;
+import org.apache.jasper.runtime.JspFactoryImpl;
 import org.apache.jasper.servlet.JspCServletContext;
 import org.apache.jasper.servlet.TldScanner;
 import org.apache.juli.logging.Log;
@@ -94,6 +96,11 @@ import org.xml.sax.SAXException;
  */
 public class JspC extends Task implements Options {
 
+    static {
+        // the Validator uses this to access the EL ExpressionFactory
+        JspFactory.setDefaultFactory(new JspFactoryImpl());
+    }
+
     public static final String DEFAULT_IE_CLASS_ID =
             "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93";
 

Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java?rev=1542822&r1=1542821&r2=1542822&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java Sun Nov 17 21:13:36
2013
@@ -32,13 +32,10 @@ import java.util.concurrent.ConcurrentHa
 import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.servlet.ServletContext;
-import javax.servlet.jsp.JspFactory;
 
 import org.apache.jasper.Constants;
 import org.apache.jasper.JspCompilationContext;
 import org.apache.jasper.Options;
-import org.apache.jasper.runtime.JspFactoryImpl;
-import org.apache.jasper.security.SecurityClassLoad;
 import org.apache.jasper.servlet.JspServletWrapper;
 import org.apache.jasper.util.ExceptionUtils;
 import org.apache.jasper.util.FastRemovalDequeue;
@@ -74,36 +71,6 @@ public final class JspRuntimeContext {
      */
     private final AtomicInteger jspUnloadCount = new AtomicInteger(0);
 
-    /**
-     * Preload classes required at runtime by a JSP servlet so that
-     * we don't get a defineClassInPackage security exception.
-     */
-    static {
-        JspFactoryImpl factory = new JspFactoryImpl();
-        SecurityClassLoad.securityClassLoad(factory.getClass().getClassLoader());
-        if( System.getSecurityManager() != null ) {
-            String basePackage = "org.apache.jasper.";
-            try {
-                factory.getClass().getClassLoader().loadClass( basePackage +
-                                                               "runtime.JspFactoryImpl$PrivilegedGetPageContext");
-                factory.getClass().getClassLoader().loadClass( basePackage +
-                                                               "runtime.JspFactoryImpl$PrivilegedReleasePageContext");
-                factory.getClass().getClassLoader().loadClass( basePackage +
-                                                               "runtime.JspRuntimeLibrary");
-                factory.getClass().getClassLoader().loadClass( basePackage +
-                                                               "runtime.JspRuntimeLibrary$PrivilegedIntrospectHelper");
-                factory.getClass().getClassLoader().loadClass( basePackage +
-                                                               "runtime.ServletResponseWrapperInclude");
-                factory.getClass().getClassLoader().loadClass( basePackage +
-                                                               "servlet.JspServletWrapper");
-            } catch (ClassNotFoundException ex) {
-                throw new IllegalStateException(ex);
-            }
-        }
-
-        JspFactory.setDefaultFactory(factory);
-    }
-
     // ----------------------------------------------------------- Constructors
 
     /**

Modified: tomcat/trunk/java/org/apache/jasper/servlet/JasperInitializer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/servlet/JasperInitializer.java?rev=1542822&r1=1542821&r2=1542822&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/servlet/JasperInitializer.java (original)
+++ tomcat/trunk/java/org/apache/jasper/servlet/JasperInitializer.java Sun Nov 17 21:13:36
2013
@@ -22,9 +22,12 @@ import java.util.Set;
 import javax.servlet.ServletContainerInitializer;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
+import javax.servlet.jsp.JspFactory;
 
 import org.apache.jasper.compiler.Localizer;
 import org.apache.jasper.compiler.TldCache;
+import org.apache.jasper.runtime.JspFactoryImpl;
+import org.apache.jasper.security.SecurityClassLoad;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.xml.sax.SAXException;
@@ -41,6 +44,37 @@ public class JasperInitializer implement
     private static final String MSG = "org.apache.jasper.servlet.JasperInitializer";
     private static final Log LOG = LogFactory.getLog(JasperInitializer.class);
 
+    /**
+     * Preload classes required at runtime by a JSP servlet so that
+     * we don't get a defineClassInPackage security exception.
+     */
+    static {
+        JspFactoryImpl factory = new JspFactoryImpl();
+        SecurityClassLoad.securityClassLoad(factory.getClass().getClassLoader());
+        if( System.getSecurityManager() != null ) {
+            String basePackage = "org.apache.jasper.";
+            try {
+                factory.getClass().getClassLoader().loadClass( basePackage +
+                        "runtime.JspFactoryImpl$PrivilegedGetPageContext");
+                factory.getClass().getClassLoader().loadClass( basePackage +
+                        "runtime.JspFactoryImpl$PrivilegedReleasePageContext");
+                factory.getClass().getClassLoader().loadClass( basePackage +
+                        "runtime.JspRuntimeLibrary");
+                factory.getClass().getClassLoader().loadClass( basePackage +
+                        "runtime.JspRuntimeLibrary$PrivilegedIntrospectHelper");
+                factory.getClass().getClassLoader().loadClass( basePackage +
+                        "runtime.ServletResponseWrapperInclude");
+                factory.getClass().getClassLoader().loadClass( basePackage +
+                        "servlet.JspServletWrapper");
+            } catch (ClassNotFoundException ex) {
+                throw new IllegalStateException(ex);
+            }
+        }
+
+        // TODO we should play nice and only set this if it's null
+        JspFactory.setDefaultFactory(factory);
+    }
+
     @Override
     public void onStartup(Set<Class<?>> types, ServletContext context) throws
ServletException {
         if (LOG.isDebugEnabled()) {

Modified: tomcat/trunk/webapps/docs/config/listeners.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/listeners.xml?rev=1542822&r1=1542821&r2=1542822&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/listeners.xml (original)
+++ tomcat/trunk/webapps/docs/config/listeners.xml Sun Nov 17 21:13:36 2013
@@ -125,21 +125,6 @@
 
   </subsection>
 
-  <subsection name="Jasper Listener - org.apache.catalina.core.JasperListener">
-
-    <p>The <strong>Jasper Listener</strong> initializes the Jasper 2 JSP
engine
-    before any web applications that may use it are loaded. For more
-    information on the Jasper 2 JSP engine see the
-    <a href="../jasper-howto.html">Jasper How To</a>.</p>
-
-    <p>This listener must only be nested within <a href="server.html">Server</a>
-    elements.</p>
-
-    <p>No additional attributes are supported by the <strong>Jasper Listener
-    </strong>.</p>
-
-  </subsection>
-
   <subsection name="Global Resources Lifecycle Listener - org.apache.catalina.mbeans.GlobalResourcesLifecycleListener">
 
     <p>The <strong>Global Resources Lifecycle Listener</strong> initializes
the



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


Mime
View raw message