本文整理汇总了Java中org.apache.tomcat.JarScanner类的典型用法代码示例。如果您正苦于以下问题:Java JarScanner类的具体用法?Java JarScanner怎么用?Java JarScanner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JarScanner类属于org.apache.tomcat包,在下文中一共展示了JarScanner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processJarsForWebFragments
import org.apache.tomcat.JarScanner; //导入依赖的package包/类
/**
* 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(WebXml application) {
JarScanner jarScanner = context.getJarScanner();
boolean parseRequired = true;
Set<String> absoluteOrder = application.getAbsoluteOrdering();
if (absoluteOrder != null && absoluteOrder.isEmpty() &&
!context.getXmlValidation()) {
// Skip parsing when there is an empty absolute ordering and
// validation is not enabled
parseRequired = false;
}
FragmentJarScannerCallback callback =
new FragmentJarScannerCallback(parseRequired);
jarScanner.scan(context.getServletContext(),
context.getLoader().getClassLoader(), callback,
pluggabilityJarsToSkip);
return callback.getFragments();
}
示例2: init
import org.apache.tomcat.JarScanner; //导入依赖的package包/类
private synchronized void init() throws JasperException {
if (initialized) return;
try {
tldScanWebXml();
tldScanResourcePaths(WEB_INF);
JarScanner jarScanner = JarScannerFactory.getJarScanner(ctxt);
jarScanner.scan(ctxt,
Thread.currentThread().getContextClassLoader(),
new TldJarScannerCallback(), noTldJars);
initialized = true;
} catch (Exception ex) {
throw new JasperException(Localizer.getMessage(
"jsp.error.internal.tldinit", ex.getMessage()), ex);
}
}
示例3: processJarsForWebFragments
import org.apache.tomcat.JarScanner; //导入依赖的package包/类
/**
*
* 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(WebXml application) {
// StandardJarScanner
JarScanner jarScanner = context.getJarScanner();
boolean parseRequired = true;
Set<String> absoluteOrder = application.getAbsoluteOrdering();
if (absoluteOrder != null && absoluteOrder.isEmpty() &&
!context.getXmlValidation()) {
// Skip parsing when there is an empty absolute ordering and
// validation is not enabled
parseRequired = false;
}
FragmentJarScannerCallback callback =
new FragmentJarScannerCallback(parseRequired);
jarScanner.scan(context.getServletContext(),
context.getLoader().getClassLoader(), callback,
pluggabilityJarsToSkip);
return callback.getFragments();
}
示例4: processJarsForWebFragments
import org.apache.tomcat.JarScanner; //导入依赖的package包/类
/**
* 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(WebXml application) {
JarScanner jarScanner = context.getJarScanner();
boolean parseRequired = true;
Set<String> absoluteOrder = application.getAbsoluteOrdering();
if (absoluteOrder != null && absoluteOrder.isEmpty() && !context.getXmlValidation()) {
// Skip parsing when there is an empty absolute ordering and
// validation is not enabled
parseRequired = false;
}
FragmentJarScannerCallback callback = new FragmentJarScannerCallback(parseRequired);
jarScanner.scan(context.getServletContext(), context.getLoader().getClassLoader(), callback,
pluggabilityJarsToSkip);
return callback.getFragments();
}
示例5: init
import org.apache.tomcat.JarScanner; //导入依赖的package包/类
private synchronized void init() throws JasperException {
if (initialized)
return;
try {
tldScanWebXml();
tldScanResourcePaths(WEB_INF);
JarScanner jarScanner = JarScannerFactory.getJarScanner(ctxt);
jarScanner.scan(ctxt, Thread.currentThread().getContextClassLoader(), new TldJarScannerCallback(),
noTldJars);
initialized = true;
} catch (Exception ex) {
throw new JasperException(Localizer.getMessage("jsp.error.internal.tldinit", ex.getMessage()), ex);
}
}
示例6: init
import org.apache.tomcat.JarScanner; //导入依赖的package包/类
private synchronized void init() throws JasperException {
if (initialized) return;
try {
tldScanWebXml();
tldScanResourcePaths(WEB_INF);
JarScanner jarScanner = JarScannerFactory.getJarScanner(ctxt);
if (jarScanner != null) {
jarScanner.scan(ctxt,
Thread.currentThread().getContextClassLoader(),
new TldJarScannerCallback(), noTldJars);
}
initialized = true;
} catch (Exception ex) {
throw new JasperException(Localizer.getMessage(
"jsp.error.internal.tldinit", ex.getMessage()), ex);
}
}
示例7: startTomcat
import org.apache.tomcat.JarScanner; //导入依赖的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();
}
示例8: servletContainer
import org.apache.tomcat.JarScanner; //导入依赖的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;
}
示例9: scanJars
import org.apache.tomcat.JarScanner; //导入依赖的package包/类
/**
* Scan for TLDs in JARs in /WEB-INF/lib.
*/
public void scanJars() {
JarScanner scanner = JarScannerFactory.getJarScanner(context);
TldScannerCallback callback = new TldScannerCallback();
scanner.scan(JarScanType.TLD, context, callback);
if (callback.scanFoundNoTLDs()) {
log.info(Localizer.getMessage("jsp.tldCache.noTldSummary"));
}
}
示例10: processJarsForWebFragments
import org.apache.tomcat.JarScanner; //导入依赖的package包/类
/**
* 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();
}
示例11: configureJarScanner
import org.apache.tomcat.JarScanner; //导入依赖的package包/类
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
}
}
示例12: getJarScanner
import org.apache.tomcat.JarScanner; //导入依赖的package包/类
@Override
public JarScanner getJarScanner() { return null; }
示例13: setJarScanner
import org.apache.tomcat.JarScanner; //导入依赖的package包/类
@Override
public void setJarScanner(JarScanner jarScanner) { /* NO-OP */ }
示例14: execute
import org.apache.tomcat.JarScanner; //导入依赖的package包/类
/**
* Scan for and configure all tag library descriptors found in this
* web application.
*
* This supports a Tomcat-specific extension to the TLD search
* order defined in the JSP spec. It allows tag libraries packaged as JAR
* files to be shared by web applications by simply dropping them in a
* location that all web applications have access to (e.g.,
* <CATALINA_HOME>/lib). It also supports some of the weird and
* wonderful arrangements present when Tomcat gets embedded.
*
* The set of shared JARs to be scanned for TLDs is narrowed down by
* the <tt>noTldJars</tt> class variable, which contains the names of JARs
* that are known not to contain any TLDs.
*/
@SuppressWarnings("deprecation") // Context.addApplicationListener(ApplicationListener) is deprecated.
public void execute() {
long t1=System.currentTimeMillis();
/*
* Priority order of URIs required by spec is:
* 1. J2EE platform taglibs - Tomcat doesn't provide these
* 2. web.xml entries
* 3. JARS in WEB-INF/lib & TLDs under WEB-INF (equal priority)
* 4. Additional entries from the container
*
* Keep processing order in sync with o.a.j.compiler.TldLocationsCache
*/
// Stage 2 - web.xml entries
tldScanWebXml();
// Stage 3a - TLDs under WEB-INF (not lib or classes)
tldScanResourcePaths(WEB_INF);
// Stages 3b & 4
JarScanner jarScanner = context.getJarScanner();
TldJarScannerCallback tldCallBack = new TldJarScannerCallback();
jarScanner.scan(context.getServletContext(), context.getLoader().getClassLoader(),
tldCallBack, noTldJars);
if(tldCallBack.scanFoundNoTLDs()){
log.info(sm.getString("tldConfig.noTldSummary"));
}
// Now add all the listeners we found to the listeners for this context
String list[] = getTldListeners();
if( log.isDebugEnabled() )
log.debug(sm.getString("tldConfig.addListeners",
Integer.valueOf(list.length)));
for( int i=0; i<list.length; i++ ) {
context.addApplicationListener(
new ApplicationListener(list[i], true));
}
long t2=System.currentTimeMillis();
if( context instanceof StandardContext ) {
((StandardContext)context).setTldScanTime(t2-t1);
}
}
示例15: setJarScanner
import org.apache.tomcat.JarScanner; //导入依赖的package包/类
@Override
public void setJarScanner(JarScanner jarScanner) {
this.jarScanner = jarScanner;
}