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

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

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

Context.setConfigFile介绍

[英]Set the path to a file to save this Context information.
[中]设置文件路径以保存此上下文信息。

代码示例

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

ctx.setDocBase(config.docBase().toString());
ctx.addLifecycleListener(TomcatUtil.getDefaultWebXmlListener());
ctx.setConfigFile(TomcatUtil.getWebAppConfigFile(ROOT_CONTEXT_PATH, config.docBase()));

代码示例来源:origin: stackoverflow.com

Context ctx = tomcat.addWebapp("/", System.getProperty("user.dir") + "/build/web");
File contextFile = new File("META-INF/context.xml");
ctx.setConfigFile(contextFile);

代码示例来源:origin: org.glassfish.main.web/web-core

context.setDocBase(this.overrideDocBase);
if (this.overrideConfigFile != null)
  context.setConfigFile(this.overrideConfigFile);
host.fireContainerEvent(PRE_INSTALL_EVENT, context);
host.addChild(child);

代码示例来源:origin: tomcat/catalina

File configFile = new File(dir, Constants.ApplicationContextXml);
if (deployXML) {
  context.setConfigFile(configFile.getAbsolutePath());

代码示例来源:origin: apache/tomcat-maven-plugin

if ( contextFile != null )
  context.setConfigFile( contextFile.getAbsolutePath() );

代码示例来源:origin: apache/tomcat-maven-plugin

if ( contextFile != null )
  context.setConfigFile( contextFile.toURI().toURL() );

代码示例来源:origin: apache/tomcat-maven-plugin

if ( contextFile != null )
  context.setConfigFile( contextFile.toURI().toURL() );

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

context.setConfigFile(xmlCopy.toURI().toURL());
} else {
  context.setConfigFile(xml.toURI().toURL());

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

context.setConfigFile(xmlCopy.toURI().toURL());
} else {
  context.setConfigFile(xml.toURI().toURL());

代码示例来源:origin: apache/tomcat-maven-plugin

context.setConfigFile( overriddenContextFile.toURI().toURL() );
context.setConfigFile( defaultContextFile.toURI().toURL() );

代码示例来源:origin: org.apache.tapestry/tapestry-runner

context.setConfigFile(contextConfigFile.getAbsolutePath());

代码示例来源:origin: apache/tomcat-maven-plugin

if ( contextFile != null )
  context.setConfigFile( getContextFile().getAbsolutePath() );

代码示例来源:origin: Red5/red5-plugins

/**
 * @see #addWebapp(String, String)
 */
public Context addWebapp(Host host, String contextPath, String docBase, ContextConfig config) {
  Context ctx = createContext(host, contextPath);
  ctx.setPath(contextPath);
  ctx.setDocBase(docBase);
  ctx.addLifecycleListener(new DefaultWebXmlListener());
  ctx.setConfigFile(getWebappConfigFile(docBase, contextPath));
  ctx.addLifecycleListener(config);
  // prevent it from looking ( if it finds one - it'll have dup error )
  config.setDefaultWebXml(noDefaultWebXmlPath());
  // get the host first, creates a new std host if not already set
  getHost();
  // reset ParentClassLoader 
  if (!host.getParentClassLoader().equals(Thread.currentThread().getContextClassLoader())) {
    host.setParentClassLoader(Thread.currentThread().getContextClassLoader());
  }
  StandardRoot standardRoot = new StandardRoot(ctx);
  standardRoot.setCacheMaxSize(cacheMaxSize);
  ctx.setResources(standardRoot);
  // add the context
  host.addChild(ctx);
  return ctx;
}

代码示例来源:origin: org.testatoo.container/testatoo-container-tomcat

if (!ctx.exists() || !ctx.canRead())
    throw new IllegalArgumentException("Cannot access configuration file " + ctx);
  context.setConfigFile(ctx.getAbsolutePath());
} else {
  File ctx = new File(webappRoot(), "META-INF/context.xml");
  if (ctx.exists() && ctx.canRead()) {
    context.setConfigFile(ctx.getAbsolutePath());

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

String baseName = cn.getBaseName();
File xml = new File(configBase, baseName + ".xml");
context.setConfigFile(xml.toURI().toURL());
if (desc.isBackup())
  storeWithBackup((StandardContext) aContext);

代码示例来源:origin: ops4j/org.ops4j.pax.exam2

@Override
public Context addWebapp(Host host, String url, String name, String path) {
  Context ctx = new StandardContext();
  ctx.setName(name);
  ctx.setPath(url);
  ctx.setDocBase(path);
  ctx.addLifecycleListener(new DefaultWebXmlListener());
  URL configFile = getWebappConfigFile(path, url);
  ctx.setConfigFile(configFile);
  ContextConfig ctxCfg = new TomcatContextConfig();
  ctx.addLifecycleListener(ctxCfg);
  
  if (host == null) {
    getHost().addChild(ctx);
  } 
  else {
    host.addChild(ctx);
  }
  return ctx;
}

代码示例来源:origin: org.dbflute.tomcat/tomcat-boot

@Override
public Context addWebapp(Host host, String contextPath, String docBase, LifecycleListener config) {
  // quit because of private and unneeded
  //silence(host, contextPath);
  final Context ctx = createContext(host, contextPath);
  ctx.setPath(contextPath);
  ctx.setDocBase(docBase);
  ctx.addLifecycleListener(newDefaultWebXmlListener()); // *extension point
  ctx.setConfigFile(getWebappConfigFile(docBase, contextPath));
  ctx.addLifecycleListener(config);
  if (config instanceof ContextConfig) {
    // prevent it from looking ( if it finds one - it'll have dup error )
    ((ContextConfig) config).setDefaultWebXml(noDefaultWebXmlPath());
  }
  if (host == null) {
    getHost().addChild(ctx);
  } else {
    host.addChild(ctx);
  }
  return ctx;
}

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

/**
 * @param host The host in which the context will be deployed
 * @param contextPath The context mapping to use, "" for root context.
 * @param docBase Base directory for the context, for static files.
 *  Must exist, relative to the server home
 * @param config Custom context configurator helper
 * @return the deployed context
 * @see #addWebapp(String, String)
 */
public Context addWebapp(Host host, String contextPath, String docBase,
    LifecycleListener config) {
  silence(host, contextPath);
  Context ctx = createContext(host, contextPath);
  ctx.setPath(contextPath);
  ctx.setDocBase(docBase);
  if (addDefaultWebXmlToWebapp)
    ctx.addLifecycleListener(getDefaultWebXmlListener());
  ctx.setConfigFile(getWebappConfigFile(docBase, contextPath));
  ctx.addLifecycleListener(config);
  if (addDefaultWebXmlToWebapp && (config instanceof ContextConfig)) {
    // prevent it from looking ( if it finds one - it'll have dup error )
    ((ContextConfig) config).setDefaultWebXml(noDefaultWebXmlPath());
  }
  if (host == null) {
    getHost().addChild(ctx);
  } else {
    host.addChild(ctx);
  }
  return ctx;
}

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

/**
 * @param host The host in which the context will be deployed
 * @param contextPath The context mapping to use, "" for root context.
 * @param docBase Base directory for the context, for static files.
 *  Must exist, relative to the server home
 * @param config Custom context configurator helper
 * @return the deployed context
 * @see #addWebapp(String, String)
 */
public Context addWebapp(Host host, String contextPath, String docBase,
    LifecycleListener config) {
  silence(host, contextPath);
  Context ctx = createContext(host, contextPath);
  ctx.setPath(contextPath);
  ctx.setDocBase(docBase);
  ctx.addLifecycleListener(getDefaultWebXmlListener());
  ctx.setConfigFile(getWebappConfigFile(docBase, contextPath));
  ctx.addLifecycleListener(config);
  if (config instanceof ContextConfig) {
    // prevent it from looking ( if it finds one - it'll have dup error )
    ((ContextConfig) config).setDefaultWebXml(noDefaultWebXmlPath());
  }
  if (host == null) {
    getHost().addChild(ctx);
  } else {
    host.addChild(ctx);
  }
  return ctx;
}

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

/**
 * @see #addWebapp(String, String)
 */
public Context addWebapp(Host host, String url, String name, String path) {
  silence(host, url);
  Context ctx = new StandardContext();
  ctx.setName(name);
  ctx.setPath(url);
  ctx.setDocBase(path);
  ctx.addLifecycleListener(new DefaultWebXmlListener());
  ctx.setConfigFile(getWebappConfigFile(path, url));
  ContextConfig ctxCfg = new ContextConfig();
  ctx.addLifecycleListener(ctxCfg);
  // prevent it from looking ( if it finds one - it'll have dup error )
  ctxCfg.setDefaultWebXml(noDefaultWebXmlPath());
  if (host == null) {
    getHost().addChild(ctx);
  } else {
    host.addChild(ctx);
  }
  return ctx;
}

相关文章

微信公众号

最新文章

更多

Context类方法