Search in sources :

Example 6 with JarScanner

use of org.apache.tomcat.JarScanner in project tomcat by apache.

the class ContextConfig method processJarsForWebFragments.

/**
     * 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.
     *
     * @param application The main web.xml metadata
     * @param webXmlParser The parser to use to process the web.xml file
     * @return A map of JAR name to processed web fragment (if any)
     */
protected Map<String, WebXml> processJarsForWebFragments(WebXml application, WebXmlParser webXmlParser) {
    JarScanner jarScanner = context.getJarScanner();
    boolean delegate = false;
    if (context instanceof StandardContext) {
        delegate = ((StandardContext) context).getDelegate();
    }
    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(webXmlParser, delegate, parseRequired);
    jarScanner.scan(JarScanType.PLUGGABILITY, context.getServletContext(), callback);
    if (!callback.isOk()) {
        ok = false;
    }
    return callback.getFragments();
}
Also used : StandardContext(org.apache.catalina.core.StandardContext) FragmentJarScannerCallback(org.apache.tomcat.util.descriptor.web.FragmentJarScannerCallback) JarScanner(org.apache.tomcat.JarScanner)

Aggregations

JarScanner (org.apache.tomcat.JarScanner)6 StandardContext (org.apache.catalina.core.StandardContext)2 JarScanFilter (org.apache.tomcat.JarScanFilter)2 StandardJarScanner (org.apache.tomcat.util.scan.StandardJarScanner)2 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 LifecycleListener (org.apache.catalina.LifecycleListener)1 Loader (org.apache.catalina.Loader)1 Manager (org.apache.catalina.Manager)1 Realm (org.apache.catalina.Realm)1 Valve (org.apache.catalina.Valve)1 WebResourceRoot (org.apache.catalina.WebResourceRoot)1 ThreadLocalLeakPreventionListener (org.apache.catalina.core.ThreadLocalLeakPreventionListener)1 NamingResourcesImpl (org.apache.catalina.deploy.NamingResourcesImpl)1 ApplicationParameter (org.apache.tomcat.util.descriptor.web.ApplicationParameter)1 FragmentJarScannerCallback (org.apache.tomcat.util.descriptor.web.FragmentJarScannerCallback)1 CookieProcessor (org.apache.tomcat.util.http.CookieProcessor)1