Package org.mortbay.jetty.handler

Examples of org.mortbay.jetty.handler.HandlerCollection


    server.setConnectors(new Connector[]
    {
      connector
    });
   
    HandlerCollection handlers = new HandlerCollection();
    ContextHandlerCollection contexts = new ContextHandlerCollection();

    WebAppContext webAppContext1 = new WebAppContext("samples/actiontest/dist/actiontest", "/actiontest");
    WebAppContext webAppContext2 = new WebAppContext("samples/holiday-booking/dist/holidaybooking",
        "/holidaybooking");
    contexts.addHandler(webAppContext1);
    contexts.addHandler(webAppContext2);
   
    /*
    This code is required for hot deployment, although
    it needs to point to a valid jetty.xml file to work
    correctly (ie it won't currently work)
   
    ContextDeployer contextDeployer = new ContextDeployer();
    server.addLifeCycle(contextDeployer);
   
    contextDeployer.setContexts(contexts);
    contextDeployer.setScanInterval(10);
   
    contexts.setServer(server);
    */

    RequestLogHandler requestLogHandler = new RequestLogHandler();
    handlers.setHandlers(new Handler[]
    {
      contexts, new DefaultHandler(), requestLogHandler
    });
    server.setHandler(handlers);

View Full Code Here


    public void finishConfigurationBeforeStart() throws Exception {
        Handler[] handlers = getConfiguredContextHandlers();
        org.gradle.api.plugins.jetty.internal.JettyPluginServer plugin = getServer();
        Server server = (Server) plugin.getProxiedObject();

        HandlerCollection contexts = (HandlerCollection) server.getChildHandlerByClass(ContextHandlerCollection.class);
        if (contexts == null) {
            contexts = (HandlerCollection) server.getChildHandlerByClass(HandlerCollection.class);
        }

        for (int i = 0; (handlers != null) && (i < handlers.length); i++) {
            contexts.addHandler(handlers[i]);
        }
    }
View Full Code Here

        webappContext.addHandler( securityHandler );

        SessionHandler sessionHandler = webappContext.getSessionHandler();
        ( (AbstractSessionManager) sessionHandler.getSessionManager() ).setUsingCookies( false );

        HandlerCollection handlers = new HandlerCollection();
        handlers.setHandlers( new Handler[]{ webappContext, new DefaultHandler() } );

        server.setHandler( handlers );
    }
View Full Code Here

        wactx.setClassLoader(AbstractWebTest.class.getClassLoader());
        wactx.setParentLoaderPriority(true);
        wactx.setContextPath(ctx);
        wactx.setWar("src/test/resources/standard");

        HandlerCollection handlers = new HandlerCollection();
        handlers.setHandlers(new Handler[] { wactx, new DefaultHandler() });
        jetty.setHandler(handlers);

        jetty.start();
    }
View Full Code Here

                                          String[] configurations,
                                          boolean extract,
                                          boolean java2CompliantClassLoader)
        throws IOException
    {
        HandlerCollection contexts = (HandlerCollection)server.getChildHandlerByClass(ContextHandlerCollection.class);
        if (contexts==null)
            contexts = (HandlerCollection)server.getChildHandlerByClass(HandlerCollection.class);
       
        addWebApplications(contexts,webapps,defaults,configurations,extract,java2CompliantClassLoader);
    }       
View Full Code Here

        ctx.getServletHandler().addServletWithMapping( InfiniteRedirectionServlet.class, "/redirect-trap/*" );

        SessionHandler sessionHandler = ctx.getSessionHandler();
        ( (AbstractSessionManager) sessionHandler.getSessionManager() ).setUsingCookies( false );

        HandlerCollection handlers = new HandlerCollection();
        handlers.setHandlers( new Handler[]{ ctx, new DefaultHandler() } );

        server.setHandler( handlers );
        server.start();
    }
View Full Code Here

                                          String[] configurations,
                                          boolean extract,
                                          boolean java2CompliantClassLoader)
        throws IOException
    {
        HandlerCollection contexts = (HandlerCollection)server.getChildHandlerByClass(ContextHandlerCollection.class);
        if (contexts==null)
            contexts = (HandlerCollection)server.getChildHandlerByClass(HandlerCollection.class);
       
        addWebApplications(contexts,webapps,defaults,configurations,extract,java2CompliantClassLoader);
    }       
View Full Code Here

            setHandler(handler);
        else if (getHandler() instanceof HandlerCollection)
            ((HandlerCollection)getHandler()).addHandler(handler);
        else
        {
            HandlerCollection collection=new HandlerCollection();
            collection.setHandlers(new Handler[]{getHandler(),handler});
            setHandler(collection);
        }
    }
View Full Code Here

    /* ------------------------------------------------------------ */
    /**
     */
    public void setHandlers(Handler[] handlers)
    {
        HandlerCollection collection;
        if (getHandler() instanceof HandlerCollection)
            collection=(HandlerCollection)getHandler();
        else
        {
            collection=new HandlerCollection();
            setHandler(collection);
        }
           
        collection.setHandlers(handlers);
    }
View Full Code Here

        if (path.endsWith("/")) {
            path = path.substring(0, path.length() - 1);
        }
        String pathSlash = path + "/";
        // Check that context does not exist yet
        HandlerCollection handlerCollection = (HandlerCollection) server.getHandler();
        ContextHandlerCollection contexts = (ContextHandlerCollection) handlerCollection.getHandlers()[0];
        Handler[] handlers = contexts.getHandlers();
        if (handlers != null) {
            for (int i = 0; i < handlers.length; i++) {
                if (handlers[i] instanceof ContextHandler) {
                    ContextHandler h = (ContextHandler) handlers[i];
View Full Code Here

TOP

Related Classes of org.mortbay.jetty.handler.HandlerCollection

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.