org.apache.catalina.Context.getDocBase()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.apache.catalina.Context.getDocBase()方法的一些代码示例,展示了Context.getDocBase()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.getDocBase()方法的具体详情如下:
包路径:org.apache.catalina.Context
类名称:Context
方法名:getDocBase

Context.getDocBase介绍

[英]Return the document root for this Context. This can be an absolute pathname, a relative pathname, or a URL.
[中]返回此上下文的文档根目录。这可以是绝对路径名、相对路径名或URL。

代码示例

代码示例来源:origin: line/armeria

if (!config.docBase().toString().equals(expectedContext.getDocBase())) {
  throw new TomcatServiceException(
      "A configurator should never change the docBase of the default context.");

代码示例来源:origin: psi-probe/psi-probe

File docBase = new File(ctx.getDocBase());
 appDir = new File(getAppBase(), ctx.getDocBase());
} else {
 appDir = docBase;

代码示例来源:origin: psi-probe/psi-probe

app.setDocBase(context.getDocBase());
app.setDisplayName(context.getDisplayName());

代码示例来源:origin: org.jboss.arquillian.container/arquillian-tomcat-embedded-7

/**
   * 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();
  }
}

代码示例来源:origin: org.mobicents.arquillian.container/mss-tomcat-embedded-6

/**
* 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();
}

代码示例来源:origin: org.apache.tomee/tomee-catalina

@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
  }
}

代码示例来源:origin: org.jaggeryjs/org.jaggeryjs.jaggery.tomcat.listener

/**
   * 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);
  }
}

代码示例来源:origin: wso2/jaggery

/**
   * 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);
  }
}

代码示例来源:origin: org.jaggeryjs/org.jaggeryjs.jaggery.tomcat.listener

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();

代码示例来源:origin: wso2/jaggery

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();

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

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;
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

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;
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

if (context.getDocBase() != null) {
  File docBase = new File(context.getDocBase());
  if (!docBase.isAbsolute()) {
    docBase = new File(appBase(), context.getDocBase());

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

if (context.getDocBase() != null) {
  File docBase = new File(context.getDocBase());
  if (!docBase.isAbsolute()) {
    docBase = new File(appBase(), context.getDocBase());

代码示例来源:origin: org.springframework.osgi/org.springframework.osgi.web

/**
 * 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));
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

@Override
protected void startInternal() throws LifecycleException {
  String docBase = context.getDocBase();

代码示例来源:origin: org.springframework.osgi/spring-osgi-web

/**
 * 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));
  }
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

"running",
      "" + context.getManager().findSessions().length,
      context.getDocBase()));
} else {
  writer.println(smClient.getString("managerServlet.listitem",
      "stopped",
      "0",
      context.getDocBase()));

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

"running",
      "" + context.getManager().findSessions().length,
      context.getDocBase()));
} else {
  writer.println(smClient.getString("managerServlet.listitem",
      "stopped",
      "0",
      context.getDocBase()));

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

"running",
      "" + context.getManager().findSessions().length,
      context.getDocBase()));
} else {
  writer.println(smClient.getString("managerServlet.listitem",
      "stopped",
      "0",
      context.getDocBase()));

相关文章

微信公众号

最新文章

更多

Context类方法