Package org.eclipse.jetty.webapp

Examples of org.eclipse.jetty.webapp.WebAppClassLoader


            Server server = new Server();

            SipAppContext context = new SipAppContext();
            context.setServer(server);
            context.getSipMetaData().setAppName("myApp");
            context.setClassLoader(new WebAppClassLoader(Thread.currentThread().getContextClassLoader(), context));
            context.setOverrideSipDescriptors(Arrays.asList(getClass().getResource("/sip.xml").toString()));
            context.setServletHandler(new SipServletHandler());
           
            Thread.currentThread().setContextClassLoader(context.getClassLoader());
           
View Full Code Here


    private static WebAppContext buildContext() throws IOException {
        ProtectionDomain protectionDomain = Startup.class.getProtectionDomain();
        URL location = protectionDomain.getCodeSource().getLocation();

        WebAppContext context = new WebAppContext();
        WebAppClassLoader webAppClassLoader = new WebAppClassLoader(Startup.class.getClassLoader(),context);
        context.setClassLoader(webAppClassLoader);
        context.setContextPath(URIUtil.SLASH);
        context.setWar(location.toExternalForm());

        if( tempDir != null ) {
View Full Code Here

    WebAppContext context = (WebAppContext) server.getHandler();

    System.out.println("[INFO] Application reloading");
    context.stop();

    WebAppClassLoader classLoader = new WebAppClassLoader(context);
    classLoader.addClassPath("target/classes");
    classLoader.addClassPath("target/test-classes");
    context.setClassLoader(classLoader);

    context.start();

    System.out.println("[INFO] Application reloaded");
View Full Code Here

           
            ClassLoader parentLoader = this.getClass().getClassLoader();
            if (parentLoader instanceof AntClassLoader)
                parentLoader = new AntURLClassLoader((AntClassLoader)parentLoader);

            setClassLoader(new WebAppClassLoader(parentLoader, this));
            if (attributes != null && attributes.getAttributes() != null)
            {
                for (Attribute a:attributes.getAttributes())
                    setAttribute(a.getName(), a.getValue());
            }
View Full Code Here

     */
    @Before
    public void setUp() throws Exception
    {
        context = new WebAppContext();
        context.setClassLoader(new WebAppClassLoader(Thread.currentThread().getContextClassLoader(), context));
        ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(context.getClassLoader());
        Context icontext = new InitialContext();
        Context compCtx =  (Context)icontext.lookup ("java:comp");
        compCtx.createSubcontext("env");
View Full Code Here

            Server server = new Server();

            WebAppContext wac = new WebAppContext();
            wac.setServer(server);
            wac.setClassLoader(new WebAppClassLoader(Thread.currentThread().getContextClassLoader(), wac));

            MetaData metaData = new MetaData();

            PlusDescriptorProcessor plusProcessor = new PlusDescriptorProcessor();
View Full Code Here

        // Is this a webapp or a normal context
        Resource classes=getBaseResource().addPath("WEB-INF/classes/");
        Resource lib=getBaseResource().addPath("WEB-INF/lib/");
        if (classes.exists() && classes.isDirectory() || lib.exists() && lib.isDirectory())
        {
            _webappLoader=new WebAppClassLoader(_libLoader,this);
            _webappLoader.setName(key);
            if (classes.exists())
                _webappLoader.addClassPath(classes);
            if (lib.exists())
                _webappLoader.addJars(lib);           
View Full Code Here

               
                    if (classes.exists()||lib.exists())
                    {
                        final AtomicBoolean locked =new AtomicBoolean(false);
                       
                        WebAppClassLoader webapp_loader=new WebAppClassLoader(loader,webappcontext)
                        {
                            @Override
                            public void addClassPath(Resource resource) throws IOException
                            {
                                if (!locked.get())
                                    super.addClassPath(resource);
                            }

                            @Override
                            public void addClassPath(String classPath) throws IOException
                            {
                                if (!locked.get())
                                    super.addClassPath(classPath);
                            }

                            @Override
                            public void addJars(Resource lib)
                            {
                                if (!locked.get())
                                    super.addJars(lib);
                            }
                        };

                        if (classes.exists())
                            webapp_loader.addClassPath(classes);
                        if (lib.exists())
                            webapp_loader.addJars(lib);
                        locked.set(true);
                       
                        loader=webapp_loader;
                    }
                }
View Full Code Here

        }

        webapp.setWar(war);
        webapp.setExtractWAR(true);
        webapp.setParentLoaderPriority(true);
        webapp.setClassLoader(new WebAppClassLoader(Main.class.getClassLoader(), webapp));

        return webapp;
    }
View Full Code Here

   */
  public void reloadContext() throws Exception {
    System.out.println("Application reloading");
    this.webAppContext.stop();

    WebAppClassLoader classLoader = new WebAppClassLoader(this.webAppContext);
    classLoader.addClassPath("target/classes");
    classLoader.addClassPath("target/test-classes");
    this.webAppContext.setClassLoader(classLoader);

    this.webAppContext.start();

    System.out.println("Application reloaded");
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.webapp.WebAppClassLoader

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.