本文整理了Java中org.codehaus.cargo.container.deployable.WAR.getFile()
方法的一些代码示例,展示了WAR.getFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WAR.getFile()
方法的具体详情如下:
包路径:org.codehaus.cargo.container.deployable.WAR
类名称:WAR
方法名:getFile
暂无
代码示例来源:origin: apache/geode
/**
* Deploys the {@link #warFile} to the cargo container ({@link #container}).
*/
public void deployWar() {
// Get the cargo war from the war file
WAR war = new WAR(warFile.getAbsolutePath());
// Set context access to nothing
war.setContext("");
// Deploy the war the container's configuration
getConfiguration().addDeployable(war);
logger.info("Deployed WAR file at {}", war.getFile());
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* Extract the context name from the WAR file name (without the file extension). For example if
* the WAR is named <code>test.war</code> then the context name is <code>test</code>.
*/
private void parseContext()
{
if (this.context == null)
{
String ctx = getFileHandler().getName(getFile());
int warIndex = ctx.toLowerCase().lastIndexOf(".war");
if (warIndex >= 0)
{
ctx = ctx.substring(0, warIndex);
}
getLogger().debug("Parsed web context = [" + ctx + "]", this.getClass().getName());
setContext(ctx);
}
}
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-jetty
@Override
protected String createContextXml(WAR war)
{
StringBuilder buffer = new StringBuilder();
buffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
buffer.append("<!DOCTYPE Configure PUBLIC \"-//Jetty//Configure//EN\" "
+ "\"http://www.eclipse.org/jetty/configure.dtd\">\n");
buffer.append("<Configure class=\"org.eclipse.jetty.webapp.WebAppContext\">\n");
buffer.append(" <Set name=\"contextPath\">/" + war.getContext() + "</Set>\n");
buffer.append(" <Set name=\"war\">" + war.getFile() + "</Set>\n");
buffer.append(" <Set name=\"extractWAR\">true</Set>\n");
buffer.append(" <Set name=\"defaultsDescriptor\"><SystemProperty name=\"config.home\" "
+ "default=\".\"/>/etc/webdefault.xml</Set>\n");
buffer.append(getExtraClasspathXmlFragment(war));
buffer.append(getSharedClasspathXmlFragment());
buffer.append("</Configure>\n");
return buffer.toString();
}
代码示例来源:origin: codehaus-cargo/cargo
@Override
protected String createContextXml(WAR war)
{
StringBuilder buffer = new StringBuilder();
buffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
buffer.append("<!DOCTYPE Configure PUBLIC \"-//Jetty//Configure//EN\" "
+ "\"http://www.eclipse.org/jetty/configure.dtd\">\n");
buffer.append("<Configure class=\"org.eclipse.jetty.webapp.WebAppContext\">\n");
buffer.append(" <Set name=\"contextPath\">/" + war.getContext() + "</Set>\n");
buffer.append(" <Set name=\"war\">" + war.getFile() + "</Set>\n");
buffer.append(" <Set name=\"extractWAR\">true</Set>\n");
buffer.append(" <Set name=\"defaultsDescriptor\"><SystemProperty name=\"config.home\" "
+ "default=\".\"/>/etc/webdefault.xml</Set>\n");
buffer.append(getExtraClasspathXmlFragment(war));
buffer.append(getSharedClasspathXmlFragment());
buffer.append("</Configure>\n");
return buffer.toString();
}
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-jetty
buffer.append(" </Array>\n");
buffer.append(" <Set name=\"contextPath\">/" + war.getContext() + "</Set>\n");
buffer.append(" <Set name=\"war\">" + war.getFile() + "</Set>\n");
buffer.append(" <Set name=\"extractWAR\">true</Set>\n");
buffer.append(" <Set name=\"defaultsDescriptor\"><SystemProperty name=\"config.home\" "
代码示例来源:origin: codehaus-cargo/cargo
buffer.append(" </Array>\n");
buffer.append(" <Set name=\"contextPath\">/" + war.getContext() + "</Set>\n");
buffer.append(" <Set name=\"war\">" + war.getFile() + "</Set>\n");
buffer.append(" <Set name=\"extractWAR\">true</Set>\n");
buffer.append(" <Set name=\"defaultsDescriptor\"><SystemProperty name=\"config.home\" "
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-tomcat
contextTokenValue.append(new File(deployable.getFile()).getAbsolutePath());
contextTokenValue.append("\"");
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-tomcat
contextTokenValue.append(new File(deployable.getFile()).getAbsolutePath());
contextTokenValue.append("\"");
代码示例来源:origin: codehaus-cargo/cargo
contextTokenValue.append(new File(deployable.getFile()).getAbsolutePath());
contextTokenValue.append("\"");
代码示例来源:origin: codehaus-cargo/cargo
contextTokenValue.append(new File(deployable.getFile()).getAbsolutePath());
contextTokenValue.append("\"");
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-resin
expandedWarValue.append(((WAR) deployable).getContext());
expandedWarValue.append("' " + dirAttribute + "='");
expandedWarValue.append(((WAR) deployable).getFile());
expandedWarValue.append("'><temp-dir>");
expandedWarValue.append(tmp.getPath());
代码示例来源:origin: codehaus-cargo/cargo
expandedWarValue.append(((WAR) deployable).getContext());
expandedWarValue.append("' " + dirAttribute + "='");
expandedWarValue.append(((WAR) deployable).getFile());
expandedWarValue.append("'><temp-dir>");
expandedWarValue.append(tmp.getPath());
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-jo
String docbase = getFileHandler().getURL(war.getFile()).toString();
if (war.isExpanded())
+ war.getFile() + LINE_SEPARATOR);
keyWebApps.append("host.webapp." + webappName + ".mapping=" + mapping
+ LINE_SEPARATOR);
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-jetty
+ war.getFile() + "]", e);
代码示例来源:origin: codehaus-cargo/cargo
+ war.getFile() + "]", e);
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-tomcat
TomcatPropertySet.WEBAPPS_DIRECTORY));
docBase = getFileHandler().append(webappsDirectory, war.getContext());
getFileHandler().explode(war.getFile(), docBase);
docBase = war.getFile();
代码示例来源:origin: codehaus-cargo/cargo
/**
* Test deployment of an expanded WAR in a custom context.
* @throws Exception If anything goes wrong.
*/
public void testDeployToNonExistingDirectory() throws Exception
{
WAR war = new WAR("ram:///some/warfile.war");
this.fsManager.resolveFile(war.getFile()).createFile();
AbstractCopyingInstalledLocalDeployer deployer =
new TestableCopyingDeployerWithDifferentDirectory(
createContainer(createContainerCapability(DeployableType.WAR), null));
try
{
deployer.deploy(war);
fail("Should have thrown a CargoException here");
}
catch (CargoException expected)
{
assertTrue("Incorrect message: " + expected.getMessage(),
expected.getMessage().contains("ram:///webapps-nonexisting"));
}
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* Test whether two WARs can be deployed to the same context.
* @throws Exception If anything goes wrong.
*/
public void testCanBeDeployedWhenTwoWARsInSameWebContext() throws Exception
{
AbstractCopyingInstalledLocalDeployer deployer = new TestableCopyingDeployer(
createContainer(createContainerCapability(DeployableType.WAR), null));
// Create WARs and make sure the wrapped files exist
WAR war1 = new WAR("ram:///path1/warfile.war");
this.fsManager.resolveFile(war1.getFile()).createFile();
WAR war2 = new WAR("ram:///path2/warfile.war");
this.fsManager.resolveFile(war2.getFile()).createFile();
// Deploy the first WAR
deployer.deploy(war1);
assertTrue(this.fsManager.resolveFile("ram:///webapps/warfile.war").exists());
try
{
// Deploy the second WAR using the same context as the already deployed WAR
deployer.deploy(war2);
fail("Expected ContainerException because we deployed two WARs with the same context "
+ "name.");
}
catch (ContainerException expected)
{
assertEquals("Failed to deploy [ram:///path2/warfile.war] to [ram:///webapps]. The "
+ "required web context is already in use by another application.",
expected.getMessage());
}
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* Test deployment of a WAR in its default context.
* @throws Exception If anything goes wrong.
*/
public void testDeployWhenWarWithDefaultContext() throws Exception
{
WAR war = new WAR("ram:///some/warfile.war");
this.fsManager.resolveFile(war.getFile()).createFile();
AbstractCopyingInstalledLocalDeployer deployer = new TestableCopyingDeployer(
createContainer(createContainerCapability(DeployableType.WAR), null));
assertFalse(this.fsManager.resolveFile("ram:///webapps/warfile.war").exists());
deployer.deploy(war);
assertTrue(this.fsManager.resolveFile("ram:///webapps/warfile.war").exists());
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* Test deployment of an expanded WAR in a custom context.
* @throws Exception If anything goes wrong.
*/
public void testDeployWhenExpandedWarWithCustomContext() throws Exception
{
// Create an expanded WAR
WAR war = new WAR("ram:///some/expanded/warfile");
war.setContext("context");
war.setFileHandler(this.fileHandler);
this.fsManager.resolveFile(war.getFile()).createFolder();
AbstractCopyingInstalledLocalDeployer deployer = new TestableCopyingDeployer(
createContainer(createContainerCapability(DeployableType.WAR), null));
assertFalse(this.fsManager.resolveFile("ram:///webapps/context").exists());
deployer.deploy(war);
assertTrue(this.fsManager.resolveFile("ram:///webapps/context").exists());
}
内容来源于网络,如有侵权,请联系作者删除!