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

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

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

Context.getJarScanner介绍

[英]Get the Jar Scanner to be used to scan for JAR resources for this context.
[中]获取用于扫描此上下文的Jar资源的Jar扫描程序。

代码示例

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

Path baseDir = Files.createTempDirectory("integration-test").toAbsolutePath();

tomcat = new Tomcat();
tomcat.setBaseDir(baseDir.toString());

tomcat.setHostname("localhost");
tomcat.setPort(0); // random free port

Context context = tomcat.addWebapp("/", baseDir.toString());

StandardJarScanner jarScanner = (StandardJarScanner) context.getJarScanner();
jarScanner.setScanAllDirectories(true);

tomcat.start();

endpoint = URI.create("http://localhost:" + tomcat.getConnector().getLocalPort());

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

public static void configureJarScanner(final Context standardContext) {
  try { // override only if default
    final JarScanner originalJarScanner = standardContext.getJarScanner();
    if ("true".equalsIgnoreCase(SystemInstance.get().getProperty("tomee.tomcat.override.jar-scanner", "true"))
        && !TomEEJarScanner.class.isInstance(originalJarScanner)
        && StandardJarScanner.class.isInstance(originalJarScanner)) {
      final TomEEJarScanner jarScanner = new TomEEJarScanner();
      final Properties properties = SystemInstance.get().getProperties();
      final String scanClasspath = properties.getProperty(TomEEJarScanner.class.getName() + ".scanClassPath");
      if (scanClasspath != null) {
        jarScanner.setScanClassPath(Boolean.parseBoolean(scanClasspath));
      }
      final String scanBootstrap = properties.getProperty(TomEEJarScanner.class.getName() + ".scanBootstrapClassPath");
      if (scanBootstrap != null) {
        jarScanner.setScanBootstrapClassPath(Boolean.parseBoolean(scanBootstrap));
      }
      final JarScanFilter jarScanFilter = originalJarScanner.getJarScanFilter();
      if (jarScanFilter != null && Boolean.parseBoolean(properties.getProperty(TomEEJarScanner.class.getName() + ".useOriginalJarScannerFilter", "true"))) {
        jarScanner.setJarScanFilter(jarScanFilter);
      }
      standardContext.setJarScanner(jarScanner);
    }
  } catch (final Exception e) {
    // ignore
  }
}

代码示例来源:origin: org.apache.meecrowave/meecrowave-core

try {
  final OWBTomcatWebScannerService scannerService = OWBTomcatWebScannerService.class.cast(WebBeansContext.getInstance().getScannerService());
  scannerService.setFilter(ofNullable(context.getJarScanner()).map(JarScanner::getJarScanFilter).orElse(null), context.getServletContext());
  scannerService.setDocBase(context.getDocBase());
  scannerService.setShared(configuration.getSharedLibraries());

代码示例来源:origin: apache/meecrowave

try {
  final OWBTomcatWebScannerService scannerService = OWBTomcatWebScannerService.class.cast(WebBeansContext.getInstance().getScannerService());
  scannerService.setFilter(ofNullable(context.getJarScanner()).map(JarScanner::getJarScanFilter).orElse(null), context.getServletContext());
  scannerService.setDocBase(context.getDocBase());
  scannerService.setShared(configuration.getSharedLibraries());

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

@Override
public void addWepApp(WebApplication descriptor) {
  String contextPath = normalizeContextPath(descriptor.getContextPath());
  File home = Environment.getDefault().getHome();
  File docBase = new File(home, descriptor.getWebRoot());
  docBase.mkdirs(); // make sure the WAR root exists
  Context context = tomcat.addWebapp(contextPath, docBase.getAbsolutePath());
  StandardJarScanner jarScanner = (StandardJarScanner) context.getJarScanner();
  // avoid costly scanning, we register everything explicitly
  jarScanner.setScanManifest(false); // many MANIFEST.MF files have incorrect Class-Path
  jarScanner.setScanAllDirectories(false);
  jarScanner.setScanAllFiles(false);
  jarScanner.setScanBootstrapClassPath(false);
  jarScanner.setScanClassPath(false);
}

代码示例来源:origin: com.github.bordertech.lde/lde-tomcat

/**
 * Configure how to scan the jars in the tomcat classpath.
 *
 * @param context the server context
 * @throws IOException an IO Exception
 * @throws ServletException a servlet exception
 */
protected void configJarScanner(final Context context) throws IOException, ServletException {
  if (Didums.hasService(CustomJarScanner.class)) {
    context.setJarScanner(Didums.getService(CustomJarScanner.class));
  } else {
    // Scan for Annotations on Standard Scanner
    JarScanner scanner = context.getJarScanner();
    if (scanner instanceof StandardJarScanner) {
      StandardJarScanner std = (StandardJarScanner) scanner;
      std.setScanManifest(false);
      std.setScanAllFiles(true);
    }
  }
}

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

/**
 * Scan /META-INF/lib for JARs and for each one found add it and any
 * /META-INF/web-fragment.xml to the resulting Map. web-fragment.xml files
 * will be parsed before being added to the map. Every JAR will be added and
 * <code>null</code> will be used if no web-fragment.xml was found. Any JARs
 * known not contain fragments will be skipped.
 * 
 * @return A map of JAR name to processed web fragment (if any)
 */
protected Map<String,WebXml> processJarsForWebFragments() {
  
  JarScanner jarScanner = context.getJarScanner();
  FragmentJarScannerCallback callback = new FragmentJarScannerCallback();
  
  jarScanner.scan(context.getServletContext(),
      context.getLoader().getClassLoader(), callback, null);
  
  return callback.getFragments();
}

代码示例来源:origin: com.github.mjeanroy/junit-servers-tomcat

((StandardJarScanner) context.getJarScanner()).setScanAllDirectories(true);

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

/**
 * Scan /META-INF/lib for JARs and for each one found add it and any
 * /META-INF/web-fragment.xml to the resulting Map. web-fragment.xml files
 * will be parsed before being added to the map. Every JAR will be added and
 * <code>null</code> will be used if no web-fragment.xml was found. Any JARs
 * known not contain fragments will be skipped.
 * 
 * @return A map of JAR name to processed web fragment (if any)
 */
protected Map<String,WebXml> processJarsForWebFragments() {
  
  JarScanner jarScanner = context.getJarScanner();
  FragmentJarScannerCallback callback = new FragmentJarScannerCallback();
  
  jarScanner.scan(context.getServletContext(),
      context.getLoader().getClassLoader(), callback, null);
  
  return callback.getFragments();
}

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

/**
 * Scan /META-INF/lib for JARs and for each one found add it and any
 * /META-INF/web-fragment.xml to the resulting Map. web-fragment.xml files
 * will be parsed before being added to the map. Every JAR will be added and
 * <code>null</code> will be used if no web-fragment.xml was found. Any JARs
 * known not contain fragments will be skipped.
 * 
 * @return A map of JAR name to processed web fragment (if any)
 */
protected Map<String,WebXml> processJarsForWebFragments() {
  
  JarScanner jarScanner = context.getJarScanner();
  FragmentJarScannerCallback callback = new FragmentJarScannerCallback();
  
  jarScanner.scan(context.getServletContext(),
      context.getLoader().getClassLoader(), callback, null);
  
  return callback.getFragments();
}

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

/**
 * Scan /META-INF/lib for JARs and for each one found add it and any
 * /META-INF/web-fragment.xml to the resulting Map. web-fragment.xml files
 * will be parsed before being added to the map. Every JAR will be added and
 * <code>null</code> will be used if no web-fragment.xml was found. Any JARs
 * known not contain fragments will be skipped.
 * 
 * @return A map of JAR name to processed web fragment (if any)
 */
protected Map<String,WebXml> processJarsForWebFragments() {
  
  JarScanner jarScanner = context.getJarScanner();
  FragmentJarScannerCallback callback = new FragmentJarScannerCallback();
  
  jarScanner.scan(context.getServletContext(),
      context.getLoader().getClassLoader(), callback, null);
  
  return callback.getFragments();
}

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

/**
 * Scan /WEB-INF/lib for JARs and for each one found add it and any
 * /META-INF/web-fragment.xml to the resulting Map. web-fragment.xml files
 * will be parsed before being added to the map. Every JAR will be added and
 * <code>null</code> will be used if no web-fragment.xml was found. Any JARs
 * known not contain fragments will be skipped.
 *
 * @return A map of JAR name to processed web fragment (if any)
 */
protected Map<String,WebXml> processJarsForWebFragments() {
  JarScanner jarScanner = context.getJarScanner();
  FragmentJarScannerCallback callback = new FragmentJarScannerCallback();
  jarScanner.scan(context.getServletContext(),
      context.getLoader().getClassLoader(), callback,
      pluggabilityJarsToSkip);
  return callback.getFragments();
}

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

WebXmlParser webXmlParser) {
JarScanner jarScanner = context.getJarScanner();
boolean delegate = false;
if (context instanceof StandardContext) {

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

JarScanner jarScanner = context.getJarScanner();
boolean delegate = false;
if (context instanceof StandardContext) {

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

WebXmlParser webXmlParser) {
JarScanner jarScanner = context.getJarScanner();
boolean delegate = false;
if (context instanceof StandardContext) {

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

JarScanner jarScanner = context.getJarScanner();
jarScanner.scan(context.getServletContext(),
    context.getLoader().getClassLoader(),

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

JarScanner jarScanner = context.getJarScanner();
jarScanner.scan(context.getServletContext(),
    context.getLoader().getClassLoader(),

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

JarScanner jarScanner = context.getJarScanner();
jarScanner.scan(context.getServletContext(),
    context.getLoader().getClassLoader(),

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

JarScanner jarScanner = context.getJarScanner();
jarScanner.scan(context.getServletContext(),
    context.getLoader().getClassLoader(),

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

JarScanner jarScanner = context.getJarScanner();
jarScanner.scan(context.getServletContext(),
    context.getLoader().getClassLoader(),

相关文章

微信公众号

最新文章

更多

Context类方法