protected File appBase(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 (IOException e) { } return file; }
protected File getAppBase(StandardHost host) { File appBase; File file = new File(host.getAppBase()); if (!file.isAbsolute()) file = new File(System.getProperty("catalina.base"), host .getAppBase()); try { appBase = file.getCanonicalFile(); } catch (IOException e) { appBase = file; } return (appBase); }
/** * Returns application base of the given host. * * @param standardHost tomcat host * @return application base of the given host */ protected File appBase(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 (IOException e) { } return file; }
/** * 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; }
/** * ({@inheritDoc} */ @Override public File getAppBaseFile() { if (appBaseFile != null) { return appBaseFile; } File file = new File(getAppBase()); // If not absolute, make it absolute if (!file.isAbsolute()) { file = new File(getCatalinaBase(), file.getPath()); } // Make it canonical if possible try { file = file.getCanonicalFile(); } catch (IOException ioe) { // Ignore } this.appBaseFile = file; return file; }
/** * ({@inheritDoc} */ @Override public File getAppBaseFile() { if (appBaseFile != null) { return appBaseFile; } File file = new File(getAppBase()); // If not absolute, make it absolute if (!file.isAbsolute()) { file = new File(getCatalinaBase(), file.getPath()); } // Make it canonical if possible try { file = file.getCanonicalFile(); } catch (IOException ioe) { // Ignore } this.appBaseFile = file; return file; }
/** * ({@inheritDoc} */ @Override public File getAppBaseFile() { if (appBaseFile != null) { return appBaseFile; } File file = new File(getAppBase()); // If not absolute, make it absolute if (!file.isAbsolute()) { file = new File(getCatalinaBase(), file.getPath()); } // Make it canonical if possible try { file = file.getCanonicalFile(); } catch (IOException ioe) { // Ignore } this.appBaseFile = file; return file; }
@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 } }
private static File tryToFindAndExtractWar(final StandardServer source) { if (System.getProperties().containsKey("openejb.war")) { return new File(System.getProperty("openejb.war")); } for (final Service service : source.findServices()) { final Container container = service.getContainer(); if (container instanceof StandardEngine) { final StandardEngine engine = (StandardEngine) container; for (final Container child : engine.findChildren()) { if (child instanceof StandardHost) { final StandardHost host = (StandardHost) child; final File base = hostDir(System.getProperty("catalina.base"), host.getAppBase()); final File[] files = base.listFiles(); if (files != null) { for (final File file : files) { if (isTomEEWar(file)) { return file; } } } } } } } return null; }
File appBase = new File(host.getAppBase()); if (!appBase.isAbsolute()) appBase = new File(System.getProperty("catalina.base"), host.getAppBase()); File contextFile = new File(docBase); File baseDir = contextFile.getParentFile();
/** * Acknowledge the occurrence of the specified event. * * @param event LifecycleEvent that has occurred */ @Override public void lifecycleEvent(LifecycleEvent event) { if(event.getType().equals(Lifecycle.BEFORE_INIT_EVENT)) { // register our custom context implementation host = (StandardHost)event.getLifecycle(); for(LifecycleListener listener : host.findLifecycleListeners()) { if(listener instanceof HostConfig) { ((HostConfig)listener).setContextClass(MarmottaContext.class.getCanonicalName()); } } } else if(event.getType().equals(Lifecycle.BEFORE_START_EVENT)) { if(event.getLifecycle() instanceof Host) { // register a container listener to indicate when a component has started log.info("starting host instance"); host = (StandardHost)event.getLifecycle(); host.addContainerListener(this); File file = new File(System.getProperty("catalina.base"),host.getAppBase()); max_progress = (file.list() != null ? file.list().length : 0); } } }
if (child instanceof StandardHost) { StandardHost host = (StandardHost) child; String appBase = host.getAppBase();
File appBase = new File(host.getAppBase()); if (!appBase.isAbsolute()) appBase = new File(System.getProperty("catalina.base"), host.getAppBase()); File contextFile = new File(context.getDocBase()); File baseDir = contextFile.getParentFile();
if (child instanceof StandardHost) { final StandardHost host = (StandardHost) child; final File hostDir = hostDir(catalinaBase, host.getAppBase());