本文整理汇总了Java中org.apache.catalina.core.StandardHost.setUnpackWARs方法的典型用法代码示例。如果您正苦于以下问题:Java StandardHost.setUnpackWARs方法的具体用法?Java StandardHost.setUnpackWARs怎么用?Java StandardHost.setUnpackWARs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.catalina.core.StandardHost
的用法示例。
在下文中一共展示了StandardHost.setUnpackWARs方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: testBrokenAppWithAntiLocking
import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
private void testBrokenAppWithAntiLocking(boolean unpackWARs)
throws Exception {
Tomcat tomcat = getTomcatInstance();
StandardHost host = (StandardHost) tomcat.getHost();
host.setUnpackWARs(unpackWARs);
File war = createWar(WAR_BROKEN_SOURCE, false);
createXmlInConfigBaseForExternal(war, true);
File dir = new File(getAppBaseFile(host), APP_NAME.getBaseName());
tomcat.start();
// Simulate deploy on start-up
tomcat.getHost().backgroundProcess();
Assert.assertTrue(war.isFile());
if (unpackWARs) {
Assert.assertTrue(dir.isDirectory());
}
}
示例3: addHostToEngine
import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
/**
* add host to engine.
*
* @param hostName
* name of the host
* @return will return the added host of Engine
*/
public static Host addHostToEngine(String hostName) {
String hostBaseDir = CarbonUtils.getCarbonRepository() + "/"
+ UrlMapperConstants.HostProperties.WEB_APPS + "/";
CarbonTomcatService carbonTomcatService = DataHolder.getInstance().getCarbonTomcatService();
// adding virtual host to tomcat engine
Engine engine = carbonTomcatService.getTomcat().getEngine();
StandardHost host = new StandardHost();
host.setAppBase(hostBaseDir);
host.setName(hostName);
host.setUnpackWARs(false);
host.addValve(new CarbonContextCreatorValve());
host.addValve(new CompositeValve());
engine.addChild(host);
log.info("host added to the tomcat: " + host);
return host;
}
示例4: createStandardHost
import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
/**
* Create a new StandardHost.
*
* @param parent MBean Name of the associated parent component
* @param name Unique name of this Host
* @param appBase Application base directory name
* @param autoDeploy Should we auto deploy?
* @param deployOnStartup Deploy on server startup?
* @param deployXML Should we deploy Context XML config files property?
* @param unpackWARs Should we unpack WARs when auto deploying?
*
* @exception Exception if an MBean cannot be created or registered
*/
public String createStandardHost(String parent, String name,
String appBase,
boolean autoDeploy,
boolean deployOnStartup,
boolean deployXML,
boolean unpackWARs)
throws Exception {
// Create a new StandardHost instance
StandardHost host = new StandardHost();
host.setName(name);
host.setAppBase(appBase);
host.setAutoDeploy(autoDeploy);
host.setDeployOnStartup(deployOnStartup);
host.setDeployXML(deployXML);
host.setUnpackWARs(unpackWARs);
// add HostConfig for active reloading
HostConfig hostConfig = new HostConfig();
host.addLifecycleListener(hostConfig);
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
Service service = getService(pname);
Engine engine = (Engine) service.getContainer();
engine.addChild(host);
// Return the corresponding MBean name
return (host.getObjectName().toString());
}
示例5: createStandardHost
import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
/**
* Create a new StandardHost.
*
* @param parent MBean Name of the associated parent component
* @param name Unique name of this Host
* @param appBase Application base directory name
* @param autoDeploy Should we auto deploy?
* @param deployOnStartup Deploy on server startup?
* @param deployXML Should we deploy Context XML config files property?
* @param unpackWARs Should we unpack WARs when auto deploying?
* @param xmlNamespaceAware Should we turn on/off XML namespace awareness?
* @param xmlValidation Should we turn on/off XML validation?
*
* @exception Exception if an MBean cannot be created or registered
*/
public String createStandardHost(String parent, String name,
String appBase,
boolean autoDeploy,
boolean deployOnStartup,
boolean deployXML,
boolean unpackWARs,
boolean xmlNamespaceAware,
boolean xmlValidation)
throws Exception {
// Create a new StandardHost instance
StandardHost host = new StandardHost();
host.setName(name);
host.setAppBase(appBase);
host.setAutoDeploy(autoDeploy);
host.setDeployOnStartup(deployOnStartup);
host.setDeployXML(deployXML);
host.setUnpackWARs(unpackWARs);
host.setXmlNamespaceAware(xmlNamespaceAware);
host.setXmlValidation(xmlValidation);
// add HostConfig for active reloading
HostConfig hostConfig = new HostConfig();
host.addLifecycleListener(hostConfig);
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
Service service = getService(pname);
Engine engine = (Engine) service.getContainer();
engine.addChild(host);
// Return the corresponding MBean name
return (host.getObjectName().toString());
}
示例6: createStandardHost
import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
/**
* Create a new StandardHost.
*
* @param parent MBean Name of the associated parent component
* @param name Unique name of this Host
* @param appBase Application base directory name
* @param autoDeploy Should we auto deploy?
* @param deployXML Should we deploy Context XML config files property?
* @param liveDeploy Should we live deploy?
* @param unpackWARs Should we unpack WARs when auto deploying?
*
* @exception Exception if an MBean cannot be created or registered
*/
public String createStandardHost(String parent, String name,
String appBase, boolean autoDeploy,
boolean deployXML, boolean liveDeploy,
boolean unpackWARs)
throws Exception {
// Create a new StandardHost instance
StandardHost host = new StandardHost();
host.setName(name);
host.setAppBase(appBase);
host.setAutoDeploy(autoDeploy);
host.setDeployXML(deployXML);
host.setLiveDeploy(liveDeploy);
host.setUnpackWARs(unpackWARs);
// 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();
engine.addChild(host);
// Return the corresponding MBean name
ManagedBean managed = registry.findManagedBean("StandardHost");
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), host);
return (oname.toString());
}
示例7: createStandardHost
import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
/**
* Create a new StandardHost.
*
* @param parent
* MBean Name of the associated parent component
* @param name
* Unique name of this Host
* @param appBase
* Application base directory name
* @param autoDeploy
* Should we auto deploy?
* @param deployOnStartup
* Deploy on server startup?
* @param deployXML
* Should we deploy Context XML config files property?
* @param unpackWARs
* Should we unpack WARs when auto deploying?
*
* @exception Exception
* if an MBean cannot be created or registered
*/
public String createStandardHost(String parent, String name, String appBase, boolean autoDeploy,
boolean deployOnStartup, boolean deployXML, boolean unpackWARs) throws Exception {
// Create a new StandardHost instance
StandardHost host = new StandardHost();
host.setName(name);
host.setAppBase(appBase);
host.setAutoDeploy(autoDeploy);
host.setDeployOnStartup(deployOnStartup);
host.setDeployXML(deployXML);
host.setUnpackWARs(unpackWARs);
// add HostConfig for active reloading
HostConfig hostConfig = new HostConfig();
host.addLifecycleListener(hostConfig);
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
Service service = getService(pname);
Engine engine = (Engine) service.getContainer();
engine.addChild(host);
// Return the corresponding MBean name
return (host.getObjectName().toString());
}
示例8: addHostToEngine
import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
public static Host addHostToEngine(String hostName) {
String hostBaseDir = CarbonUtils.getCarbonRepository() + "/webapps/";
CarbonTomcatService carbonTomcatService = DataHolder.getInstance().getCarbonTomcatService();
// adding virtual host to tomcat engine
Engine engine = carbonTomcatService.getTomcat().getEngine();
StandardHost host = new StandardHost();
host.setAppBase(hostBaseDir);
host.setName(hostName);
host.setUnpackWARs(false);
host.addValve(new CarbonContextCreatorValve());
host.addValve(new CompositeValve());
engine.addChild(host);
log.info("host added to the tomcat: " + host);
return host;
}
示例9: 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()));
}