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

x33g5p2x  于2022-01-30 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(115)

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

Server.getCatalinaHome介绍

[英]Obtain the configured home (binary) directory. Note that home and base may be the same (and are by default).
[中]获取配置的主(二进制)目录。请注意,home和base可能是相同的(默认情况下是相同的)。

代码示例

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

@Override
public File getCatalinaHome() {
  if (service != null) {
    Server s = service.getServer();
    if (s != null) {
      File base = s.getCatalinaHome();
      if (base != null) {
        return base;
      }
    }
  }
  // Fall-back
  return super.getCatalinaHome();
}

代码示例来源:origin: org.nuxeo.runtime/nuxeo-runtime-server

@Override
public void stop() {
  if (tomcat == null) {
    return;
  }
  try {
    tomcat.stop();
    File workDirectory = Paths.get(tomcat.getServer().getCatalinaHome().getAbsolutePath(), "work").toFile();
    FileUtils.deleteDirectory(workDirectory);
    tomcat.destroy();
  } catch (LifecycleException | IOException e) {
    throw new RuntimeServiceException(e);
  }
}

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

@Override
public File getCatalinaHome() {
  if (service != null) {
    Server s = service.getServer();
    if (s != null) {
      File base = s.getCatalinaHome();
      if (base != null) {
        return base;
      }
    }
  }
  // Fall-back
  return super.getCatalinaHome();
}

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

server.getCatalinaHome().getPath());

代码示例来源:origin: com.github.vatbub/awsec2wakelauncher.common

public static void startServer(int tomcatPort, String contextPath, String servletName, Servlet servlet, String servletPattern) throws LifecycleException, IOException {
  List<String> relativeFolders = new ArrayList<>();
  relativeFolders.add("src");
  relativeFolders.add("main");
  relativeFolders.add("webapp");
  tomcat = new Tomcat();
  tomcat.setBaseDir(".");
  tomcat.setPort(tomcatPort);
  // copy src/main/webapp to webapps/src/main/webapp
  baseDir = tomcat.getServer().getCatalinaHome().toPath();
  Path sourcePath = baseDir.getParent().resolve("server");
  webappsPath = baseDir.resolve("webapps");
  destinationPath = webappsPath;
  for (String folder : relativeFolders) {
    sourcePath = sourcePath.resolve(folder);
    destinationPath = destinationPath.resolve(folder);
  }
  FileUtils.copyDirectory(sourcePath.toFile(), destinationPath.toFile());
  Path relativePath = webappsPath.relativize(destinationPath);
  /* There needs to be a symlink to the current dir named 'webapps' */
  context = tomcat.addContext(contextPath, relativePath.toString());
  tomcat.addServlet(contextPath, servletName, servlet);
  context.addServletMappingDecoded(servletPattern, servletName);
  tomcat.init();
  tomcat.start();
}

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

server.getCatalinaHome().getPath());

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

server.getCatalinaHome().getPath());

相关文章