org.apache.catalina.security.SecurityClassLoad Java Examples
The following examples show how to use
org.apache.catalina.security.SecurityClassLoad.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Bootstrap.java From Tomcat8-Source-Read with MIT License | 5 votes |
/** * Initialize daemon. * @throws Exception Fatal initialization error * * 1. 初始化类加载器。 * 2. 实例化Catalina对象。 daemon的设置。 * 3. Catalina去init Server对象。 */ public void init() throws Exception { //初始化类加载器。 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"); //反射去加载Catalina类并进行实例化。 Class<?> startupClass = catalinaLoader.loadClass("org.apache.catalina.startup.Catalina"); Object startupInstance = startupClass.getConstructor().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; /** * 反射执行对应setParentClassLoader方法。 * 详见{@link Catalina#setParentClassLoader(ClassLoader)} * (打断点观测下获取的方法的名称和参数 以及真正执行的方法) */ Method method = startupInstance.getClass().getMethod(methodName, paramTypes); method.invoke(startupInstance, paramValues); //将Catalina设置会守护进程。 catalinaDaemon = startupInstance; }
Example #2
Source File: Bootstrap.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
/** * 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; }
Example #3
Source File: Bootstrap.java From tomcatsrc with Apache License 2.0 | 4 votes |
/** * Initialize daemon. */ public void init() throws Exception { // Set Catalina path setCatalinaHome(); setCatalinaBase(); // 初始化 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"); //加载 org.apache.catalina.startup.Catalina class Class<?> startupClass = catalinaLoader.loadClass ("org.apache.catalina.startup.Catalina"); // 实例化 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); // Catalina 实例赋给了 catalinaDaemon 对象 catalinaDaemon = startupInstance; }