if (!config.docBase().toString().equals(expectedContext.getDocBase())) { throw new TomcatServiceException( "A configurator should never change the docBase of the default context.");
File docBase = new File(ctx.getDocBase()); appDir = new File(getAppBase(), ctx.getDocBase()); } else { appDir = docBase;
app.setDocBase(context.getDocBase()); app.setDisplayName(context.getDisplayName());
/** * Override to assign an internal field that will trigger the removal of the unpacked WAR when the context is closed. */ @Override protected void fixDocBase() throws IOException { super.fixDocBase(); // If this field is not null, the unpacked WAR is removed when // the context is closed. This is normally used by the antiLocking // feature, though it should have been the normal behavior, at // least for an embedded container. originalDocBase = context.getDocBase(); } }
/** * Overridde to assign an internal field that will trigger the removal * of the unpacked WAR when the context is closed. */ @Override protected void fixDocBase() throws IOException { super.fixDocBase(); // If this field is not null, the unpacked WAR is removed when // the context is closed. This is normally used by the antiLocking // feature, though it should have been the normal behavior, at // least for an embedded container. originalDocBase = context.getDocBase(); }
@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 } }
/** * 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); } }
Path appBase = getAppBase(context); String path; if (context.getDocBase().contains(WAR_EXTENSION)) { try { if (!appBase.endsWith("/")) { path = appBase + File.separator + context.getDocBase(); } else { path = appBase + context.getDocBase();
Path appBase = getAppBase(context); String path; if (context.getDocBase().contains(WAR_EXTENSION)) { try { if (!appBase.endsWith("/")) { path = appBase + File.separator + context.getDocBase(); } else { path = appBase + context.getDocBase();
protected WebResourceSet createMainResourceSet() { String docBase = context.getDocBase(); WebResourceSet mainResourceSet; if (docBase == null) { mainResourceSet = new EmptyResourceSet(this); } else { File f = new File(docBase); if (!f.isAbsolute()) { f = new File(((Host)context.getParent()).getAppBaseFile(), f.getPath()); } if (f.isDirectory()) { mainResourceSet = new DirResourceSet(this, "/", f.getAbsolutePath(), "/"); } else if(f.isFile() && docBase.endsWith(".war")) { mainResourceSet = new WarResourceSet(this, "/", f.getAbsolutePath()); } else { throw new IllegalArgumentException( sm.getString("standardRoot.startInvalidMain", f.getAbsolutePath())); } } return mainResourceSet; }
protected WebResourceSet createMainResourceSet() { String docBase = context.getDocBase(); WebResourceSet mainResourceSet; if (docBase == null) { mainResourceSet = new EmptyResourceSet(this); } else { File f = new File(docBase); if (!f.isAbsolute()) { f = new File(((Host)context.getParent()).getAppBaseFile(), f.getPath()); } if (f.isDirectory()) { mainResourceSet = new DirResourceSet(this, "/", f.getAbsolutePath(), "/"); } else if(f.isFile() && docBase.endsWith(".war")) { mainResourceSet = new WarResourceSet(this, "/", f.getAbsolutePath()); } else { throw new IllegalArgumentException( sm.getString("standardRoot.startInvalidMain", f.getAbsolutePath())); } } return mainResourceSet; }
if (context.getDocBase() != null) { File docBase = new File(context.getDocBase()); if (!docBase.isAbsolute()) { docBase = new File(appBase(), context.getDocBase());
if (context.getDocBase() != null) { File docBase = new File(context.getDocBase()); if (!docBase.isAbsolute()) { docBase = new File(appBase(), context.getDocBase());
/** * Stops the given context. * * @param catalinaContext * @throws OsgiWarDeploymentException */ private void stopCatalinaContext(Context catalinaContext) throws OsgiWarDeploymentException { String docBase = catalinaContext.getDocBase(); String contextPath = catalinaContext.getPath(); String messageEnding = "context [" + contextPath + "] from server " + getServerInfo(); log.info("About to undeploy " + messageEnding); // remove context try { removeContext(catalinaContext); log.info("Context [" + contextPath + "] undeployed successfully from server " + getServerInfo()); } catch (Exception ex) { throw new OsgiWarDeploymentException("Cannot undeploy " + messageEnding, ex); } // try to clean up anyway finally { if (log.isDebugEnabled()) log.debug("Cleaning unpacked folder " + docBase); // clean unpacked folder ExpandWar.delete(new File(docBase)); } }
@Override protected void startInternal() throws LifecycleException { String docBase = context.getDocBase();
/** * Stops the given context. * * @param catalinaContext * @throws OsgiWarDeploymentException */ private void stopCatalinaContext(Context catalinaContext) throws OsgiWarDeploymentException { String docBase = catalinaContext.getDocBase(); String contextPath = catalinaContext.getPath(); String messageEnding = "context [" + contextPath + "] from server " + getServerInfo(); log.info("About to undeploy " + messageEnding); // remove context try { removeContext(catalinaContext); log.info("Context [" + contextPath + "] undeployed successfully from server " + getServerInfo()); } catch (Exception ex) { throw new OsgiWarDeploymentException("Cannot undeploy " + messageEnding, ex); } // try to clean up anyway finally { if (log.isDebugEnabled()) log.debug("Cleaning unpacked folder " + docBase); // clean unpacked folder ExpandWar.delete(new File(docBase)); } }
"running", "" + context.getManager().findSessions().length, context.getDocBase())); } else { writer.println(smClient.getString("managerServlet.listitem", "stopped", "0", context.getDocBase()));
"running", "" + context.getManager().findSessions().length, context.getDocBase())); } else { writer.println(smClient.getString("managerServlet.listitem", "stopped", "0", context.getDocBase()));
"running", "" + context.getManager().findSessions().length, context.getDocBase())); } else { writer.println(smClient.getString("managerServlet.listitem", "stopped", "0", context.getDocBase()));