*/
public String createWebappLoader(String parent)
throws Exception {
// Create a new WebappLoader instance
WebappLoader loader = new WebappLoader();
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
Server server = ServerFactory.getServer();
String type = pname.getKeyProperty("type");
Service service = server.findService(pname.getKeyProperty("service"));
Engine engine = (Engine) service.getContainer();
if ((type != null) && (type.equals("Context"))) {
Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
String pathStr = getPathStr(pname.getKeyProperty("path"));
Context context = (Context) host.findChild(pathStr);
context.setLoader(loader);
} else if ((type != null) && (type.equals("DefaultContext"))) {
String hostName = pname.getKeyProperty("host");
DefaultContext defaultContext = null;
if (hostName == null) {
defaultContext = engine.getDefaultContext();
} else {
Host host = (Host)engine.findChild(hostName);
defaultContext = host.getDefaultContext();
}
if (defaultContext != null ){
loader.setDefaultContext(defaultContext);
defaultContext.setLoader(loader);
}
}
// Return the corresponding MBean name