本文整理匯總了Java中org.apache.catalina.Host.addChild方法的典型用法代碼示例。如果您正苦於以下問題:Java Host.addChild方法的具體用法?Java Host.addChild怎麽用?Java Host.addChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.catalina.Host
的用法示例。
在下文中一共展示了Host.addChild方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addContext
import org.apache.catalina.Host; //導入方法依賴的package包/類
public Context addContext(Host host, String contextPath, String contextName,
String dir) {
silence(host, contextName);
Context ctx = createContext(host, contextPath);
ctx.setName(contextName);
ctx.setPath(contextPath);
ctx.setDocBase(dir);
ctx.addLifecycleListener(new FixContextListener());
if (host == null) {
getHost().addChild(ctx);
} else {
host.addChild(ctx);
}
return ctx;
}
示例2: addWebapp
import org.apache.catalina.Host; //導入方法依賴的package包/類
/**
* @see #addWebapp(String, String)
*
* @param name Ignored. The contextPath will be used
*
* @deprecated Use {@link #addWebapp(Host, String, String)}
*/
@Deprecated
public Context addWebapp(Host host, String contextPath, String name, String docBase) {
silence(host, contextPath);
Context ctx = createContext(host, contextPath);
ctx.setPath(contextPath);
ctx.setDocBase(docBase);
ctx.addLifecycleListener(new DefaultWebXmlListener());
ctx.setConfigFile(getWebappConfigFile(docBase, contextPath));
ContextConfig ctxCfg = new ContextConfig();
ctx.addLifecycleListener(ctxCfg);
// prevent it from looking ( if it finds one - it'll have dup error )
ctxCfg.setDefaultWebXml(noDefaultWebXmlPath());
if (host == null) {
getHost().addChild(ctx);
} else {
host.addChild(ctx);
}
return ctx;
}
示例3: createStandardContext
import org.apache.catalina.Host; //導入方法依賴的package包/類
/**
* Create a new StandardContext.
*
* @param parent MBean Name of the associated parent component
* @param path The context path for this Context
* @param docBase Document base directory (or WAR) for this Context
*
* @exception Exception if an MBean cannot be created or registered
*/
public String createStandardContext(String parent, String path,
String docBase)
throws Exception {
// Create a new StandardContext instance
StandardContext context = new StandardContext();
path = getPathStr(path);
context.setPath(path);
context.setDocBase(docBase);
ContextConfig contextConfig = new ContextConfig();
context.addLifecycleListener(contextConfig);
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
Server server = ServerFactory.getServer();
Service service = server.findService(pname.getKeyProperty("service"));
Engine engine = (Engine) service.getContainer();
Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
// Add context to the host
host.addChild(context);
// Return the corresponding MBean name
ManagedBean managed = registry.findManagedBean("StandardContext");
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), context);
return (oname.toString());
}
示例4: createStandardContext
import org.apache.catalina.Host; //導入方法依賴的package包/類
/**
* Create a new StandardContext.
*
* @param parent MBean Name of the associated parent component
* @param path The context path for this Context
* @param docBase Document base directory (or WAR) for this Context
*
* @exception Exception if an MBean cannot be created or registered
*/
public String createStandardContext(String parent,
String path,
String docBase,
boolean xmlValidation,
boolean xmlNamespaceAware,
boolean tldValidation,
boolean tldNamespaceAware)
throws Exception {
// Create a new StandardContext instance
StandardContext context = new StandardContext();
path = getPathStr(path);
context.setPath(path);
context.setDocBase(docBase);
context.setXmlValidation(xmlValidation);
context.setXmlNamespaceAware(xmlNamespaceAware);
context.setTldValidation(tldValidation);
context.setTldNamespaceAware(tldNamespaceAware);
ContextConfig contextConfig = new ContextConfig();
context.addLifecycleListener(contextConfig);
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
ObjectName deployer = new ObjectName(pname.getDomain()+
":type=Deployer,host="+
pname.getKeyProperty("host"));
if(mserver.isRegistered(deployer)) {
String contextName = context.getName();
mserver.invoke(deployer, "addServiced",
new Object [] {contextName},
new String [] {"java.lang.String"});
String configPath = (String)mserver.getAttribute(deployer,
"configBaseName");
String baseName = context.getBaseName();
File configFile = new File(new File(configPath), baseName+".xml");
if (configFile.isFile()) {
context.setConfigFile(configFile.toURI().toURL());
}
mserver.invoke(deployer, "manageApp",
new Object[] {context},
new String[] {"org.apache.catalina.Context"});
mserver.invoke(deployer, "removeServiced",
new Object [] {contextName},
new String [] {"java.lang.String"});
} else {
log.warn("Deployer not found for "+pname.getKeyProperty("host"));
Service service = getService(pname);
Engine engine = (Engine) service.getContainer();
Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
host.addChild(context);
}
// Return the corresponding MBean name
return context.getObjectName().toString();
}
示例5: createStandardContext
import org.apache.catalina.Host; //導入方法依賴的package包/類
/**
* Create a new StandardContext.
*
* @param parent MBean Name of the associated parent component
* @param path The context path for this Context
* @param docBase Document base directory (or WAR) for this Context
*
* @exception Exception if an MBean cannot be created or registered
*/
public String createStandardContext(String parent,
String path,
String docBase,
boolean xmlValidation,
boolean xmlNamespaceAware,
boolean tldValidation,
boolean tldNamespaceAware)
throws Exception {
// Create a new StandardContext instance
StandardContext context = new StandardContext();
path = getPathStr(path);
context.setPath(path);
context.setDocBase(docBase);
context.setXmlValidation(xmlValidation);
context.setXmlNamespaceAware(xmlNamespaceAware);
context.setTldValidation(tldValidation);
context.setTldNamespaceAware(tldNamespaceAware);
ContextConfig contextConfig = new ContextConfig();
context.addLifecycleListener(contextConfig);
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
ObjectName deployer = new ObjectName(pname.getDomain()+
":type=Deployer,host="+
pname.getKeyProperty("host"));
if(mserver.isRegistered(deployer)) {
String contextPath = context.getPath();
mserver.invoke(deployer, "addServiced",
new Object [] {contextPath},
new String [] {"java.lang.String"});
String configPath = (String)mserver.getAttribute(deployer,
"configBaseName");
String baseName = getConfigFile(contextPath);
File configFile = new File(new File(configPath), baseName+".xml");
context.setConfigFile(configFile.getAbsolutePath());
mserver.invoke(deployer, "manageApp",
new Object[] {context},
new String[] {"org.apache.catalina.Context"});
mserver.invoke(deployer, "removeServiced",
new Object [] {contextPath},
new String [] {"java.lang.String"});
} else {
log.warn("Deployer not found for "+pname.getKeyProperty("host"));
Service service = getService(pname);
Engine engine = (Engine) service.getContainer();
Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
host.addChild(context);
}
// Return the corresponding MBean name
ObjectName oname = context.getJmxName();
return (oname.toString());
}
示例6: createStandardContext
import org.apache.catalina.Host; //導入方法依賴的package包/類
/**
* Create a new StandardContext.
*
* @param parent
* MBean Name of the associated parent component
* @param path
* The context path for this Context
* @param docBase
* Document base directory (or WAR) for this Context
*
* @exception Exception
* if an MBean cannot be created or registered
*/
public String createStandardContext(String parent, String path, String docBase, boolean xmlValidation,
boolean xmlNamespaceAware, boolean tldValidation, boolean tldNamespaceAware) throws Exception {
Where.amI();
// Create a new StandardContext instance
StandardContext context = new StandardContext();
path = getPathStr(path);
context.setPath(path);
context.setDocBase(docBase);
context.setXmlValidation(xmlValidation);
context.setXmlNamespaceAware(xmlNamespaceAware);
context.setTldValidation(tldValidation);
context.setTldNamespaceAware(tldNamespaceAware);
ContextConfig contextConfig = new ContextConfig();
context.addLifecycleListener(contextConfig);
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
ObjectName deployer = new ObjectName(pname.getDomain() + ":type=Deployer,host=" + pname.getKeyProperty("host"));
if (mserver.isRegistered(deployer)) {
String contextName = context.getName();
mserver.invoke(deployer, "addServiced", new Object[] { contextName }, new String[] { "java.lang.String" });
String configPath = (String) mserver.getAttribute(deployer, "configBaseName");
String baseName = context.getBaseName();
File configFile = new File(new File(configPath), baseName + ".xml");
if (configFile.isFile()) {
context.setConfigFile(configFile.toURI().toURL());
}
mserver.invoke(deployer, "manageApp", new Object[] { context },
new String[] { "org.apache.catalina.Context" });
mserver.invoke(deployer, "removeServiced", new Object[] { contextName },
new String[] { "java.lang.String" });
} else {
log.warn("Deployer not found for " + pname.getKeyProperty("host"));
Service service = getService(pname);
Engine engine = (Engine) service.getContainer();
Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
host.addChild(context);
}
// Return the corresponding MBean name
return context.getObjectName().toString();
}