本文整理汇总了Java中org.apache.tomcat.JarScannerCallback类的典型用法代码示例。如果您正苦于以下问题:Java JarScannerCallback类的具体用法?Java JarScannerCallback怎么用?Java JarScannerCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JarScannerCallback类属于org.apache.tomcat包,在下文中一共展示了JarScannerCallback类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startTomcat
import org.apache.tomcat.JarScannerCallback; //导入依赖的package包/类
@BeforeClass
public static void startTomcat() throws ServletException, LifecycleException {
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
tomcat = new Tomcat();
tomcat.setPort(8081);
tomcat.setBaseDir(".");
Context ctx = tomcat.addWebapp("/", "src/main/webapp");
ctx.setJarScanner(new JarScanner() {
@Override
public void scan(ServletContext context, ClassLoader classloader, JarScannerCallback callback, Set<String> jarsToSkip) {
}
});
((Host) ctx.getParent()).setAppBase("");
tomcat.start();
server = tomcat.getServer();
server.start();
}
示例2: servletContainer
import org.apache.tomcat.JarScannerCallback; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
MockService config = MockService.getInstance();
factory.setPort(config.getPort());
factory.setSessionTimeout(10, TimeUnit.MINUTES);
factory.addContextCustomizers(new TomcatContextCustomizer() {
@Override
public void customize(Context context) {
JarScanner jarScanner = new JarScanner() {
@Override
public void scan(ServletContext arg0, ClassLoader arg1,
JarScannerCallback arg2, Set<String> arg3) {
}
};
context.setJarScanner(jarScanner);
}
});
return factory;
}
示例3: scan
import org.apache.tomcat.JarScannerCallback; //导入依赖的package包/类
@Override
public void scan(final JarScanType scanType, final ServletContext context, final JarScannerCallback callback) {
super.scan(scanType, context, callback);
if (!embeddedSurefireScanning(scanType, context, callback) && isScanClassPath() && !URLClassLoader.class.isInstance(getSystemClassLoader())
&& !Boolean.getBoolean("tomee.classpath.scanning.disabled")) {
// TODO: check on tomcat upgrade if it is fixed
final String cp = System.getProperty("java.class.path");
final Collection<URL> urls = new HashSet<>();
for (final String jar : cp.split(File.pathSeparator)) {
try {
urls.add(new File(jar).toURI().toURL());
} catch (MalformedURLException e) {
// no-op
}
}
doScan(scanType, callback, new LinkedList<>(urls));
}
}
示例4: doScan
import org.apache.tomcat.JarScannerCallback; //导入依赖的package包/类
private void doScan(final JarScanType scanType, final JarScannerCallback callback, final Deque<URL> urls) {
Method process = null;
final boolean scanAllDirectories = isScanAllDirectories();
for (final URL url : urls) {
final File cpe = URLs.toFile(url);
if ((cpe.getName().endsWith(".jar") ||
scanType == JarScanType.PLUGGABILITY ||
scanAllDirectories) &&
getJarScanFilter().check(scanType, cpe.getName())) {
try {
if (process == null) {
process = StandardJarScanner.class.getDeclaredMethod("process",
JarScanType.class, JarScannerCallback.class, URL.class, String.class, boolean.class, Deque.class);
if (!process.isAccessible()) {
process.setAccessible(true);
}
}
process.invoke(this, scanType, callback, url, null, true, urls);
} catch (final Exception ioe) {
// no-op
}
}
}
}
示例5: scan
import org.apache.tomcat.JarScannerCallback; //导入依赖的package包/类
public void scan(ServletContext context, ClassLoader classloader,
JarScannerCallback callback, Set<String> jarsToSkip) {
Method scanMethod = ReflectionUtils.findMethod(this.jarScanner.getClass(), "scan",
ServletContext.class, ClassLoader.class, JarScannerCallback.class,
Set.class);
Assert.notNull(scanMethod, "Unable to find scan method");
try {
scanMethod.invoke(this.jarScanner, context, classloader, callback,
(jarsToSkip == null ? this.pattern.asSet() : jarsToSkip));
}
catch (Exception ex) {
throw new IllegalStateException("Tomcat 7 reflection failed", ex);
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:SkipPatternJarScanner.java
示例6: embeddedSurefireScanning
import org.apache.tomcat.JarScannerCallback; //导入依赖的package包/类
private boolean embeddedSurefireScanning(final JarScanType scanType, final ServletContext context, final JarScannerCallback callback) {
if (isScanClassPath() && System.getProperty("surefire.real.class.path") != null) {
try {
final Set<URL> urls = ClassLoaders.findUrls(context.getClassLoader().getParent());
doScan(scanType, callback, new LinkedList<>(urls));
return true;
} catch (final IOException e) {
// no-op
}
}
return false;
}
示例7: scan
import org.apache.tomcat.JarScannerCallback; //导入依赖的package包/类
@Override
public void scan(JarScanType scanType, ServletContext context, JarScannerCallback callback) {
}
示例8: init
import org.apache.tomcat.JarScannerCallback; //导入依赖的package包/类
@BeforeClass
public static void init() throws LifecycleException, ServletException {
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
tomcat = new Tomcat();
tomcat.setPort(8080);
tomcat.setBaseDir(".");
Context ctx = tomcat.addWebapp("", "src/test");
ctx.setJarScanner(new JarScanner() {
@Override
public void scan(JarScanType jarScanType, ServletContext servletContext, JarScannerCallback jarScannerCallback) {
}
@Override
public JarScanFilter getJarScanFilter() {
return null;
}
@Override
public void setJarScanFilter(JarScanFilter jarScanFilter) {
}
});
((Host) ctx.getParent()).setAppBase("");
final Wrapper multiRaml = ctx.createWrapper();
multiRaml.setServletClass(RamlDocServlet.class.getName());
multiRaml.setName("app");
multiRaml.addInitParameter("ramlLocations", "classpath://data/basic.raml,classpath://data/second.raml,classpath://data/markdown.raml");
multiRaml.addInitParameter("features", "online,tryout,download,docson");
multiRaml.addInitParameter("baseUriParameters", "host=$host/$path,path=mirror");
multiRaml.addInitParameter("customization", "classpath://");
ctx.addChild(multiRaml);
ctx.addServletMapping("/api/*", "app");
final Wrapper singleRaml = ctx.createWrapper();
singleRaml.setServletClass(RamlDocServlet.class.getName());
singleRaml.setName("sapp");
singleRaml.addInitParameter("ramlLocations", "classpath://data/basic.raml");
singleRaml.addInitParameter("features", "online");
singleRaml.addInitParameter("baseUriParameters", "host=$host/$path,path=mirror");
ctx.addChild(singleRaml);
ctx.addServletMapping("/sapi/*", "sapp");
Tomcat.addServlet(ctx, "mirror", new MirrorServlet());
ctx.addServletMapping("/mirror/v1/*", "mirror");
tomcat.start();
Server server = tomcat.getServer();
server.start();
}
示例9: scan
import org.apache.tomcat.JarScannerCallback; //导入依赖的package包/类
@Override
public void scan(ServletContext context, ClassLoader classloader, JarScannerCallback callback, Set<String> jarsToSkip) {
}
示例10: scan
import org.apache.tomcat.JarScannerCallback; //导入依赖的package包/类
@Override
public void scan(final JarScanType scanType, final ServletContext context,
final JarScannerCallback callback) {
// no-op
}