protected Set createURLFromMarkerFile()

in extscript-core-root/extscript-cdi/src/main/java/org/apache/myfaces/extensions/scripting/cdi/core/ExtScriptScannerService.java [133:195]


    protected Set<String> createURLFromMarkerFile() throws Exception
    {
        Set<String> listURL = new HashSet<String>();

        // Root with beans.xml marker.
        ClassLoader classLoader = WebBeansUtil.getCurrentClassLoader();
        if(classLoader instanceof CDIThrowAwayClassloader) {
            classLoader = classLoader.getParent();
            //for beans.xml discovery we use our old classloader
            //because the new one fails at disovering
            //TODO research this.
        }
        String[] urls = findBeansXmlBases("META-INF/beans.xml", classLoader);

        if (urls != null)
        {
            String addPath;
            for (String url : urls)
            {
                String fileDir = new URL(url).getFile();
                if (fileDir.endsWith(".jar!/"))
                {
                    fileDir = fileDir.substring(0, fileDir.lastIndexOf("/")) + "/META-INF/beans.xml";

                    //fix for weblogic
                    if (!fileDir.startsWith("file:/"))
                    {
                        fileDir = "file:/" + fileDir;
                        //TODO switch to a more stable approach
                        //url = new URL("jar:" + fileDir);
                    }

                    if (logger.wblWillLogDebug())
                    {
                        logger.debug("OpenWebBeans found the following url while doing web scanning: " + fileDir);
                    }

                    addPath = "jar:" + fileDir;

                    if (logger.wblWillLogDebug())
                    {
                        logger.debug("OpenWebBeans added the following jar based path while doing web scanning: " +
                                addPath);
                    }
                } else
                {
                    //X TODO check!
                    addPath = "file:" + url + "META-INF/beans.xml";

                    if (logger.wblWillLogDebug())
                    {
                        logger.debug("OpenWebBeans added the following file based path while doing web scanning: " +
                                addPath);
                    }

                }

                listURL.add(url);
            }
        }

        return listURL;
    }