Package org.mortbay.jetty

Examples of org.mortbay.jetty.Server


    }
  }

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

    Connector connector = new SelectChannelConnector();
    connector.setPort(8080);
    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);

    server.setStopAtShutdown(true);
    server.setSendServerVersion(true);

    server.start();
    server.join();
  }
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

            LogImpl log = (LogImpl) Factory.getFactory().getInstance("");
            // Ignore INFO logs.
            log.setVerbose(-1);
            log.add(logSink);

            jetty = new Server();

            // Configure HTTP socket listener
            boolean plainStarted = false;
            // Setting this property to a not null value will imply that the Jetty server will only
            // accept connect requests to that IP address
View Full Code Here

    LOGGER.debug( "itemMimeType: " + itemMimeType );
    LOGGER.debug( "queryEngine: " + queryEngine );
    LOGGER.debug( "port: " + port );

    // Create the server
    server = new Server();

    // Create a port listener
    SocketConnector connector = new SocketConnector();
    connector.setPort( port );
    server.addConnector( connector );
View Full Code Here

 
  /**
   * Starts the Web Server. The port is configurable.
   */
  public void start() throws Exception {
      server = server == null ? new Server() : server;
     
      Connector connector = new SelectChannelConnector();
      connector.setPort(DcSettings.getInt(DcRepository.Settings.stWebServerPort));
      server.setConnectors(new Connector[]{connector});
     
View Full Code Here

    public void setUp() throws Exception
    {
        super.setUp();
       
        httpServer = new Server(8191);
       
       
        Context context = new Context(httpServer,"/",Context.SESSIONS);
       
       
View Full Code Here

        service.setBindingProvider(new MessageBindingProvider());

        getServiceRegistry().register(service);

        // Create the server
        server = new Server(8391);
        ServletHandler handler = new ServletHandler ();
       
        Context context = new Context(server,"/",Context.SESSIONS);
       
        ServletHolder servlet = new ServletHolder(new XFireServlet());
View Full Code Here

    public void setUp() throws Exception
    {

        _resolver = new YadisResolver(new HttpFetcherFactory());

        _server = new Server(_servletPort);

        Context context = new Context(_server, "/", Context.SESSIONS);
        context.addServlet(new ServletHolder(new YadisTestServlet()), "/*");

        _server.start();
View Full Code Here

    public ConsumerAndProviderTest(final String testName) throws Exception
    {
        super(testName);
        int servletPort = Integer.parseInt(System.getProperty("SERVLET_PORT", "8989"));
        _server = new Server(servletPort);

        Context context = new Context(_server, "/", Context.SESSIONS);
        _baseUrl = "http://localhost:" + servletPort; // +
        // context.getContextPath();
View Full Code Here

        /* start the application */
        start();
    }

    private static void start() throws Exception {
        Server server =
                new Server(CoreUtils.getConfigDir() +
                File.separator + "jetty-config.xml");
        ServerMonitor.monitor();
        server.start();
    }
View Full Code Here

TOP

Related Classes of org.mortbay.jetty.Server

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.