當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpServer.shutdown方法代碼示例

本文整理匯總了Java中org.glassfish.grizzly.http.server.HttpServer.shutdown方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpServer.shutdown方法的具體用法?Java HttpServer.shutdown怎麽用?Java HttpServer.shutdown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.glassfish.grizzly.http.server.HttpServer的用法示例。


在下文中一共展示了HttpServer.shutdown方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException {

		// register the endpoint resource
		final ResourceConfig config = new ResourceConfig().register(ProductEndpoint.class);

		// create and start Grizzly server
		final HttpServer grizzlyServer = GrizzlyHttpServerFactory
				.createHttpServer(URI.create("http://localhost:8080/api/"), config);
		grizzlyServer.start();

		// wait for a key press to shutdown
		System.in.read();
		grizzlyServer.shutdown();

	}
 
開發者ID:holon-platform,項目名稱:holon-examples,代碼行數:16,代碼來源:Server.java

示例2: startServer

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
public static void startServer(final int port) throws Exception {
	final URI baseUri = URI.create("http://" + InetAddress.getLocalHost().getHostAddress() + ":" +
			(port > 0 ? port : DEFAULT_PORT));
	final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(baseUri,
			new WatcherConfiguration());

	System.in.read();
	server.shutdown();
}
 
開發者ID:sskorol,項目名稱:selenium-camp-samples,代碼行數:10,代碼來源:WatcherServer.java

示例3: main

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException {
    String host = "0.0.0.0";
    int port = 8080;
    if (args.length > 0) {
        host = args[0];
    }
    if (args.length > 1) {
        port = Integer.parseInt(args[1]);
    }

    final HttpServer server = startServer(host,port);
    System.in.read();
    server.shutdown();
}
 
開發者ID:smallnest,項目名稱:Jax-RS-Performance-Comparison,代碼行數:15,代碼來源:Main.java

示例4: main

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
public static void main(String[] args) {

        OSM osm = new OSM(args[0]);

        if (args.length > 1 && args[1].startsWith("--load")) {
            osm.intersectionDetection = true;
            osm.tileIndexing = true;
            if (args[1].equalsIgnoreCase("--loadurl")) {
                osm.readFromUrl(args[2]);
            } else {
                osm.readFromFile(args[2]);
            }
            // TODO catch writing exceptions here and shut down properly, closing OSM database.
            LOG.info("Done populating OSM database.");
            osm.close();
            return;
        }

        Thread updateThread = Updater.spawnUpdateThread(osm);

        LOG.info("Starting VEX HTTP server on port {} of interface {}", PORT, BIND_ADDRESS);
        HttpServer httpServer = new HttpServer();
        httpServer.addListener(new NetworkListener("vanilla_extract", BIND_ADDRESS, PORT));
        // Bypass Jersey etc. and add a low-level Grizzly handler.
        // As in servlets, * is needed in base path to identify the "rest" of the path.
        httpServer.getServerConfiguration().addHttpHandler(new VexHttpHandler(osm), "/*");
        try {
            httpServer.start();
            LOG.info("VEX server running.");
            Thread.currentThread().join();
            updateThread.interrupt();
        } catch (BindException be) {
            LOG.error("Cannot bind to port {}. Is it already in use?", PORT);
        } catch (IOException ioe) {
            LOG.error("IO exception while starting server.");
        } catch (InterruptedException ie) {
            LOG.info("Interrupted, shutting down.");
        }
        httpServer.shutdown();
    }
 
開發者ID:conveyal,項目名稱:osm-lib,代碼行數:41,代碼來源:VanillaExtract.java

示例5: startServer

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
/**
 * Starts Grizzly HTTP server exposing JAX-RS resources defined in this application.
 * @return Grizzly HTTP server.
 */
public static HttpServer startServer() {
    //final ResourceConfig rc = new ResourceConfig().packages("org.cycleourcity.server.services");
	
	HttpServer server = null;
	
	try{
		final ResourceConfig app = new CycleOurCityApp();
		server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), app);
		return server;
	}catch(Exception e){
		if(server != null) server.shutdown();
		throw e;
	}
}
 
開發者ID:rodrigojmlourenco,項目名稱:CycleOurCity,代碼行數:19,代碼來源:Main.java

示例6: stop

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
/**
 * Stop.
 */
public synchronized void stop() {
  for (HttpServer server : serverList) {
    server.shutdown();
  }
  LensServices.get().stop();
  printShutdownMessage();
}
 
開發者ID:apache,項目名稱:lens,代碼行數:11,代碼來源:LensServer.java

示例7: startServer

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
public static void startServer(final int port) throws Exception {
    final URI baseUri = URI.create("http://" + InetAddress.getLocalHost().getHostAddress() + ":" + port);
    final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(baseUri, new WatcherConfiguration());

    System.in.read();
    server.shutdown();
}
 
開發者ID:atinfo,項目名稱:at.info-knowledge-base,代碼行數:8,代碼來源:WatcherServer.java

示例8: startServer

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
public static void startServer(final int port) throws Exception {
    final URI baseUri = URI.create("http://" + InetAddress.getLocalHost().getHostAddress() + ":" + port + "/selenium");
    final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(baseUri, new ServerConfiguration());

    System.in.read();
    server.shutdown();
}
 
開發者ID:atinfo,項目名稱:at.info-knowledge-base,代碼行數:8,代碼來源:Server.java

示例9: shutdown

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
private void shutdown(final HttpServer httpServer) {
  httpServer.shutdown();
}
 
開發者ID:HuygensING,項目名稱:antioch,代碼行數:4,代碼來源:Server.java

示例10: main

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException {
  HttpServer server = startServer();
  System.out.println("server started at http://localhost:" + PORT + "/");
  System.in.read();
  server.shutdown();
}
 
開發者ID:vita-us,項目名稱:ViTA,代碼行數:7,代碼來源:Main.java


注:本文中的org.glassfish.grizzly.http.server.HttpServer.shutdown方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。