Java Code Examples for org.apache.catalina.core.StandardHost#findChild()
The following examples show how to use
org.apache.catalina.core.StandardHost#findChild() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TomcatWebAppBuilder.java From tomee with Apache License 2.0 | 6 votes |
/** * Returns true if given application is deployed * false otherwise. * * @param file web application file * @param standardHost host * @return true if given application is deployed */ private boolean isDeployed(final File file, final StandardHost standardHost) { if (deployedApps.containsKey(file.getAbsolutePath())) { return true; } // check if this is a deployed web application String name = "/" + file.getName(); // ROOT context is a special case if (isRoot(name)) { name = ""; } // can be a dir or a war so exists is fine return file.exists() && standardHost.findChild(name) != null; }
Example 2
Source File: TestHostConfigAutomaticDeployment.java From Tomcat8-Source-Read with MIT License | 5 votes |
private void doTestCopyXML(boolean copyXmlHost, boolean copyXmlWar, boolean external, boolean resultXml) throws Exception { Tomcat tomcat = getTomcatInstance(); StandardHost host = (StandardHost) tomcat.getHost(); host.setCopyXML(copyXmlHost); tomcat.start(); File war; if (copyXmlWar) { war = createWar(WAR_XML_COPYXML_TRUE_SOURCE, !external); } else { war = createWar(WAR_XML_COPYXML_FALSE_SOURCE, !external); } if (external) { createXmlInConfigBaseForExternal(war); } host.backgroundProcess(); File xml = new File(host.getConfigBaseFile(), APP_NAME.getBaseName() + ".xml"); Assert.assertEquals( Boolean.valueOf(resultXml), Boolean.valueOf(xml.isFile())); Context context = (Context) host.findChild(APP_NAME.getName()); if (external) { Assert.assertEquals(XML_COOKIE_NAME, context.getSessionCookieName()); } else { Assert.assertEquals(WAR_COOKIE_NAME, context.getSessionCookieName()); } }
Example 3
Source File: TestHostConfigAutomaticDeployment.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
private void doTestCopyXML(boolean copyXmlHost, boolean copyXmlWar, boolean external, boolean resultXml) throws Exception { Tomcat tomcat = getTomcatInstance(); StandardHost host = (StandardHost) tomcat.getHost(); host.setCopyXML(copyXmlHost); tomcat.start(); File war; if (copyXmlWar) { war = createWar(WAR_XML_COPYXML_TRUE_SOURCE, !external); } else { war = createWar(WAR_XML_COPYXML_FALSE_SOURCE, !external); } if (external) { createXmlInConfigBaseForExternal(war); } host.backgroundProcess(); File xml = new File(getConfigBaseFile(host), APP_NAME.getBaseName() + ".xml"); Assert.assertEquals( Boolean.valueOf(resultXml), Boolean.valueOf(xml.isFile())); Context context = (Context) host.findChild(APP_NAME.getName()); if (external) { Assert.assertEquals(XML_COOKIE_NAME, context.getSessionCookieName()); } else { Assert.assertEquals(WAR_COOKIE_NAME, context.getSessionCookieName()); } }
Example 4
Source File: TestHostConfigAutomaticDeployment.java From tomcatsrc with Apache License 2.0 | 5 votes |
private void doTestCopyXML(boolean copyXmlHost, boolean copyXmlWar, boolean external, boolean resultXml) throws Exception { Tomcat tomcat = getTomcatInstance(); StandardHost host = (StandardHost) tomcat.getHost(); host.setCopyXML(copyXmlHost); tomcat.start(); File war; if (copyXmlWar) { war = createWar(WAR_XML_COPYXML_TRUE_SOURCE, !external); } else { war = createWar(WAR_XML_COPYXML_FALSE_SOURCE, !external); } if (external) { createXmlInConfigBaseForExternal(war); } host.backgroundProcess(); File xml = new File(getConfigBaseFile(host), APP_NAME.getBaseName() + ".xml"); Assert.assertEquals( Boolean.valueOf(resultXml), Boolean.valueOf(xml.isFile())); Context context = (Context) host.findChild(APP_NAME.getName()); if (external) { Assert.assertEquals(XML_COOKIE_NAME, context.getSessionCookieName()); } else { Assert.assertEquals(WAR_COOKIE_NAME, context.getSessionCookieName()); } }