Package org.apache.catalina.loader

Examples of org.apache.catalina.loader.WebappLoader


            {
                getLog().error( e );
                return;
            }
        }
        WebappLoader webappLoader = new WebappLoader( Thread.currentThread().getContextClassLoader() );
        Context context = container.createContext( contextPath, artifactWarDir.getAbsolutePath() );
        context.setLoader( webappLoader );

        File contextFile = contextXml != null ? contextXml : getContextFile();
        if ( contextFile != null )
View Full Code Here


     */
    @Override
    protected WebappLoader createWebappLoader()
        throws IOException, MojoExecutionException
    {
        WebappLoader loader = super.createWebappLoader();

        if ( useSeparateTomcatClassLoader )
        {
            loader.setDelegate( delegate );
        }

        try
        {
            ClassLoaderEntriesCalculatorRequest request =
                new ClassLoaderEntriesCalculatorRequest().setDependencies( dependencies ).setLog(
                    getLog() ).setMavenProject( project ).setAddWarDependenciesInClassloader(
                    addWarDependenciesInClassloader ).setUseTestClassPath( useTestClasspath );
            ClassLoaderEntriesCalculatorResult classLoaderEntriesCalculatorResult =
                classLoaderEntriesCalculator.calculateClassPathEntries( request );
            List<String> classLoaderEntries = classLoaderEntriesCalculatorResult.getClassPathEntries();
            final List<File> tmpDirectories = classLoaderEntriesCalculatorResult.getTmpDirectories();

            Runtime.getRuntime().addShutdownHook( new Thread()
            {
                @Override
                public void run()
                {
                    for ( File tmpDir : tmpDirectories )
                    {
                        try
                        {
                            FileUtils.deleteDirectory( tmpDir );
                        }
                        catch ( IOException e )
                        {
                            // ignore
                        }
                    }
                }
            } );

            if ( classLoaderEntries != null )
            {
                for ( String classLoaderEntry : classLoaderEntries )
                {
                    loader.addRepository( classLoaderEntry );
                }
            }

            if ( additionalClasspathDirs != null && !additionalClasspathDirs.isEmpty() )
            {
                for ( String additionalClasspathDir : additionalClasspathDirs )
                {
                    if ( StringUtils.isNotBlank( additionalClasspathDir ) )
                    {
                        File file = new File( additionalClasspathDir );
                        if ( file.exists() )
                        {
                            String fileUri = file.toURI().toString();
                            getLog().debug( "add file:" + fileUri + " as a additionalClasspathDir" );
                            loader.addRepository( fileUri );
                        }
                    }
                }
            }
        }
View Full Code Here

        if ( useSeparateTomcatClassLoader )
        {
            context.setParentClassLoader( getTomcatClassLoader() );
        }

        final WebappLoader loader = createWebappLoader();

        context.setLoader( loader );

        if ( overriddenContextFile != null )
        {
            // here, send file to Tomcat for it to complain if missing
            context.setConfigFile( overriddenContextFile.toURI().toURL() );
        }
        else if ( defaultContextFile.exists() )
        {
            // here, only sending default file if it indeed exists
            // otherwise Tomcat will create a default context
            context.setConfigFile( defaultContextFile.toURI().toURL() );
        }

        if ( classLoaderClass != null )
        {
            loader.setLoaderClass( classLoaderClass );
        }

        // https://issues.apache.org/jira/browse/MTOMCAT-239
        // get the jar scanner to configure scanning directories as we can run a jar or a reactor project with a jar so
        // the entries is a directory (target/classes)
View Full Code Here

    {
        if ( useSeparateTomcatClassLoader )
        {
            return ( isContextReloadable() )
                ? new ExternalRepositoriesReloadableWebappLoader( getTomcatClassLoader(), getLog() )
                : new WebappLoader( getTomcatClassLoader() );
        }

        return ( isContextReloadable() )
            ? new ExternalRepositoriesReloadableWebappLoader( Thread.currentThread().getContextClassLoader(), getLog() )
            : new WebappLoader( Thread.currentThread().getContextClassLoader() );
    }
View Full Code Here

                return;
            }
        }
        // TODO make that configurable ?
        //WebappLoader webappLoader = new WebappLoader( Thread.currentThread().getContextClassLoader() );
        WebappLoader webappLoader = createWebappLoader();
        Context context = null;
        if ( asWebApp )
        {
            context = container.addWebapp( contextPath, artifactWarDir.getAbsolutePath() );
        }
View Full Code Here

     */
    public String createWebappLoader(String parent)
        throws Exception {

        // Create a new WebappLoader instance
        WebappLoader loader = new WebappLoader();

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        Server server = ServerFactory.getServer();
        Service service = server.findService(pname.getKeyProperty("service"));
View Full Code Here

                ok = false;
            }
        }

        if (getLoader() == null) {
            WebappLoader webappLoader = new WebappLoader(getParentClassLoader());
            webappLoader.setDelegate(getDelegate());
            setLoader(webappLoader);
        }

        // Initialize character set mapper
        getCharsetMapper();
View Full Code Here

                throw new LifecycleException("Error in resourceStart()");
            }
        }

        if (getLoader() == null) {
            WebappLoader webappLoader = new WebappLoader(getParentClassLoader());
            webappLoader.setDelegate(getDelegate());
            setLoader(webappLoader);
        }

        // Initialize character set mapper
        getCharsetMapper();
View Full Code Here

                ok = false;
            }
        }

        if (getLoader() == null) {
            WebappLoader webappLoader = new WebappLoader(getParentClassLoader());
            webappLoader.setDelegate(getDelegate());
            setLoader(webappLoader);
        }

        // Initialize character set mapper
        getCharsetMapper();
View Full Code Here

                ok = false;
            }
        }

        if (getLoader() == null) {
            WebappLoader webappLoader = new WebappLoader(getParentClassLoader());
            webappLoader.setDelegate(getDelegate());
            setLoader(webappLoader);
        }

        // Initialize character set mapper
        getCharsetMapper();
View Full Code Here

TOP

Related Classes of org.apache.catalina.loader.WebappLoader

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.