Package org.mortbay.jetty.handler

Examples of org.mortbay.jetty.handler.ContextHandlerCollection


        mapping.setServletName("jbiServlet");
        mapping.setPathSpec("/*");
        handler.setServletMappings(new ServletMapping[] {mapping});
        context.setHandler(handler);

        ContextHandlerCollection contexts = new ContextHandlerCollection();
        HandlerCollection handlers = new HandlerCollection();
        handlers.setHandlers(new Handler[] {contexts});
        contexts.addHandler(context);

        SelectChannelConnector connector = new SelectChannelConnector();
        connector.setHost("localhost");
        connector.setPort(8190);

View Full Code Here


    webServer.addConnector(listener);

    webServer.setThreadPool(new QueuedThreadPool());

    final String appDir = getWebAppsPath();
    ContextHandlerCollection contexts = new ContextHandlerCollection();
    webServer.setHandler(contexts);

    webAppContext = new WebAppContext();
    webAppContext.setContextPath("/");
    webAppContext.setWar(appDir + "/" + name);
View Full Code Here

        contexts = (ContextHandlerCollection) server
                .getChildHandlerByClass(ContextHandlerCollection.class);
        if (contexts == null)
        {
            contexts = new ContextHandlerCollection();
            HandlerCollection handlers = (HandlerCollection) server
                    .getChildHandlerByClass(HandlerCollection.class);
            if (handlers == null)
            {
                handlers = new HandlerCollection();
View Full Code Here

        ContextHandler context1 = new ContextHandler();
        context1.setContextPath("/one");
        Handler handler1=new HelloHandler();
        context1.setHandler(handler1);  
       
        ContextHandlerCollection contexts = new ContextHandlerCollection();
        contexts.setHandlers(new Handler[]{context0,context1});
       
        HandlerCollection handlers = new HandlerCollection();
        handlers.setHandlers(new Handler[]{contexts,new DefaultHandler()});
       
        server.setHandler(handlers);
View Full Code Here

    public TerracottaJettyServer(int port, int maxInactivePeriod, int scavengePeriod)
    {
        this.server = new Server(port);
        this.maxInactivePeriod = maxInactivePeriod;
        this.scavengePeriod = scavengePeriod;
        this.contexts = new ContextHandlerCollection();
        this.sessionIdManager = new TerracottaSessionIdManager(server);
    }
View Full Code Here

        SelectChannelConnector connector=new SelectChannelConnector();
        // SocketConnector connector=new SocketConnector();
        connector.setPort(port);
        server.addConnector(connector);
       
        ContextHandlerCollection contexts = new ContextHandlerCollection();
        server.setHandler(contexts);
       
        Context context = new Context(contexts,"/",Context.NO_SECURITY|Context.SESSIONS);
       
View Full Code Here

    public static void main(String[] args)
        throws Exception
    {
        Server server = new Server(8080);

        ContextHandlerCollection contexts = new ContextHandlerCollection();
        server.setHandler(contexts);

        Context root = new Context(contexts,"/",Context.SESSIONS);
        root.addServlet(new ServletHolder(new HelloServlet("Ciao")), "/*");

        Context other = new Context(contexts,"/other",Context.SESSIONS);
        other.addServlet("org.mortbay.jetty.example.ManyServletContexts$HelloServlet", "/*");

        StatisticsHandler stats = new StatisticsHandler();
        contexts.addHandler(stats);
        Context yetanother =new Context(stats,"/yo",Context.SESSIONS);
        yetanother.addServlet(new ServletHolder(new HelloServlet("YO!")), "/*");

        server.start();
        server.join();
View Full Code Here

        ssl_b_connector.setTruststore(jetty_home+"/etc/keystore");
        ssl_b_connector.setTrustPassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
        server.addConnector(ssl_b_connector)
       
        HandlerCollection handlers = new HandlerCollection();
        ContextHandlerCollection contexts = new ContextHandlerCollection();
        RequestLogHandler requestLogHandler = new RequestLogHandler();
        handlers.setHandlers(new Handler[]{contexts,new DefaultHandler(),requestLogHandler});
        server.setHandler(handlers);
       
        ContextDeployer deployer0 = new ContextDeployer();
View Full Code Here

    protected void setUp() throws Exception
    {
        server = new Server(0);
            
        HandlerCollection handlers = new HandlerCollection();
        ContextHandlerCollection contexts = new ContextHandlerCollection();
        RequestLogHandler requestLogHandler = new RequestLogHandler();
        handlers.setHandlers(new Handler[]{contexts,new DefaultHandler(),requestLogHandler});
        server.setHandler(handlers);
       
        test0 = new WebAppContext(contexts,"../../webapps/test","/test0");
View Full Code Here

       
        try{
           
            // Create the server
            Server server = new Server();
            ContextHandlerCollection contexts = new ContextHandlerCollection();
            server.setHandler(contexts);
           
            SocketConnector connector = new SocketConnector();
            String address = args[0];
            int colon = address.lastIndexOf(':');
            if (colon<0)
                connector.setPort(Integer.parseInt(address));
            else
            {
                connector.setHost(address.substring(0,colon));
                connector.setPort(Integer.parseInt(address.substring(colon+1)));
            }
            server.setConnectors(new Connector[]{connector});
           
            if (args.length<3)
            {
                ContextHandler context = new ContextHandler();
                context.setContextPath(URIUtil.SLASH);
                context.setResourceBase(args.length==1?".":args[1]);
                ServletHandler servlet = new ServletHandler();
                servlet.addServletWithMapping("org.mortbay.jetty.servlet.DefaultServlet", URIUtil.SLASH);
                context.setHandler(servlet);
                contexts.addHandler(context);
            }
            else if ("-webapps".equals(args[1]))
            {
                WebAppContext.addWebApplications(server, args[2], WebAppContext.WEB_DEFAULTS_XML, true, true);
            }
            else if ("-webapp".equals(args[1]))
            {
                WebAppContext webapp = new WebAppContext();
                webapp.setWar(args[2]);
                webapp.setContextPath(URIUtil.SLASH);
                contexts.addHandler(webapp);
            }
               
            server.start();
           
        }
View Full Code Here

TOP

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

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.