Package org.red5.classloading
Class ClassLoaderBuilder
- java.lang.Object
-
- org.red5.classloading.ClassLoaderBuilder
-
public final class ClassLoaderBuilder extends Object
Class used to get the Servlet Class loader. The class loader returned is a child first class loader.
This class is based on original code from the XINS project, by Anthony Goubard (anthony.goubard@japplis.com)- Author:
- Paul Gregoire (mondain@gmail.com)
-
-
Field Summary
Fields Modifier and Type Field Description static intUSE_CLASSPATH_LIBLoad the Servlet code from the WAR file and use the current classpath for the libraries.static intUSE_RED5_LIBLoad the servlet code from the WAR file and try to find the libraries in the common red5 lib directory.static intUSE_WAR_LIBLoad the servlet code and the libraries from the WAR file.
-
Constructor Summary
Constructors Constructor Description ClassLoaderBuilder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ClassLoaderbuild()Default build uses Red5 common lib without a parent classloader.static ClassLoaderbuild(Path path, int mode, ClassLoader parent)Gets a class loader based on mode.
-
-
-
Field Detail
-
USE_CLASSPATH_LIB
public static final int USE_CLASSPATH_LIB
Load the Servlet code from the WAR file and use the current classpath for the libraries.- See Also:
- Constant Field Values
-
USE_RED5_LIB
public static final int USE_RED5_LIB
Load the servlet code from the WAR file and try to find the libraries in the common red5 lib directory.- See Also:
- Constant Field Values
-
USE_WAR_LIB
public static final int USE_WAR_LIB
Load the servlet code and the libraries from the WAR file. This may take some time as the libraries need to be extracted from the WAR file.- See Also:
- Constant Field Values
-
-
Method Detail
-
build
public static ClassLoader build()
Default build uses Red5 common lib without a parent classloader.- Returns:
- the class loader
-
build
public static ClassLoader build(Path path, int mode, ClassLoader parent)
Gets a class loader based on mode.- Parameters:
path- the directory or file containing classesmode- the mode in which the servlet should be loaded. The possible values areUSE_CURRENT_CLASSPATH, USE_CLASSPATH_LIB, USE_WAR_LIB
parent- the parent class loader or null if you want the current threads class loader- Returns:
- the Class loader to use to load the required class(es)
-
-