001: /*
002: * Copyright 1999,2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.apache.jasper.security;
018:
019: /**
020: * Static class used to preload java classes when using the
021: * Java SecurityManager so that the defineClassInPackage
022: * RuntimePermission does not trigger an AccessControlException.
023: *
024: * @author Jean-Francois Arcand
025: */
026:
027: public final class SecurityClassLoad {
028:
029: private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory
030: .getLog(SecurityClassLoad.class);
031:
032: public static void securityClassLoad(ClassLoader loader) {
033:
034: if (System.getSecurityManager() == null) {
035: return;
036: }
037:
038: String basePackage = "org.apache.jasper.";
039: try {
040: loader
041: .loadClass(basePackage
042: + "runtime.JspFactoryImpl$PrivilegedGetPageContext");
043: loader
044: .loadClass(basePackage
045: + "runtime.JspFactoryImpl$PrivilegedReleasePageContext");
046:
047: loader.loadClass(basePackage + "runtime.JspRuntimeLibrary");
048: loader
049: .loadClass(basePackage
050: + "runtime.JspRuntimeLibrary$PrivilegedIntrospectHelper");
051:
052: loader.loadClass(basePackage
053: + "runtime.ServletResponseWrapperInclude");
054: loader.loadClass(basePackage + "runtime.TagHandlerPool");
055: loader.loadClass(basePackage + "runtime.JspFragmentHelper");
056:
057: loader.loadClass(basePackage
058: + "runtime.ProtectedFunctionMapper");
059: loader.loadClass(basePackage
060: + "runtime.ProtectedFunctionMapper$1");
061: loader.loadClass(basePackage
062: + "runtime.ProtectedFunctionMapper$2");
063: loader.loadClass(basePackage
064: + "runtime.ProtectedFunctionMapper$3");
065: loader.loadClass(basePackage
066: + "runtime.ProtectedFunctionMapper$4");
067:
068: loader.loadClass(basePackage + "runtime.PageContextImpl");
069: loader.loadClass(basePackage + "runtime.PageContextImpl$1");
070: loader.loadClass(basePackage + "runtime.PageContextImpl$2");
071: loader.loadClass(basePackage + "runtime.PageContextImpl$3");
072: loader.loadClass(basePackage + "runtime.PageContextImpl$4");
073: loader.loadClass(basePackage + "runtime.PageContextImpl$5");
074: loader.loadClass(basePackage + "runtime.PageContextImpl$6");
075: loader.loadClass(basePackage + "runtime.PageContextImpl$7");
076: loader.loadClass(basePackage + "runtime.PageContextImpl$8");
077: loader.loadClass(basePackage + "runtime.PageContextImpl$9");
078: loader
079: .loadClass(basePackage
080: + "runtime.PageContextImpl$10");
081: loader
082: .loadClass(basePackage
083: + "runtime.PageContextImpl$11");
084: loader
085: .loadClass(basePackage
086: + "runtime.PageContextImpl$12");
087: loader
088: .loadClass(basePackage
089: + "runtime.PageContextImpl$13");
090:
091: loader.loadClass(basePackage + "runtime.JspContextWrapper");
092:
093: loader.loadClass(basePackage + "servlet.JspServletWrapper");
094:
095: loader.loadClass(basePackage + "runtime.JspWriterImpl$1");
096: } catch (ClassNotFoundException ex) {
097: System.out
098: .println("Jasper SecurityClassLoad preload of class failed: "
099: + ex.getMessage());
100: log.error("SecurityClassLoad", ex);
101: }
102: }
103: }
|