--- org/apache/jasper/compiler/Generator.java (revision 504505) +++ org/apache/jasper/compiler/Generator.java (working copy) @@ -402,7 +402,7 @@ } out.printin(VAR_EXPRESSIONFACTORY); - out.print(" = JspFactory.getDefaultFactory().getJspApplicationContext("); + out.print(" = _jspxFactory.getJspApplicationContext("); if (ctxt.isTagFile()) { out.print("config"); } else { @@ -477,6 +477,9 @@ * preamble generation) */ private void genPreambleStaticInitializers() throws JasperException { + out.printil("private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();"); + out.println(); + // Static data for getDependants() out.printil("private static java.util.List _jspx_dependants;"); out.println(); @@ -594,7 +597,6 @@ out.println(); // Local variable declarations - out.printil("JspFactory _jspxFactory = null;"); out.printil("PageContext pageContext = null;"); if (pageInfo.isSession()) @@ -624,8 +626,6 @@ out.printil("try {"); out.pushIndent(); - out.printil("_jspxFactory = JspFactory.getDefaultFactory();"); - out.printin("response.setContentType("); out.print(quote(pageInfo.getContentType())); out.println(");"); @@ -3307,7 +3307,7 @@ out.pushIndent(); out - .printil("if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);"); + .printil("_jspxFactory.releasePageContext(_jspx_page_context);"); out.popIndent(); out.printil("}"); --- org/apache/jasper/compiler/JspRuntimeContext.java (revision 504505) +++ org/apache/jasper/compiler/JspRuntimeContext.java (working copy) @@ -72,6 +72,28 @@ 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) { + org.apache.juli.logging.LogFactory.getLog( HttpJspBase.class ) + .error("Jasper JspRuntimeContext preload of class failed: " + + ex.getMessage(), ex); + } + } + JspFactory.setDefaultFactory(factory); } --- org/apache/jasper/runtime/HttpJspBase.java (revision 504505) +++ org/apache/jasper/runtime/HttpJspBase.java (working copy) @@ -41,34 +41,6 @@ { - static { - if( JspFactory.getDefaultFactory() == null ) { - JspFactoryImpl factory = new JspFactoryImpl(); - 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) { - org.apache.juli.logging.LogFactory.getLog( HttpJspBase.class ) - .error("Jasper JspRuntimeContext preload of class failed: " + - ex.getMessage(), ex); - } - } - JspFactory.setDefaultFactory(factory); - } - } - protected HttpJspBase() { }