Package org.mortbay.jetty.handler

Examples of org.mortbay.jetty.handler.HandlerCollection


    RequestLog requestLog = HttpRequestLog.getRequestLog(name);

    if (requestLog != null) {
      RequestLogHandler requestLogHandler = new RequestLogHandler();
      requestLogHandler.setRequestLog(requestLog);
      HandlerCollection handlers = new HandlerCollection();
      handlers.setHandlers(new Handler[] {contexts, requestLogHandler});
      webServer.setHandler(handlers);
    } else {
      webServer.setHandler(contexts);
    }
View Full Code Here


        Server server = new Server();
        Connector connector=new GrizzlyConnector();
        connector.setPort(8080);
        server.setConnectors(new Connector[]{connector});
       
        HandlerCollection handlers = new HandlerCollection();
        ContextHandlerCollection contexts = new ContextHandlerCollection();
        handlers.setHandlers(new Handler[]{contexts,new DefaultHandler()});
        server.setHandler(handlers);
       
        // TODO add javadoc context to contexts
       
        WebAppContext.addWebApplications(server, "../../webapps", "org/mortbay/jetty/webapp/webdefault.xml", true, false);
View Full Code Here

    public void testServer()
    throws Exception
    {
        Server server = new Server();

        HandlerCollection handlerCollection = new HandlerCollection();
        handlerCollection.setHandlers(new Handler[] {new ContextHandlerCollection(), new DefaultHandler()});
        server.setHandler(handlerCollection);
       
        //make a new Server
        JettyHttpServer httpServer = new JettyHttpServer();
        httpServer.bind(new InetSocketAddress ("localhost", 8080), 0);
View Full Code Here

        String[] names = context.getBeanNamesForType(Server.class);
        assertEquals("Should have the name of a Jetty server", 1, names.length);
        server = (Server) context.getBean(names[0]);
        assertNotNull("Should have a Jetty Server", server);
       
        HandlerCollection hcollection = (HandlerCollection) server.getChildHandlerByClass(HandlerCollection.class);
        assertNotNull("Should have a HandlerCollection", hcollection);
        assertNotNull("HandlerCollection should contain handlers", hcollection.getHandlers());
        Handler[] handlers = hcollection.getHandlers();
        assertEquals("Should be 3 handlers", 3,handlers.length);
        assertTrue("First handler should be a ContextHandlerCollection", handlers[0] instanceof ContextHandlerCollection);
        Handler[] webapps = ((ContextHandlerCollection)handlers[0]).getChildHandlers();
        assertNotNull("Should be at least one webapp", webapps);
        assertTrue("Should be an instance of WebAppContext", webapps[0] instanceof WebAppContext);
View Full Code Here

            e1.printStackTrace();
        }
       
        webappcontext.setWar(warPath);

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

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

        }
        webappcontext.setContextPath("/");

        webappcontext.setWar(contextPath);

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

        server.setHandler(handlers);
        try {
            server.start();
                      
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

                                          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

        }
        webappcontext.setContextPath("/");

        webappcontext.setWar(contextPath);

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

        server.setHandler(handlers);
        try {
            server.start();
                      
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.