protected void processClasses(WebXml webXml, Set<WebXml> orderedFragments) { // Step 4. Process /WEB-INF/classes for annotations and // @HandlesTypes matches Map<String, JavaClassCacheEntry> javaClassCache = new HashMap<>(); if (ok) { WebResource[] webResources = context.getResources().listResources("/WEB-INF/classes"); for (WebResource webResource : webResources) { // Skip the META-INF directory from any JARs that have been // expanded in to WEB-INF/classes (sometimes IDEs do this). if ("META-INF".equals(webResource.getName())) { continue; } processAnnotationsWebResource(webResource, webXml, webXml.isMetadataComplete(), javaClassCache); } } // Step 5. Process JARs for annotations and // @HandlesTypes matches - only need to process those fragments we // are going to use (remember orderedFragments includes any // container fragments) if (ok) { processAnnotations( orderedFragments, webXml.isMetadataComplete(), javaClassCache); } // Cache, if used, is no longer required so clear it javaClassCache.clear(); }
@Override public void begin(String namespace, String name, Attributes attributes) throws Exception { WebXml webxml = (WebXml) digester.peek(digester.getCount() - 1); String value = attributes.getValue("metadata-complete"); if ("true".equals(value)) { webxml.setMetadataComplete(true); } else if ("false".equals(value)) { webxml.setMetadataComplete(false); } if (digester.getLogger().isDebugEnabled()) { digester.getLogger().debug (webxml.getClass().getName() + ".setMetadataComplete( " + webxml.isMetadataComplete() + ")"); } }
@Override public void begin(String namespace, String name, Attributes attributes) throws Exception { WebXml webxml = (WebXml) digester.peek(digester.getCount() - 1); String value = attributes.getValue("metadata-complete"); if ("true".equals(value)) { webxml.setMetadataComplete(true); } else if ("false".equals(value)) { webxml.setMetadataComplete(false); } if (digester.getLogger().isDebugEnabled()) { digester.getLogger().debug (webxml.getClass().getName() + ".setMetadataComplete( " + webxml.isMetadataComplete() + ")"); } }
@Override public void begin(String namespace, String name, Attributes attributes) throws Exception { WebXml webxml = (WebXml) digester.peek(digester.getCount() - 1); String value = attributes.getValue("metadata-complete"); if ("true".equals(value)) { webxml.setMetadataComplete(true); } else if ("false".equals(value)) { webxml.setMetadataComplete(false); } if (digester.getLogger().isDebugEnabled()) { digester.getLogger().debug (webxml.getClass().getName() + ".setMetadataComplete( " + webxml.isMetadataComplete() + ")"); } }
protected void processAnnotations(Set<WebXml> fragments, boolean handlesTypesOnly, Map<String,JavaClassCacheEntry> javaClassCache) { for(WebXml fragment : fragments) { // Only need to scan for @HandlesTypes matches if any of the // following are true: // - it has already been determined only @HandlesTypes is required // (e.g. main web.xml has metadata-complete="true" // - this fragment is for a container JAR (Servlet 3.1 section 8.1) // - this fragment has metadata-complete="true" boolean htOnly = handlesTypesOnly || !fragment.getWebappJar() || fragment.isMetadataComplete(); WebXml annotations = new WebXml(); // no impact on distributable annotations.setDistributable(true); URL url = fragment.getURL(); processAnnotationsUrl(url, annotations, htOnly, javaClassCache); Set<WebXml> set = new HashSet<>(); set.add(annotations); // Merge annotations into fragment - fragment takes priority fragment.merge(set); } }
protected void processAnnotations(Set<WebXml> fragments, boolean handlesTypesOnly) { for(WebXml fragment : fragments) { // Only need to scan for @HandlesTypes matches if any of the // following are true: // - it has already been determined only @HandlesTypes is required // (e.g. main web.xml has metadata-complete="true" // - this fragment is for a container JAR (Servlet 3.1 section 8.1) // - this fragment has metadata-complete="true" boolean htOnly = handlesTypesOnly || !fragment.getWebappJar() || fragment.isMetadataComplete(); WebXml annotations = new WebXml(); // no impact on distributable annotations.setDistributable(true); URL url = fragment.getURL(); processAnnotationsUrl(url, annotations, htOnly); Set<WebXml> set = new HashSet<>(); set.add(annotations); // Merge annotations into fragment - fragment takes priority fragment.merge(set); } }
protected void processAnnotations(Set<WebXml> fragments, boolean handlesTypesOnly, Map<String,JavaClassCacheEntry> javaClassCache) { for(WebXml fragment : fragments) { // Only need to scan for @HandlesTypes matches if any of the // following are true: // - it has already been determined only @HandlesTypes is required // (e.g. main web.xml has metadata-complete="true" // - this fragment is for a container JAR (Servlet 3.1 section 8.1) // - this fragment has metadata-complete="true" boolean htOnly = handlesTypesOnly || !fragment.getWebappJar() || fragment.isMetadataComplete(); WebXml annotations = new WebXml(); // no impact on distributable annotations.setDistributable(true); URL url = fragment.getURL(); processAnnotationsUrl(url, annotations, htOnly, javaClassCache); Set<WebXml> set = new HashSet<>(); set.add(annotations); // Merge annotations into fragment - fragment takes priority fragment.merge(set); } }
if (!webXml.isMetadataComplete() || typeInitializerMap.size() > 0) { webXml.isMetadataComplete()); orderedFragments, webXml.isMetadataComplete()); if (!webXml.isMetadataComplete()) {
if (webXml.isMetadataComplete()) { return webXml;
if (!webXml.isMetadataComplete() || typeInitializerMap.size() > 0) { webXml.isMetadataComplete(), javaClassCache); orderedFragments, webXml.isMetadataComplete(), javaClassCache); if (!webXml.isMetadataComplete()) {
if (webXml.isMetadataComplete()) { return webXml;
if (!webXml.isMetadataComplete() || typeInitializerMap.size() > 0) { if (!webXml.isMetadataComplete()) {
context.setIgnoreAnnotations(webxml.isMetadataComplete()); for (Entry<String, String> entry : webxml.getMimeMappings().entrySet()) {
context.setIgnoreAnnotations(webxml.isMetadataComplete()); for (Entry<String, String> entry : webxml.getMimeMappings().entrySet()) {
context.setIgnoreAnnotations(webxml.isMetadataComplete()); for (Entry<String, String> entry : webxml.getMimeMappings().entrySet()) {