@Override public void begin(String namespace, String name, Attributes attributes) throws Exception { WebXml webXml = (WebXml) digester.peek(); webXml.setDistributable(true); if (digester.getLogger().isDebugEnabled()) { digester.getLogger().debug (webXml.getClass().getName() + ".setDistributable(true)"); } } }
@Override public void begin(String namespace, String name, Attributes attributes) throws Exception { WebXml webXml = (WebXml) digester.peek(); webXml.setDistributable(true); if (digester.getLogger().isDebugEnabled()) { digester.getLogger().debug (webXml.getClass().getName() + ".setDistributable(true)"); } } }
@Override public void begin(String namespace, String name, Attributes attributes) throws Exception { WebXml webXml = (WebXml) digester.peek(); webXml.setDistributable(true); if (digester.getLogger().isDebugEnabled()) { digester.getLogger().debug (webXml.getClass().getName() + ".setDistributable(true)"); } } }
@Override public void scan(File file, String webappPath, boolean isWebapp) throws IOException { InputStream stream = null; WebXml fragment = new WebXml(); fragment.setWebappJar(isWebapp); fragment.setDelegate(delegate); try { File fragmentFile = new File(file, FRAGMENT_LOCATION); if (fragmentFile.isFile()) { stream = new FileInputStream(fragmentFile); InputSource source = new InputSource(fragmentFile.toURI().toURL().toString()); source.setByteStream(stream); if (!webXmlParser.parseWebXml(source, fragment, true)) { ok = false; } } else { // If there is no web.xml, normal folder no impact on // distributable fragment.setDistributable(true); } } finally { fragment.setURL(file.toURI().toURL()); if (fragment.getName() == null) { fragment.setName(fragment.getURL().toString()); } fragment.setJarName(file.getName()); fragments.put(fragment.getName(), fragment); } }
@Override protected void processClasses(final WebXml webXml, final Set<WebXml> orderedFragments) { final ClassLoader loader = context.getLoader().getClassLoader(); orderedFragments.forEach(fragment -> { final WebXml annotations = new WebXml(); annotations.setDistributable(true); final URL url = fragment.getURL(); final Collection<Class<?>> classes = webClasses.get(url.toExternalForm()); if (classes == null) { return; } classes.forEach(clazz -> { try (final InputStream stream = loader.getResourceAsStream(clazz.getName().replace('.', '/') + ".class")) { processClass(annotations, new ClassParser(stream).parse()); } catch (final IOException e) { new LogFacade(MeecrowaveContextConfig.class.getName()).error("Can't parse " + clazz); } }); fragment.merge(singleton(annotations)); }); }
@Override public void scan(File file, String webappPath, boolean isWebapp) throws IOException { WebXml fragment = new WebXml(); fragment.setWebappJar(isWebapp); fragment.setDelegate(delegate); File fragmentFile = new File(file, FRAGMENT_LOCATION); try { if (fragmentFile.isFile()) { try (InputStream stream = new FileInputStream(fragmentFile)) { InputSource source = new InputSource(fragmentFile.toURI().toURL().toString()); source.setByteStream(stream); if (!webXmlParser.parseWebXml(source, fragment, true)) { ok = false; } } } else { // If there is no web.xml, normal folder no impact on // distributable fragment.setDistributable(true); } } finally { fragment.setURL(file.toURI().toURL()); if (fragment.getName() == null) { fragment.setName(fragment.getURL().toString()); } fragment.setJarName(file.getName()); fragments.put(fragment.getName(), fragment); } }
@Override protected void processClasses(final WebXml webXml, final Set<WebXml> orderedFragments) { final ClassLoader loader = context.getLoader().getClassLoader(); orderedFragments.forEach(fragment -> { final WebXml annotations = new WebXml(); annotations.setDistributable(true); final URL url = fragment.getURL(); final Collection<Class<?>> classes = webClasses.get(url.toExternalForm()); if (classes == null) { return; } classes.forEach(clazz -> { try (final InputStream stream = loader.getResourceAsStream(clazz.getName().replace('.', '/') + ".class")) { processClass(annotations, new ClassParser(stream).parse()); } catch (final IOException e) { new LogFacade(MeecrowaveContextConfig.class.getName()).error("Can't parse " + clazz); } }); fragment.merge(singleton(annotations)); }); }
@Override public void scan(File file, String webappPath, boolean isWebapp) throws IOException { WebXml fragment = new WebXml(); fragment.setWebappJar(isWebapp); fragment.setDelegate(delegate); File fragmentFile = new File(file, FRAGMENT_LOCATION); try { if (fragmentFile.isFile()) { try (InputStream stream = new FileInputStream(fragmentFile)) { InputSource source = new InputSource(fragmentFile.toURI().toURL().toString()); source.setByteStream(stream); if (!webXmlParser.parseWebXml(source, fragment, true)) { ok = false; } } } else { // If there is no web.xml, normal folder no impact on // distributable fragment.setDistributable(true); } } finally { fragment.setURL(file.toURI().toURL()); if (fragment.getName() == null) { fragment.setName(fragment.getURL().toString()); } fragment.setJarName(file.getName()); fragments.put(fragment.getName(), fragment); } }
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); } }
private WebXml getTomcatWebXmlFragment(WebXmlParser webXmlParser) { WebXml webXmlTomcatFragment = createWebXml(); webXmlTomcatFragment.setOverridable(true); // Set to distributable else every app will be prevented from being // distributable when the Tomcat fragment is merged with the main // web.xml webXmlTomcatFragment.setDistributable(true); // When merging, the default welcome files are only used if the app has // not defined any welcomes files. webXmlTomcatFragment.setAlwaysAddWelcomeFiles(false); WebResource resource = context.getResources().getResource(Constants.TomcatWebXml); if (resource.isFile()) { try { InputSource source = new InputSource(resource.getURL().toURI().toString()); source.setByteStream(resource.getInputStream()); if (!webXmlParser.parseWebXml(source, webXmlTomcatFragment, false)) { ok = false; } } catch (URISyntaxException e) { log.error(sm.getString("contextConfig.tomcatWebXmlError"), e); } } return webXmlTomcatFragment; }
private WebXml getTomcatWebXmlFragment(WebXmlParser webXmlParser) { WebXml webXmlTomcatFragment = createWebXml(); webXmlTomcatFragment.setOverridable(true); // Set to distributable else every app will be prevented from being // distributable when the Tomcat fragment is merged with the main // web.xml webXmlTomcatFragment.setDistributable(true); // When merging, the default welcome files are only used if the app has // not defined any welcomes files. webXmlTomcatFragment.setAlwaysAddWelcomeFiles(false); WebResource resource = context.getResources().getResource(Constants.TomcatWebXml); if (resource.isFile()) { try { InputSource source = new InputSource(resource.getURL().toURI().toString()); source.setByteStream(resource.getInputStream()); if (!webXmlParser.parseWebXml(source, webXmlTomcatFragment, false)) { ok = false; } } catch (URISyntaxException e) { log.error(sm.getString("contextConfig.tomcatWebXmlError"), e); } } return webXmlTomcatFragment; }
fragment.setDistributable(true); } else { InputSource source = new InputSource(
webXmlDefaultFragment.setDistributable(true);
webXmlDefaultFragment.setDistributable(true);
webXmlDefaultFragment.setDistributable(true);
fragment.setDistributable(true); } else { String fragmentUrl = jar.getURL(FRAGMENT_LOCATION);
fragment.setDistributable(true); } else { String fragmentUrl = jar.getURL(FRAGMENT_LOCATION);