org.apache.tomcat.JarScanFilter Java Examples

The following examples show how to use org.apache.tomcat.JarScanFilter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TomcatHelper.java    From tomee with Apache License 2.0 5 votes vote down vote up
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
    }
}
 
Example #2
Source File: TomEEJarScanner.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
public void setJarScanFilter(final JarScanFilter jarScanFilter) {
    super.setJarScanFilter(jarScanFilter);
    if (!TomEEFilter.class.isInstance(jarScanFilter)) {
        configureFilter(jarScanFilter);
    }
}
 
Example #3
Source File: OWBTomcatWebScannerService.java    From openwebbeans-meecrowave with Apache License 2.0 5 votes vote down vote up
public void setFilter(final JarScanFilter filter, final ServletContext ctx) {
    this.filter = filter;

    super.init(ctx);
    final Configuration config = Configuration.class.cast(ServletContext.class.cast(ctx).getAttribute("meecrowave.configuration"));
    if (this.filter == null) {
        this.filter = new KnownJarsFilter(config);
    }

    final Filter userFilter = webBeansContext().getService(Filter.class);
    if (KnownClassesFilter.class.isInstance(userFilter)) {
        KnownClassesFilter.class.cast(userFilter).init(config);
    }
}
 
Example #4
Source File: OWBJarScanner.java    From openwebbeans-meecrowave with Apache License 2.0 4 votes vote down vote up
@Override
public JarScanFilter getJarScanFilter() {
    return filter;
}
 
Example #5
Source File: TomEEJarScanner.java    From tomee with Apache License 2.0 4 votes vote down vote up
public JarScanFilter getDelegate() {
    return delegate;
}
 
Example #6
Source File: TomEEJarScanner.java    From tomee with Apache License 2.0 4 votes vote down vote up
public TomEEFilter(final JarScanFilter jarScanFilter) {
    this.delegate = jarScanFilter;
}
 
Example #7
Source File: TomEEJarScanner.java    From tomee with Apache License 2.0 4 votes vote down vote up
private void configureFilter(final JarScanFilter jarScanFilter) {
    setJarScanFilter(new TomEEFilter(jarScanFilter));
}
 
Example #8
Source File: EmptyScanner.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Override
public void setJarScanFilter(final JarScanFilter jarScanFilter) {
    this.scanner = jarScanFilter;
}
 
Example #9
Source File: EmptyScanner.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Override
public JarScanFilter getJarScanFilter() {
    return scanner;
}
 
Example #10
Source File: OWBJarScanner.java    From openwebbeans-meecrowave with Apache License 2.0 4 votes vote down vote up
@Override
public void setJarScanFilter(final JarScanFilter jarScanFilter) {
    this.filter = jarScanFilter;
}
 
Example #11
Source File: EmbededStandardJarScanner.java    From executable-embeded-tomcat-sample with Apache License 2.0 4 votes vote down vote up
@Override
public void setJarScanFilter(JarScanFilter jarScanFilter) {
	this.jarScanFilter = jarScanFilter;
}
 
Example #12
Source File: EmbededStandardJarScanner.java    From executable-embeded-tomcat-sample with Apache License 2.0 4 votes vote down vote up
@Override
public JarScanFilter getJarScanFilter() {
	return jarScanFilter;
}
 
Example #13
Source File: FatJarScanner.java    From oxygen with Apache License 2.0 4 votes vote down vote up
@Override
public void setJarScanFilter(JarScanFilter jarScanFilter) {
  this.jarScanFilter = jarScanFilter;
}
 
Example #14
Source File: FatJarScanner.java    From oxygen with Apache License 2.0 4 votes vote down vote up
@Override
public JarScanFilter getJarScanFilter() {
  return jarScanFilter;
}
 
Example #15
Source File: StandardJarScanner.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
@Override
public void setJarScanFilter(JarScanFilter jarScanFilter) {
    this.jarScanFilter = jarScanFilter;
}
 
Example #16
Source File: StandardJarScanner.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
@Override
public JarScanFilter getJarScanFilter() {
    return jarScanFilter;
}
 
Example #17
Source File: JarScannerSF.java    From Tomcat8-Source-Read with MIT License 3 votes vote down vote up
/**
 * Store the specified JarScanner properties and children
 * (JarScannerFilter)
 *
 * @param aWriter
 *            PrintWriter to which we are storing
 * @param indent
 *            Number of spaces to indent this element
 * @param aJarScanner
 *            JarScanner whose properties are being stored
 *
 * @exception Exception
 *                if an exception occurs while storing
 */
@Override
public void storeChildren(PrintWriter aWriter, int indent, Object aJarScanner,
        StoreDescription parentDesc) throws Exception {
    if (aJarScanner instanceof JarScanner) {
        JarScanner jarScanner = (JarScanner) aJarScanner;
        // Store nested <JarScanFilter> element
        JarScanFilter jarScanFilter = jarScanner.getJarScanFilter();
        if (jarScanFilter != null) {
            storeElement(aWriter, indent, jarScanFilter);
        }
    }
}