Package org.apache.openejb.jee

Examples of org.apache.openejb.jee.TldTaglib


        urls = scanClassLoaderForTagLibs(parentClassLoader);
        tldLocations.addAll(urls);

        // load the tld files
        for (URL location : tldLocations) {
            TldTaglib taglib = ReadDescriptors.readTldTaglib(location);
            webModule.getTaglibs().add(taglib);
            if ("file".equals(location.getProtocol())) {
                webModule.getWatchedResources().add(URLs.toFilePath(location));
            }
        }
View Full Code Here


        }
        return webApp;
    }

    public static TldTaglib readTldTaglib(URL url) throws OpenEJBException {
        TldTaglib tldTaglib;
        try {
            tldTaglib = (TldTaglib) JaxbJavaee.unmarshal(TldTaglib.class, url.openStream());
        } catch (SAXException e) {
            throw new OpenEJBException("Cannot parse the JSP tag library definition file: " + url.toExternalForm(), e);
        } catch (JAXBException e) {
View Full Code Here

        urls = TldScanner.scan(parentClassLoader);
        tldLocations.addAll(urls);

        // load the tld files
        for (final URL location : tldLocations) {
            final TldTaglib taglib = ReadDescriptors.readTldTaglib(location);
            webModule.getTaglibs().add(taglib);
            if ("file".equals(location.getProtocol())) {
                webModule.getWatchedResources().add(URLs.toFilePath(location));
            }
        }
View Full Code Here

        return webApp;
    }

    public static TldTaglib readTldTaglib(URL url) throws OpenEJBException {
        // TOMEE-164 Optimization on reading built-in tld files
        if (url.getPath().contains("jstl-1.2.jar")) return new TldTaglib();
        if (url.getPath().contains("myfaces-impl")) {
            final TldTaglib taglib = new TldTaglib();
            final Listener listener = new Listener();
            listener.setListenerClass("org.apache.myfaces.webapp.StartupServletContextListener");
            taglib.getListener().add(listener);
            return taglib;
        }

        TldTaglib tldTaglib;
        try {
            tldTaglib = (TldTaglib) JaxbJavaee.unmarshalTaglib(TldTaglib.class, IO.read(url));
        } catch (SAXException e) {
            throw new OpenEJBException("Cannot parse the JSP tag library definition file: " + url.toExternalForm(), e);
        } catch (JAXBException e) {
View Full Code Here

        parseTldFile(url, expectedListenerClassNames, expectedTagClassNames);
    }

    private void parseTldFile(URL url, List<String> expectedListenerClassNames, List<String> expectedTagClassNames) throws Exception {
        InputStream in = null;
        TldTaglib tl;
        try {
            in = url.openStream();
            tl = (TldTaglib) JaxbJavaee.unmarshalTaglib(TldTaglib.class, in);
        } finally {
            IOUtils.close(in);
        }
        List<String> listenerClassNames = new ArrayList<String>();

        for (Listener listener : tl.getListener()) {
            listenerClassNames.add(listener.getListenerClass());
        }
        List<String> tagClassNames = new ArrayList<String>();
        // Get all the tags from the TLD file
        for (Tag tag : tl.getTag()) {
            tagClassNames.add(tag.getTagClass());
        }

        Assert.assertEquals(expectedListenerClassNames.size(), listenerClassNames.size());
        for (String expectedListenerClassName : expectedListenerClassNames) {
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("parseTLDFile( " + url.toString() + " ): Entry");
        }
        try {
            InputStream in = null;
            TldTaglib tl;
            try {
                in = url.openStream();
                tl = (TldTaglib) JaxbJavaee.unmarshalTaglib(TldTaglib.class, in);
            } finally {
                IOUtils.close(in);
            }

            // Get all the listeners from the TLD file
            for (Listener listener : tl.getListener()) {
                String className = listener.getListenerClass();
                if (!excludedListenerNames.contains(className)) {
                    try {
                        Class<?> clas = bundle.loadClass(className);
                        while (clas != null) {
                            classes.add(clas);
                            clas = clas.getSuperclass();
                        }
                        listenerNames.add(className);
                    } catch (ClassNotFoundException e) {
                        log.warn("JspModuleBuilderExtension: Could not load listener class: " + className + " mentioned in TLD file at " + url.toString());
                    }
                }
            }

            // Get all the tags from the TLD file
            for (Tag tag : tl.getTag()) {
                String className = tag.getTagClass();
                try {
                    Class<?> clas = bundle.loadClass(className);
                    while (clas != null) {
                        classes.add(clas);
View Full Code Here

        urls = scanClassLoaderForTagLibs(parentClassLoader);
        tldLocations.addAll(urls);

        // load the tld files
        for (URL location : tldLocations) {
            TldTaglib taglib = ReadDescriptors.readTldTaglib(location);
            webModule.getTaglibs().add(taglib);
            if ("file".equals(location.getProtocol())) {
                webModule.getWatchedResources().add(URLs.toFilePath(location));
            }
        }
View Full Code Here

        }
        return webApp;
    }

    public static TldTaglib readTldTaglib(URL url) throws OpenEJBException {
        TldTaglib tldTaglib;
        try {
            tldTaglib = (TldTaglib) JaxbJavaee.unmarshal(TldTaglib.class, url.openStream());
        } catch (SAXException e) {
            throw new OpenEJBException("Cannot parse the JSP tag library definition file: " + url.toExternalForm(), e);
        } catch (JAXBException e) {
View Full Code Here

        }
        return webApp;
    }

    public static TldTaglib readTldTaglib(URL url) throws OpenEJBException {
        TldTaglib tldTaglib;
        try {
            tldTaglib = (TldTaglib) JaxbJavaee.unmarshalTaglib(TldTaglib.class, url.openStream());
        } catch (SAXException e) {
            throw new OpenEJBException("Cannot parse the JSP tag library definition file: " + url.toExternalForm(), e);
        } catch (JAXBException e) {
View Full Code Here

        urls = scanClassLoaderForTagLibs(parentClassLoader);
        tldLocations.addAll(urls);

        // load the tld files
        for (URL location : tldLocations) {
            TldTaglib taglib = ReadDescriptors.readTldTaglib(location);
            webModule.getTaglibs().add(taglib);
            if ("file".equals(location.getProtocol())) {
                webModule.getWatchedResources().add(URLs.toFilePath(location));
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.openejb.jee.TldTaglib

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.