You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ke...@apache.org on 2008/06/12 15:28:21 UTC
svn commit: r667078 -
/geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/ValveGBean.java
Author: kevan
Date: Thu Jun 12 06:28:21 2008
New Revision: 667078
URL: http://svn.apache.org/viewvc?rev=667078&view=rev
Log:
GERONIMO-4113 Use appropriate classloader when loading valve class
Modified:
geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/ValveGBean.java
Modified: geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/ValveGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/ValveGBean.java?rev=667078&r1=667077&r2=667078&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/ValveGBean.java (original)
+++ geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/ValveGBean.java Thu Jun 12 06:28:21 2008
@@ -16,6 +16,7 @@
*/
package org.apache.geronimo.tomcat;
+import java.lang.ClassLoader;
import java.util.Map;
import org.apache.catalina.Valve;
@@ -37,7 +38,6 @@
private final Valve valve;
private final ValveGBean nextValve;
private final String className;
-
public ValveGBean(){
valve = null;
@@ -45,7 +45,7 @@
className = null;
}
- public ValveGBean(String className, Map initParams, ValveGBean nextValve) throws Exception{
+ public ValveGBean(String className, Map initParams, ValveGBean nextValve, ClassLoader classLoader) throws Exception{
//Validate
if (className == null){
@@ -62,9 +62,9 @@
}
this.className = className;
-
+
//Create the Valve object
- valve = (Valve)Class.forName(className).newInstance();
+ valve = (Valve)classLoader.loadClass(className).newInstance();
//Set the parameters
setParameters(valve, initParams);
@@ -97,10 +97,11 @@
GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(ValveGBean.class, J2EE_TYPE);
infoFactory.addAttribute("className", String.class, true);
infoFactory.addAttribute("initParams", Map.class, true);
+ infoFactory.addAttribute("classLoader", ClassLoader.class, false);
infoFactory.addReference("NextValve", ValveGBean.class, J2EE_TYPE);
infoFactory.addOperation("getInternalObject");
infoFactory.addOperation("getNextValve");
- infoFactory.setConstructor(new String[] { "className", "initParams", "NextValve" });
+ infoFactory.setConstructor(new String[] { "className", "initParams", "NextValve", "classLoader" });
GBEAN_INFO = infoFactory.getBeanInfo();
}