Examples of WebappClassLoader


Examples of org.glassfish.web.loader.WebappClassLoader

            // Try looking up resource in
            // WEB-INF/lib/[*.jar]/META-INF/resources
            ClassLoader cl = Thread.currentThread().getContextClassLoader();
            String metaInfResPath = Globals.META_INF_RESOURCES + path;
            if (cl instanceof WebappClassLoader) {
                WebappClassLoader wcl = (WebappClassLoader)cl;
                final URL resourceUrl = wcl.getResourceFromJars(metaInfResPath);
                if (resourceUrl != null) {
                    // XXX Remove dependency on WebappClassLoader
                    ConcurrentHashMap<String, ResourceEntry> resourceEntries =
                        wcl.getResourceEntries();
                    ResourceEntry resourceEntry = resourceEntries.get(metaInfResPath);
                    if (resourceEntry != null) {
                        // create a CacheEntry to continue the processing
                        cacheEntry = new CacheEntry();
                        try {
View Full Code Here

Examples of org.glassfish.web.loader.WebappClassLoader

    }

    @Override
    public ClassLoader getClassLoader(ClassLoader parent, DeploymentContext context) {
        ScatteredArchive archive = (ScatteredArchive) context.getSource();
        WebappClassLoader cloader = new WebappClassLoader(parent);
        try {
            FileDirContext r = new FileDirContext();
            File base = archive.getResourcesDir();
            r.setDocBase(base.getAbsolutePath());
            File sunWeb = archive.getFile("WEB-INF/sun-web.xml");
            SunWebXmlParser sunWebXmlParser = null;
            if (sunWeb!=null && sunWeb.exists()) {
                sunWebXmlParser = new SunWebXmlParser(sunWeb.getParentFile().getParent());
            }

            cloader.setResources(r);
            for (URL url : archive.getClassPath()) {
                cloader.addRepository(url.toExternalForm());
            }
            if (context.getScratchDir("jsp") != null) {
                cloader.setWorkDir(context.getScratchDir("jsp"));
            }

            if (sunWebXmlParser!=null) {
                configureLoaderAttributes(cloader, sunWebXmlParser, base);
                configureLoaderProperties(cloader, sunWebXmlParser, base);
            }
        } catch(XMLStreamException xse) {
            logger.log(Level.SEVERE, xse.getMessage());
            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE, xse.getMessage(), xse);
            }
        } catch(FileNotFoundException fnfe) {
            logger.log(Level.SEVERE, fnfe.getMessage());
            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE, fnfe.getMessage(), fnfe);
            }
        }
        try {
            cloader.start();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return cloader;
    }
View Full Code Here

Examples of org.glassfish.web.loader.WebappClassLoader

                    wbd.setName(Constants.DEFAULT_WEB_MODULE_NAME);
                    wbd.setContextRoot(contextRoot);
                    wmInfo.setLocation(docroot);
                    wmInfo.setDescriptor(wbd);
                    wmInfo.setParentLoader(EmbeddedWebContainer.class.getClassLoader());
                    wmInfo.setAppClassLoader(new WebappClassLoader(wmInfo.getParentLoader()));
                }
            }

            if (wmInfo == null) {
                _logger.log(Level.SEVERE, "vs.defaultWebModuleNotFound",
View Full Code Here

Examples of org.glassfish.web.loader.WebappClassLoader

            wbd.setContextRoot("");
            wmInfo.setLocation(new File(docroot));
            wmInfo.setDescriptor(wbd);
            wmInfo.setParentLoader(
                serverContext.getCommonClassLoader());
            WebappClassLoader loader = new WebappClassLoader(
                wmInfo.getParentLoader());
            loader.start();           
            wmInfo.setAppClassLoader(loader);
            if ( wbd.getApplication() == null ) {
                Application application = new Application(Globals.getDefaultHabitat());
                application.setVirtual(true);
                application.setName(Constants.DEFAULT_WEB_MODULE_NAME);
View Full Code Here

Examples of org.glassfish.web.loader.WebappClassLoader

                    wbd.setName(moduleID);
                    wbd.setContextRoot(contextRoot);
                    wmInfo.setDescriptor(wbd);
                    wmInfo.setLocation(docroot);
                    wmInfo.setParentLoader(EmbeddedWebContainer.class.getClassLoader());
                    wmInfo.setAppClassLoader(new WebappClassLoader(wmInfo.getParentLoader()));
                }
            } else {
                Object[] params = { id, getID() };
                _logger.log(Level.SEVERE, "vs.defaultWebModuleDisabled",
                            params);
View Full Code Here

Examples of org.glassfish.web.loader.WebappClassLoader

                classLoader = (WebappClassLoader) cl;
            } else {
                classLoader = AccessController.doPrivileged(new PrivilegedAction<WebappClassLoader>() {
                    @Override
                    public WebappClassLoader run() {
                        return new WebappClassLoader(cl);
                    }
                });
            }
            classLoader.setResources(container.getResources());
            classLoader.setDebug(this.debug);
View Full Code Here

Examples of org.glassfish.web.loader.WebappClassLoader

     */
    protected ClassLoader createClassLoader()
        throws Exception {

        Class<?> clazz = Class.forName(loaderClass);
        WebappClassLoader classLoader = null;

        if (parentClassLoader == null) {
            parentClassLoader = Thread.currentThread().getContextClassLoader();
        }
        Class<?>[] argTypes = { ClassLoader.class };
        Object[] args = { parentClassLoader };
        Constructor<?> constr = clazz.getConstructor(argTypes);
        classLoader = (WebappClassLoader) constr.newInstance(args);

        classLoader.setUseMyFaces(useMyFaces);

        /*
         * Start the WebappClassLoader here as opposed to in the course of
         * WebappLoader#start, in order to prevent it from being started
         * twice (during normal deployment, the WebappClassLoader is created
         * by the deployment backend without calling
         * WebappLoader#createClassLoader, and will have been started
         * by the time WebappLoader#start is called)
         */
        try {
            classLoader.start();
        } catch (Exception e) {
            throw new LifecycleException(e);
        }

        return classLoader;
View Full Code Here

Examples of org.glassfish.web.loader.WebappClassLoader

            // Try looking up resource in
            // WEB-INF/lib/[*.jar]/META-INF/resources
            ClassLoader cl = Thread.currentThread().getContextClassLoader();
            String metaInfResPath = Globals.META_INF_RESOURCES + path;
            if (cl instanceof WebappClassLoader) {
                WebappClassLoader wcl = (WebappClassLoader)cl;
                final URL resourceUrl = wcl.getResourceFromJars(metaInfResPath);
                if (resourceUrl != null) {
                    // XXX Remove dependency on WebappClassLoader
                    ConcurrentHashMap<String, ResourceEntry> resourceEntries =
                        wcl.getResourceEntries();
                    ResourceEntry resourceEntry = resourceEntries.get(metaInfResPath);
                    if (resourceEntry != null) {
                        // create a CacheEntry to continue the processing
                        cacheEntry = new CacheEntry();
                        try {
View Full Code Here

Examples of org.glassfish.web.loader.WebappClassLoader

                classLoader = (WebappClassLoader) cl;
            } else {
                classLoader = AccessController.doPrivileged(new PrivilegedAction<WebappClassLoader>() {
                    @Override
                    public WebappClassLoader run() {
                        return new WebappClassLoader(cl);
                    }
                });
            }
            classLoader.setResources(container.getResources());
            classLoader.setDebug(this.debug);
View Full Code Here

Examples of org.glassfish.web.loader.WebappClassLoader

     */
    protected ClassLoader createClassLoader()
        throws Exception {

        Class<?> clazz = Class.forName(loaderClass);
        WebappClassLoader classLoader = null;

        if (parentClassLoader == null) {
            parentClassLoader = Thread.currentThread().getContextClassLoader();
        }
        Class<?>[] argTypes = { ClassLoader.class };
        Object[] args = { parentClassLoader };
        Constructor<?> constr = clazz.getConstructor(argTypes);
        classLoader = (WebappClassLoader) constr.newInstance(args);

        classLoader.setUseMyFaces(useMyFaces);

        /*
         * Start the WebappClassLoader here as opposed to in the course of
         * WebappLoader#start, in order to prevent it from being started
         * twice (during normal deployment, the WebappClassLoader is created
         * by the deployment backend without calling
         * WebappLoader#createClassLoader, and will have been started
         * by the time WebappLoader#start is called)
         */
        try {
            classLoader.start();
        } catch (Exception e) {
            throw new LifecycleException(e);
        }

        return classLoader;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.