本文整理汇总了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()));
}
示例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
}
示例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;
}
示例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()));
}