當前位置: 首頁>>代碼示例>>Java>>正文


Java Host.addChild方法代碼示例

本文整理匯總了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;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:17,代碼來源:Tomcat.java

示例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;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:33,代碼來源:Tomcat.java

示例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());

}
 
開發者ID:c-rainstorm,項目名稱:jerrydog,代碼行數:40,代碼來源:MBeanFactory.java

示例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();

}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:67,代碼來源:MBeanFactory.java

示例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());

}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:67,代碼來源:MBeanFactory.java

示例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();

}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:61,代碼來源:MBeanFactory.java


注:本文中的org.apache.catalina.Host.addChild方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。