Tomcat知识连载---源码分析SecurityClassLoad

tianlinyi 2003-09-21 10:38:00
package org.apache.catalina.startup;

/**
* Static class used to preload java classes when using the
* Java SecurityManager so that the defineClassInPackage
* RuntimePermission does not trigger an AccessControlException.
*
* @author Glenn L. Nielsen
* @version $Revision: 1.1 $ $Date: 2001/12/30 01:58:20 $
*/

/**
* 该类只有一个静态方法,其作用仅仅相当于一个函数
* 该静态方法负责载入一些指定的类
* package org.apache.catalina.core
* package org.apache.catalina.connector
* package org.apache.catalina.loader
* package org.apache.catalina.session
* package org.apache.catalina.util
* 这些包都在$CATALINA_HOME/server/catalina.jar文件中
* (由此看来,该静态方法的合法参数仅为catalinaLoader?)
*/

public final class SecurityClassLoad {
static void securityClassLoad(ClassLoader loader)
throws Exception {
if( System.getSecurityManager() == null )
return;
String basePackage = "org.apache.catalina.";
loader.loadClass
(basePackage +
"core.ApplicationContext$PrivilegedGetRequestDispatcher");
loader.loadClass
(basePackage +
"core.ApplicationContext$PrivilegedGetResource");
loader.loadClass
(basePackage +
"core.ApplicationContext$PrivilegedGetResourcePaths");
loader.loadClass
(basePackage +
"core.ApplicationContext$PrivilegedLogMessage");
loader.loadClass
(basePackage +
"core.ApplicationContext$PrivilegedLogException");
loader.loadClass
(basePackage +
"core.ApplicationContext$PrivilegedLogThrowable");
loader.loadClass
(basePackage +
"core.ApplicationDispatcher$PrivilegedForward");
loader.loadClass
(basePackage +
"core.ApplicationDispatcher$PrivilegedInclude");
loader.loadClass
(basePackage +
"core.ContainerBase$PrivilegedAddChild");
loader.loadClass
(basePackage +
"connector.HttpRequestBase$PrivilegedGetSession");
loader.loadClass
(basePackage +
"connector.HttpResponseBase$PrivilegedFlushBuffer");
loader.loadClass
(basePackage +
"loader.WebappClassLoader$PrivilegedFindResource");
loader.loadClass
(basePackage + "session.StandardSession");
loader.loadClass
(basePackage + "util.CookieTools");
loader.loadClass
(basePackage + "util.URL");
loader.loadClass(basePackage + "util.Enumerator");
loader.loadClass("javax.servlet.http.Cookie");
}
}
...全文
56 点赞 收藏 回复
写回复
回复

还没有回复,快来抢沙发~

发动态
发帖子
非技术区
创建于2007-09-28

1755

社区成员

3.7w+

社区内容

Web 开发 非技术区
社区公告
暂无公告