Package org.geomajas.jetty

Source Code of org.geomajas.jetty.JettyRunner

/*
* This is part of Geomajas, a GIS framework, http://www.geomajas.org/.
*
* Copyright 2008-2011 Geosparc nv, http://www.geosparc.com/, Belgium.
*
* The program is available in open source according to the GNU Affero
* General Public License. All contributions in this program are covered
* by the Geomajas Contributors License Agreement. For full licensing
* details, see LICENSE.txt in the project root.
*/

package org.geomajas.jetty;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.webapp.WebAppContext;

/**
* Simple runner for starting a web application. Intended to fix problems when running GWT applications in eclipse.
*
* @author Jan De Moerloose
*/
public final class JettyRunner {

  private JettyRunner() {
    // hide constructor
  }

  public static void main(String[] args) throws Exception {
    Server server = startServer();
    server.join();
  }

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

    SelectChannelConnector connector = new SelectChannelConnector();
    connector.setPort(8888);
    server.addConnector(connector);

    WebAppContext webApp = new WebAppContext();
    webApp.setContextPath("/");
    webApp.setWar("src/main/webapp");
    server.setHandler(webApp);
    server.start();
    return server;
  }

}
TOP

Related Classes of org.geomajas.jetty.JettyRunner

TOP
Copyright © 2018 www.massapi.com. 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.