Java 类org.apache.catalina.security.SecurityClassLoad 实例源码

项目:tomcat7    文件:Bootstrap.java   
/**
 * Initialize daemon.
 */
public void init()
    throws Exception
{

    // Set Catalina path
    setCatalinaHome();
    setCatalinaBase();

    initClassLoaders();

    //将catalinaLoader设置为Tomcat主线程的线程上下文类加载器
    Thread.currentThread().setContextClassLoader(catalinaLoader);

    //通过catalinaLoader加载tomcat独有的class
    SecurityClassLoad.securityClassLoad(catalinaLoader);

    // Load our startup class and call its process() method
    if (log.isDebugEnabled())
        log.debug("Loading startup class");
    Class<?> startupClass =
        catalinaLoader.loadClass
        ("org.apache.catalina.startup.Catalina");
    Object startupInstance = startupClass.newInstance();

    // Set the shared extensions class loader
    if (log.isDebugEnabled())
        log.debug("Setting startup class properties");
    String methodName = "setParentClassLoader";
    Class<?> paramTypes[] = new Class[1];
    paramTypes[0] = Class.forName("java.lang.ClassLoader");
    Object paramValues[] = new Object[1];
    paramValues[0] = sharedLoader;
    Method method =
        startupInstance.getClass().getMethod(methodName, paramTypes);
    method.invoke(startupInstance, paramValues);

    catalinaDaemon = startupInstance;  //Catalina#setParentClassLoader 设置父类加载器为sharedLoader

}
项目:lams    文件:Bootstrap.java   
/**
 * Initialize daemon.
 */
public void init()
    throws Exception
{

    // Set Catalina path
    setCatalinaHome();
    setCatalinaBase();

    initClassLoaders();

    Thread.currentThread().setContextClassLoader(catalinaLoader);

    SecurityClassLoad.securityClassLoad(catalinaLoader);

    // Load our startup class and call its process() method
    if (log.isDebugEnabled())
        log.debug("Loading startup class");
    Class startupClass =
        catalinaLoader.loadClass
        ("org.apache.catalina.startup.Catalina");
    Object startupInstance = startupClass.newInstance();

    // Set the shared extensions class loader
    if (log.isDebugEnabled())
        log.debug("Setting startup class properties");
    String methodName = "setParentClassLoader";
    Class paramTypes[] = new Class[1];
    paramTypes[0] = Class.forName("java.lang.ClassLoader");
    Object paramValues[] = new Object[1];
    paramValues[0] = sharedLoader;
    Method method =
        startupInstance.getClass().getMethod(methodName, paramTypes);
    method.invoke(startupInstance, paramValues);

    catalinaDaemon = startupInstance;

}
项目:apache-tomcat-7.0.73-with-comment    文件:Bootstrap.java   
/**
 * Initialize daemon.
 */
public void init()
    throws Exception
{
    // Set Catalina path
 String userDir = System.getProperty("user.dir");
 //检查设置的启动项:catalina.home参数 例如我的-Dcatalina.home="/Users/sunms/workspace/sourcecode/apache-tomcat-7.0.73-src/lunch"
    setCatalinaHome();
    //catalina.base
    setCatalinaBase();

    //根据catalina.properties中对应的配置信心生成classloader
    initClassLoaders();

    Thread.currentThread().setContextClassLoader(catalinaLoader);

    SecurityClassLoad.securityClassLoad(catalinaLoader);

    // Load our startup class and call its process() method
    if (log.isDebugEnabled())
        log.debug("Loading startup class");
    Class<?> startupClass = catalinaLoader.loadClass("org.apache.catalina.startup.Catalina");
    Object startupInstance = startupClass.newInstance();

    // Set the shared extensions class loader
    if (log.isDebugEnabled())
        log.debug("Setting startup class properties");
    String methodName = "setParentClassLoader";
    Class<?> paramTypes[] = new Class[1];
    paramTypes[0] = Class.forName("java.lang.ClassLoader");
    Object paramValues[] = new Object[1];
    paramValues[0] = sharedLoader;
    Method method =
        startupInstance.getClass().getMethod(methodName, paramTypes);
    method.invoke(startupInstance, paramValues);

    catalinaDaemon = startupInstance;

}
项目:lazycat    文件:Bootstrap.java   
/**
 * Initialize daemon.
 */
public void init() throws Exception {

    // Set Catalina path
    setCatalinaHome();
    setCatalinaBase();

    initClassLoaders();

    Thread.currentThread().setContextClassLoader(catalinaLoader);

    SecurityClassLoad.securityClassLoad(catalinaLoader);

    // Load our startup class and call its process() method
    if (log.isDebugEnabled())
        log.debug("Loading startup class");
    Class<?> startupClass = catalinaLoader.loadClass("org.apache.catalina.startup.Catalina");
    Object startupInstance = startupClass.newInstance();

    // Set the shared extensions class loader
    if (log.isDebugEnabled())
        log.debug("Setting startup class properties");
    String methodName = "setParentClassLoader";
    Class<?> paramTypes[] = new Class[1];
    paramTypes[0] = Class.forName("java.lang.ClassLoader");
    Object paramValues[] = new Object[1];
    paramValues[0] = sharedLoader;
    Method method = startupInstance.getClass().getMethod(methodName, paramTypes);
    method.invoke(startupInstance, paramValues);

    catalinaDaemon = startupInstance;

}
项目:class-guard    文件:Bootstrap.java   
/**
 * Initialize daemon.
 */
public void init()
    throws Exception
{

    // Set Catalina path
    setCatalinaHome();
    setCatalinaBase();

    initClassLoaders();

    Thread.currentThread().setContextClassLoader(catalinaLoader);

    SecurityClassLoad.securityClassLoad(catalinaLoader);

    // Load our startup class and call its process() method
    if (log.isDebugEnabled())
        log.debug("Loading startup class");
    Class<?> startupClass =
        catalinaLoader.loadClass
        ("org.apache.catalina.startup.Catalina");
    Object startupInstance = startupClass.newInstance();

    // Set the shared extensions class loader
    if (log.isDebugEnabled())
        log.debug("Setting startup class properties");
    String methodName = "setParentClassLoader";
    Class<?> paramTypes[] = new Class[1];
    paramTypes[0] = Class.forName("java.lang.ClassLoader");
    Object paramValues[] = new Object[1];
    paramValues[0] = sharedLoader;
    Method method =
        startupInstance.getClass().getMethod(methodName, paramTypes);
    method.invoke(startupInstance, paramValues);

    catalinaDaemon = startupInstance;

}
项目:WBSAirback    文件:Bootstrap.java   
/**
 * Initialize daemon.
 */
public void init()
    throws Exception
{

    // Set Catalina path
    setCatalinaHome();
    setCatalinaBase();

    initClassLoaders();

    Thread.currentThread().setContextClassLoader(catalinaLoader);

    SecurityClassLoad.securityClassLoad(catalinaLoader);

    // Load our startup class and call its process() method
    if (log.isDebugEnabled())
        log.debug("Loading startup class");
    Class<?> startupClass =
        catalinaLoader.loadClass
        ("org.apache.catalina.startup.Catalina");
    Object startupInstance = startupClass.newInstance();

    // Set the shared extensions class loader
    if (log.isDebugEnabled())
        log.debug("Setting startup class properties");
    String methodName = "setParentClassLoader";
    Class<?> paramTypes[] = new Class[1];
    paramTypes[0] = Class.forName("java.lang.ClassLoader");
    Object paramValues[] = new Object[1];
    paramValues[0] = sharedLoader;
    Method method =
        startupInstance.getClass().getMethod(methodName, paramTypes);
    method.invoke(startupInstance, paramValues);

    catalinaDaemon = startupInstance;

}
项目:apache-tomcat-7.0.57    文件:Bootstrap.java   
/**
 * Initialize daemon.
 */
public void init()
    throws Exception
{

    // Set Catalina path
    //设置Catalina.home目录 默认为当前工作路径 即user.dir
    setCatalinaHome();
    setCatalinaBase();//如果Catalina.home不为空 则值为Catalina.home
    //初始化类加载器classLoader
    //读取Catalina.home/conf下的Catalina.properties文件 if not exist 
    //则使用Catalina.home/bin下的Bootstrap.jar里的/org/apache/catalina/startup/catalina.properties
    //读取Catalina.properties关于classLoader的加载信息 配置来初始化classLoader 
    //如果没有配置,则默认使用当前的类加载器 分别初始化common.loader shared.loader server.loader
    //common.loader为shared.loader/server.loader的父加载器
    initClassLoaders();
    //将CatalinaLoader加载器放到当前线程中
    Thread.currentThread().setContextClassLoader(catalinaLoader);
    //预加载tomcat核心类
    SecurityClassLoad.securityClassLoad(catalinaLoader);

    // Load our startup class and call its process() method
    if (log.isDebugEnabled())
        log.debug("Loading startup class");
    //通过反射实例化Catalina实例对象
    Class<?> startupClass =
        catalinaLoader.loadClass
        ("org.apache.catalina.startup.Catalina");
    Object startupInstance = startupClass.newInstance();

    // Set the shared extensions class loader
    if (log.isDebugEnabled())
        log.debug("Setting startup class properties");
    String methodName = "setParentClassLoader";
    Class<?> paramTypes[] = new Class[1];
    paramTypes[0] = Class.forName("java.lang.ClassLoader");
    Object paramValues[] = new Object[1];
    paramValues[0] = sharedLoader;
    Method method =
        startupInstance.getClass().getMethod(methodName, paramTypes);
    method.invoke(startupInstance, paramValues);

    catalinaDaemon = startupInstance;

}
项目:apache-tomcat-7.0.57    文件:Bootstrap.java   
/**
 * Initialize daemon.
 */
public void init()
    throws Exception
{

    // Set Catalina path
    //设置Catalina.home目录 默认为当前工作路径 即user.dir
    setCatalinaHome();
    setCatalinaBase();//如果Catalina.home不为空 则值为Catalina.home
    //初始化类加载器classLoader
    //读取Catalina.home/conf下的Catalina.properties文件 if not exist 
    //则使用Catalina.home/bin下的Bootstrap.jar里的/org/apache/catalina/startup/catalina.properties
    //读取Catalina.properties关于classLoader的加载信息 配置来初始化classLoader 
    //如果没有配置,则默认使用当前的类加载器 分别初始化common.loader shared.loader server.loader
    //common.loader为shared.loader/server.loader的父加载器
    initClassLoaders();
    //将CatalinaLoader加载器放到当前线程中
    Thread.currentThread().setContextClassLoader(catalinaLoader);
    //预加载tomcat核心类
    SecurityClassLoad.securityClassLoad(catalinaLoader);

    // Load our startup class and call its process() method
    if (log.isDebugEnabled())
        log.debug("Loading startup class");
    //通过反射实例化Catalina实例对象
    Class<?> startupClass =
        catalinaLoader.loadClass
        ("org.apache.catalina.startup.Catalina");
    Object startupInstance = startupClass.newInstance();

    // Set the shared extensions class loader
    if (log.isDebugEnabled())
        log.debug("Setting startup class properties");
    String methodName = "setParentClassLoader";
    Class<?> paramTypes[] = new Class[1];
    paramTypes[0] = Class.forName("java.lang.ClassLoader");
    Object paramValues[] = new Object[1];
    paramValues[0] = sharedLoader;
    Method method =
        startupInstance.getClass().getMethod(methodName, paramTypes);
    method.invoke(startupInstance, paramValues);

    catalinaDaemon = startupInstance;

}
项目:tomcat-sr    文件:Bootstrap.java   
/**
 * Initialize daemon.
 * 初始化"Catalina服务的守护进程"实例。
 */
public void init()
    throws Exception
{

    // 1. Set Catalina path (设置Catalina服务路径)
    setCatalinaHome();
    setCatalinaBase();

    // 2. 初始化类加载器
    initClassLoaders();

    // 3. 设置当前线程的上下文类加载器("Catalina服务类加载器")
    Thread.currentThread().setContextClassLoader(catalinaLoader);

    SecurityClassLoad.securityClassLoad(catalinaLoader);

    // 4. Load our startup class and call its process() method (加载启动类Catalina,并调用process()方法)
    if (log.isDebugEnabled())
        log.debug("Loading startup class");
    Class<?> startupClass =
        catalinaLoader.loadClass
        ("org.apache.catalina.startup.Catalina");
    // 启动实例
    Object startupInstance = startupClass.newInstance();

    // 5. Set the shared extensions class loader (设置共享的扩展类加载器)
    if (log.isDebugEnabled())
        log.debug("Setting startup class properties");
    String methodName = "setParentClassLoader";
    Class<?> paramTypes[] = new Class[1];
    paramTypes[0] = Class.forName("java.lang.ClassLoader");
    Object paramValues[] = new Object[1];
    paramValues[0] = sharedLoader;
    Method method =
        startupInstance.getClass().getMethod(methodName, paramTypes);
    method.invoke(startupInstance, paramValues);

    // 5. 设置"Catalina服务的守护进程"
    catalinaDaemon = startupInstance;

}