KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jasper > security > SecurityClassLoad


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18
19 package org.apache.jasper.security;
20
21 /**
22  * Static class used to preload java classes when using the
23  * Java SecurityManager so that the defineClassInPackage
24  * RuntimePermission does not trigger an AccessControlException.
25  *
26  * @author Jean-Francois Arcand
27  */

28
29 public final class SecurityClassLoad {
30
31     private static org.apache.commons.logging.Log log=
32         org.apache.commons.logging.LogFactory.getLog( SecurityClassLoad.class );
33
34     public static void securityClassLoad(ClassLoader JavaDoc loader){
35
36         if( System.getSecurityManager() == null ){
37             return;
38         }
39
40         String JavaDoc basePackage = "org.apache.jasper.";
41         try {
42             loader.loadClass( basePackage +
43                 "runtime.JspFactoryImpl$PrivilegedGetPageContext");
44             loader.loadClass( basePackage +
45                 "runtime.JspFactoryImpl$PrivilegedReleasePageContext");
46
47             loader.loadClass( basePackage +
48                 "runtime.JspRuntimeLibrary");
49             loader.loadClass( basePackage +
50                 "runtime.JspRuntimeLibrary$PrivilegedIntrospectHelper");
51             
52             loader.loadClass( basePackage +
53                 "runtime.ServletResponseWrapperInclude");
54             loader.loadClass( basePackage +
55                 "runtime.TagHandlerPool");
56             loader.loadClass( basePackage +
57                 "runtime.JspFragmentHelper");
58
59             loader.loadClass( basePackage +
60                 "runtime.ProtectedFunctionMapper");
61             loader.loadClass( basePackage +
62                 "runtime.ProtectedFunctionMapper$1");
63             loader.loadClass( basePackage +
64                 "runtime.ProtectedFunctionMapper$2");
65             loader.loadClass( basePackage +
66                 "runtime.ProtectedFunctionMapper$3");
67             loader.loadClass( basePackage +
68                 "runtime.ProtectedFunctionMapper$4");
69
70             loader.loadClass( basePackage +
71                 "runtime.PageContextImpl");
72             loader.loadClass( basePackage +
73                 "runtime.PageContextImpl$1");
74             loader.loadClass( basePackage +
75                 "runtime.PageContextImpl$2");
76             loader.loadClass( basePackage +
77                 "runtime.PageContextImpl$3");
78             loader.loadClass( basePackage +
79                 "runtime.PageContextImpl$4");
80             loader.loadClass( basePackage +
81                 "runtime.PageContextImpl$5");
82             loader.loadClass( basePackage +
83                 "runtime.PageContextImpl$6");
84             loader.loadClass( basePackage +
85                 "runtime.PageContextImpl$7");
86             loader.loadClass( basePackage +
87                 "runtime.PageContextImpl$8");
88             loader.loadClass( basePackage +
89                 "runtime.PageContextImpl$9");
90             loader.loadClass( basePackage +
91                 "runtime.PageContextImpl$10");
92             loader.loadClass( basePackage +
93                 "runtime.PageContextImpl$11");
94             loader.loadClass( basePackage +
95                 "runtime.PageContextImpl$12");
96             loader.loadClass( basePackage +
97                 "runtime.PageContextImpl$13");
98
99             loader.loadClass( basePackage +
100                 "runtime.JspContextWrapper");
101
102             loader.loadClass( basePackage +
103                 "servlet.JspServletWrapper");
104
105             loader.loadClass( basePackage +
106                 "runtime.JspWriterImpl$1");
107         } catch (ClassNotFoundException JavaDoc ex) {
108             log.error("SecurityClassLoad", ex);
109         }
110     }
111 }
112
Popular Tags