use of org.apache.tomcat.util.scan.StandardJarScanFilter in project tomcat by apache.
the class TomcatBaseTest method getTomcatInstanceTestWebapp.
/**
* Make the Tomcat instance preconfigured with test/webapp available to
* sub-classes.
* @param addJstl Should JSTL support be added to the test webapp
* @param start Should the Tomcat instance be started
*
* @return A Tomcat instance pre-configured with the web application located
* at test/webapp
*
* @throws LifecycleException If a problem occurs while starting the
* instance
*/
public Tomcat getTomcatInstanceTestWebapp(boolean addJstl, boolean start) throws LifecycleException {
File appDir = new File("test/webapp");
Context ctx = tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
StandardJarScanner scanner = (StandardJarScanner) ctx.getJarScanner();
StandardJarScanFilter filter = (StandardJarScanFilter) scanner.getJarScanFilter();
filter.setTldSkip(filter.getTldSkip() + ",testclasses");
filter.setPluggabilitySkip(filter.getPluggabilitySkip() + ",testclasses");
if (addJstl) {
File lib = new File("webapps/examples/WEB-INF/lib");
ctx.setResources(new StandardRoot(ctx));
ctx.getResources().createWebResourceSet(WebResourceRoot.ResourceSetType.POST, "/WEB-INF/lib", lib.getAbsolutePath(), null, "/");
}
if (start) {
tomcat.start();
}
return tomcat;
}
use of org.apache.tomcat.util.scan.StandardJarScanFilter in project tomcat by apache.
the class JspCServletContext method scanForFragments.
private Map<String, WebXml> scanForFragments(WebXmlParser webXmlParser) throws JasperException {
StandardJarScanner scanner = new StandardJarScanner();
// TODO - enabling this means initializing the classloader first in JspC
scanner.setScanClassPath(false);
// TODO - configure filter rules from Ant rather then system properties
scanner.setJarScanFilter(new StandardJarScanFilter());
FragmentJarScannerCallback callback = new FragmentJarScannerCallback(webXmlParser, false, true);
scanner.scan(JarScanType.PLUGGABILITY, this, callback);
if (!callback.isOk()) {
throw new JasperException(Localizer.getMessage("jspc.error.invalidFragment"));
}
return callback.getFragments();
}
use of org.apache.tomcat.util.scan.StandardJarScanFilter in project tomcat by apache.
the class TomcatBaseTest method skipTldsForResourceJars.
public static void skipTldsForResourceJars(Context context) {
StandardJarScanner scanner = (StandardJarScanner) context.getJarScanner();
StandardJarScanFilter filter = (StandardJarScanFilter) scanner.getJarScanFilter();
filter.setTldSkip(filter.getTldSkip() + ",resources*.jar");
}
Aggregations