当前位置: 首页>>代码示例>>Java>>正文


Java StandardHost.getAppBase方法代码示例

本文整理汇总了Java中org.apache.catalina.core.StandardHost.getAppBase方法的典型用法代码示例。如果您正苦于以下问题:Java StandardHost.getAppBase方法的具体用法?Java StandardHost.getAppBase怎么用?Java StandardHost.getAppBase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.catalina.core.StandardHost的用法示例。


在下文中一共展示了StandardHost.getAppBase方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doTestUnpackWAR

import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
private void doTestUnpackWAR(boolean unpackWARs, boolean unpackWAR,
        boolean external, boolean resultDir) throws Exception {

    Tomcat tomcat = getTomcatInstance();
    StandardHost host = (StandardHost) tomcat.getHost();

    host.setUnpackWARs(unpackWARs);

    tomcat.start();

    File war;
    if (unpackWAR) {
        war = createWar(WAR_XML_UNPACKWAR_TRUE_SOURCE, !external);
    } else {
        war = createWar(WAR_XML_UNPACKWAR_FALSE_SOURCE, !external);
    }
    if (external) {
        createXmlInConfigBaseForExternal(war);
    }

    host.backgroundProcess();

    File dir = new File(host.getAppBase(), APP_NAME.getBaseName());
    Assert.assertEquals(
            Boolean.valueOf(resultDir), Boolean.valueOf(dir.isDirectory()));
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:27,代码来源:TestHostConfigAutomaticDeployment.java

示例2: oldRealWarPath

import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
@Deprecated
private static File oldRealWarPath(final Context standardContext) {
    String doc = standardContext.getDocBase();
    // handle ROOT case
    if (doc == null || doc.length() == 0) {
        doc = "ROOT";
    }

    File war = new File(doc);
    if (war.exists()) {
        return war;
    }

    final StandardHost host = (StandardHost) standardContext.getParent();
    final String base = host.getAppBase();
    war = new File(base, doc);
    if (war.exists()) {
        return war;
    }

    war = new File(new File(System.getProperty("catalina.home"), base), doc);
    if (war.exists()) {
        return war;
    }
    return new File(new File(System.getProperty("catalina.base"), base), doc); // shouldn't occur
}
 
开发者ID:apache,项目名称:tomee,代码行数:27,代码来源:Contexts.java

示例3: appBase

import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
/**
 * Returns application base of the given host.
 *
 * @param standardHost tomcat host
 * @return application base of the given host
 */
protected File appBase(final StandardHost standardHost) {
    File file = new File(standardHost.getAppBase());
    if (!file.isAbsolute()) {
        file = new File(System.getProperty("catalina.base"), standardHost.getAppBase());
    }
    try {
        file = file.getCanonicalFile();
    } catch (final IOException e) {
        logger.debug(e.getMessage(), e);
    }
    return file;
}
 
开发者ID:apache,项目名称:tomee,代码行数:19,代码来源:TomcatWebAppBuilder.java

示例4: doTestDeployment

import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
private void doTestDeployment(boolean deployXML, boolean copyXML,
        boolean unpackWARs, LifecycleState resultState, String cookieName,
        boolean resultXml, boolean resultWar, boolean resultDir)
        throws Exception {

    Tomcat tomcat = getTomcatInstance();

    // Start the instance
    tomcat.start();

    // Set the attributes
    StandardHost host = (StandardHost) tomcat.getHost();
    host.setDeployXML(deployXML);
    host.setCopyXML(copyXML);
    host.setUnpackWARs(unpackWARs);

    // Trigger automatic deployment
    host.backgroundProcess();

    // Test the results
    Context ctxt = (Context) tomcat.getHost().findChild(APP_NAME.getPath());
    if (resultState == null) {
        Assert.assertNull(ctxt);
    } else {
        Assert.assertNotNull(ctxt);
        Assert.assertEquals(resultState, ctxt.getState());
        Assert.assertEquals(cookieName, ctxt.getSessionCookieName());
    }

    File xml = new File(
            getConfigBaseFile(host), APP_NAME.getBaseName() + ".xml");
    Assert.assertEquals(
            Boolean.valueOf(resultXml), Boolean.valueOf(xml.isFile()));

    File war = new File(
            getAppBaseFile(host), APP_NAME.getBaseName() + ".war");
    Assert.assertEquals(
            Boolean.valueOf(resultWar), Boolean.valueOf(war.isFile()));

    File dir = new File(host.getAppBase(), APP_NAME.getBaseName());
    Assert.assertEquals(
            Boolean.valueOf(resultDir), Boolean.valueOf(dir.isDirectory()));
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:44,代码来源:TestHostConfigAutomaticDeployment.java


注:本文中的org.apache.catalina.core.StandardHost.getAppBase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。