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