Package org.mortbay.jetty.handler

Examples of org.mortbay.jetty.handler.ContextHandlerCollection


        {
            snapshots.root.mkdirs();
        }

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

        SocketConnector connector = new SocketConnector();
        connector.setPort( 0 ); // 0 means, choose and empty port. (we'll find out which, later)

        snapshots.server.setConnectors( new Connector[] { connector } );

        ContextHandler context = new ContextHandler();
        context.setContextPath( snapshots.context );
        context.setAttribute( "dirAllowed", true );
        context.setAttribute( "maxCacheSize", 0 );
        context.setResourceBase( snapshots.root.getAbsolutePath() );
        ServletHandler servlet = new ServletHandler();
        servlet.addServletWithMapping( DefaultServlet.class.getName(), "/" );
        context.setHandler( servlet );
        contexts.addHandler( context );

        snapshots.server.start();

        int port = connector.getLocalPort();
        snapshots.url = "http://localhost:" + port + snapshots.context;
View Full Code Here


        {
            central.root.mkdirs();
        }

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

        SocketConnector connector = new SocketConnector();
        connector.setPort( 0 ); // 0 means, choose and empty port. (we'll find out which, later)

        central.server.setConnectors( new Connector[] { connector } );

        ContextHandler context = new ContextHandler();
        context.setContextPath( central.context );
        context.setResourceBase( central.root.getAbsolutePath() );
        context.setAttribute( "dirAllowed", true );
        context.setAttribute( "maxCacheSize", 0 );
        ServletHandler servlet = new ServletHandler();
        servlet.addServletWithMapping( DefaultServlet.class.getName(), "/" );
        context.setHandler( servlet );
        contexts.addHandler( context );

        central.server.start();

        int port = connector.getLocalPort();
        central.url = "http://localhost:" + port + central.context;
View Full Code Here

        ContextHandler echoContext = new ContextHandler();
        echoContext.setContextPath("/EchoService");
        echoContext.setHandler(new EchoServiceHandler());

        ContextHandlerCollection handlerColl = new ContextHandlerCollection();
        Handler[] handlers = {arithmeticsContext, blogContext, echoContext};
        handlerColl.setHandlers(handlers);

        server.addHandler(handlerColl);
    }
View Full Code Here

                        handlerList.addHandler(h);
                    }
                }
                server.addHandler(handlerList);
            }
            contexts = new ContextHandlerCollection();
            server.addHandler(contexts);
            if (defaultHandler != null) {
                server.addHandler(defaultHandler);
            }
            try {               
View Full Code Here

   * @throws IOException e
   */
  public InfoServer(String name, String bindAddress, int port, boolean findPort)
  throws IOException {
    super(name, bindAddress, port, findPort);
    webServer.addHandler(new ContextHandlerCollection());
  }
View Full Code Here

        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

    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

        connector.setPort(8080);
        connector.setMaxIdleTime(30000);
        server.setConnectors(new Connector[]{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

        connector2.setKeyPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
        connector2.setTruststore(base+"/etc/keystore");
        connector2.setTrustPassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
        server.addConnector(connector2)

        ContextHandlerCollection contexts = new ContextHandlerCollection();
        server.setHandler(contexts);
       
        MovedContextHandler moved = new MovedContextHandler(contexts,"/","/cometd");
        moved.setDiscardPathInfo(true);
       
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.