@Override public File getAppBase() { File base = new File(host.getAppBase()); if (!base.isAbsolute()) { base = new File(System.getProperty("catalina.base"), host.getAppBase()); } return base; }
/** * Return a File object representing the "application root" directory * for our associated Host. */ protected File getAppBase() { if (appBase != null) { return appBase; } File file = new File(host.getAppBase()); if (!file.isAbsolute()) file = new File(System.getProperty(Globals.CATALINA_BASE_PROP), host.getAppBase()); try { appBase = file.getCanonicalFile(); } catch (IOException e) { appBase = file; } return (appBase); }
/** * Return a File object representing the "application root" directory * for our associated Host. */ protected File appBase() { if (appBase != null) { return appBase; } appBase = returnCanonicalPath(host.getAppBase()); return appBase; }
/** * Return a File object representing the "application root" directory * for our associated Host. */ protected File appBase() { if (appBase != null) { return appBase; } appBase = returnCanonicalPath(host.getAppBase()); return appBase; }
/** * Return a File object representing the "application root" directory * for our associated Host. */ protected File appBase() { if (appBase != null) { return appBase; } appBase = returnCanonicalPath(host.getAppBase()); return appBase; }
/** * Return a File object representing the "application root" directory * for our associated Host. */ protected File appBase() { if (appBase != null) { return appBase; } appBase = returnCanonicalPath(host.getAppBase()); return appBase; }
/** * Return a File object representing the "application root" directory * for our associated Host. */ protected File appBase() { if (appBase != null) { return appBase; } appBase = returnCanonicalPath(host.getAppBase()); return appBase; }
/** * Get app base. */ protected String getAppBase() { String appBase = null; Container container = this; while (container != null) { if (container instanceof Host) break; container = container.getParent(); } if (container != null) { appBase = ((Host) container).getAppBase(); } return appBase; }
/** * Get app base. */ protected String getAppBase() { String appBase = null; Container container = this; while (container != null) { if (container instanceof Host) break; container = container.getParent(); } if (container != null) { appBase = ((Host) container).getAppBase(); } return appBase; }
/** * Get app base. */ protected String getAppBase() { String appBase = null; Container container = this; while (container != null) { if (container instanceof Host) break; container = container.getParent(); } if (container != null) { appBase = ((Host) container).getAppBase(); } return appBase; }
/** * Get app base. */ protected String getAppBase() { String appBase = null; Container container = this; while (container != null) { if (container instanceof Host) break; container = container.getParent(); } if (container != null) { appBase = ((Host) container).getAppBase(); } return appBase; }
/** * Get app base. */ protected String getAppBase() { String appBase = null; Container container = this; while (container != null) { if (container instanceof Host) break; container = container.getParent(); } if (container != null) { appBase = ((Host) container).getAppBase(); } return appBase; }
/** * Get app base. */ protected String getAppBase() { String appBase = null; Container container = this; while (container != null) { if (container instanceof Host) break; container = container.getParent(); } if (container != null) { appBase = ((Host) container).getAppBase(); } return appBase; }
/** * Get app base. */ protected String getAppBase() { String appBase = null; Container container = this; while (container != null) { if (container instanceof Host) break; container = container.getParent(); } if (container != null) { appBase = ((Host) container).getAppBase(); } return appBase; }
/** * Make sure an the unpacked WAR is not left behind * you would think Tomcat would cleanup an unpacked WAR, but it doesn't */ @Override public void deleteUnpackedWAR(StandardContext standardContext) { File unpackDir = new File(standardHost.getAppBase(), standardContext.getPath().substring(1)); if (unpackDir.exists()) { ExpandWar.deleteDir(unpackDir); } }
/** * get the AppBase path of the web app * * @param context Context of the webapp * @return Path */ public Path getAppBase(Context context) { String appBase = null; if (context != null) { String docBase = context.getDocBase(); Host host = (Host) context.getParent(); appBase = host.getAppBase(); } return Paths.get(PATH_CATALINA_BASE.toString(), File.separator, appBase, File.separator); } }
/** * get the AppBase path of the web app * * @param context Context of the webapp * @return Path */ public Path getAppBase(Context context) { String appBase = null; if (context != null) { String docBase = context.getDocBase(); Host host = (Host) context.getParent(); appBase = host.getAppBase(); } return Paths.get(PATH_CATALINA_BASE.toString(), File.separator, appBase, File.separator); } }
/** * Make sure the WAR file and unpacked directory (if applicable) are not left behind. * * @see {@link TomcatEmbeddedConfiguration#isUnpackArchive()} */ private void deleteWar(final Archive<?> archive) { if (configuration.isUnpackArchive()) { final ContextName contextName = getContextName(archive); final File unpackDir = new File(host.getAppBase(), contextName.getBaseName()); if (unpackDir.exists()) { ExpandWar.deleteDir(unpackDir); } } final File warFile = new File(host.getAppBase(), archive.getName()); if (warFile.exists()) { warFile.delete(); } }
MBeanServer mBeanServer = MBeanServerFactory.findMBeanServer(null).get(0); ObjectName name = new ObjectName("Catalina", "type", "Server"); Server server = (Server) mBeanServer.getAttribute(name, "managedResource"); Service service = server.findService("Catalina"); Engine engine = (Engine) service.getContainer(); Host host = (Host) engine.findChild(engine.getDefaultHost()); host.getAppBase(); //Got it.
/** * * @return list of webapp directories */ private List<String> getBaseDirs() { CarbonTomcatService service = SVNDataHolder.getInstance().getCarbonTomcatService(); List<String> baseDirs = new ArrayList<String>(); if (service != null) { Tomcat tomcat = service.getTomcat(); Container[] virtualHosts = tomcat.getEngine().findChildren(); for (Container container : virtualHosts) { Host host = (Host) container; String baseDir = getBaseDirectoryName(host.getAppBase()); baseDirs.add(baseDir); } } return baseDirs; }