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


Java HttpServer.stop方法代碼示例

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


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

示例1: main

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
/**
 * Main method.
 * @param args
 * @throws IOException
 */
public static void main(String[] args) throws IOException {
    Logger log = Logger.getLogger(Main.class.getName());

    log.log(Level.WARNING,"Starting server .....");

    Logger log2 = Logger.getLogger("org.glassfish");
    log2.setLevel(Level.ALL);
    log2.addHandler(new java.util.logging.ConsoleHandler());

    final HttpServer server = startServer();
    System.out.println(String.format("Jersey app started with WADL available at "
            + "%sapplication.wadl\nHit enter to stop it...", BASE_URI));
    System.in.read();
    server.stop();
}
 
開發者ID:Fiware,項目名稱:NGSI-LD_Wrapper,代碼行數:21,代碼來源:Main.java

示例2: main

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException {
    Logger root = Logger.getLogger("");
    Handler[] handlers = root.getHandlers();
    for (Handler h : handlers) {
        h.setLevel(Level.INFO);
    }
    if (args.length>=1) CommonResources.CONF_FILE=args[1];
    
    Logger ehcacheL = Logger.getLogger("net.sf.ehcache");
    ehcacheL.setLevel(Level.INFO);
    CommonResources.initialize();
    if (CommonResources.back != null && CommonResources.front != null) {
        try {
            HttpServer httpServer = startServer();
            HttpServer adminServer = startAdminServer();
            System.out.println("Server Started");
            System.in.read();
            httpServer.stop();
            adminServer.stop();
        } catch (CacheException ex) {
            Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
        }
    } else {
        Logger.getLogger(App.class.getName()).log(Level.SEVERE, "Caches not fully initialized... exiting");
    }
}
 
開發者ID:framegrace,項目名稱:beume,代碼行數:27,代碼來源:App.java

示例3: main

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
/**
 * Main method.
 * 
 * @param args
 * @throws IOException
 */
public static void main(String[] args) throws IOException {
	if (args.length < 1) {
		System.out.println("Usage: App [port]");
		System.exit(-1);
	}
	int port = Integer.parseInt(args[0]);
	App.BASE_URI = "http://localhost:" + port + "/myapp/";

	final HttpServer server = startServer();
	System.out.println(String.format(
			"Jersey app started with WADL available at "
					+ "%sapplication.wadl\nHit enter to stop it...",
			BASE_URI));
	System.in.read();
	server.stop();
}
 
開發者ID:vdialani,項目名稱:CloudComputing,代碼行數:23,代碼來源:App.java

示例4: run_rest

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
public static void run_rest(int port) throws IOException {
//        startH2Console();
        HttpServer httpServer = startServer(port);
        String addr = InetAddress.getLocalHost().getHostAddress() + ":" + port;
        System.out.println(String.format("Jersey app started with WADL available at "
                        + "%s/application.wadl\nTry out %s/missings\nPress Ctrl-C for exit.",
                        addr, addr));

        try {
            Thread.currentThread().join();
        } catch(Exception ex) {
            System.out.println(ex.getMessage());
        } finally {
            httpServer.stop();
        }
    }
 
開發者ID:dbpedia,項目名稱:MissingBot,代碼行數:17,代碼來源:Main.java

示例5: testJsonSerialization_application

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
@Test
public void testJsonSerialization_application() throws Exception {

	// This test guarantees that in an non-OSGi environment,
	// our REST application uses the properties we define.
	// And, in particular, the JSon serialization that we tailored.

	URI uri = UriBuilder.fromUri( "http://localhost/" ).port( 8090 ).build();
	RestApplication restApp = new RestApplication( this.manager );
	HttpServer httpServer = null;
	String received = null;

	try {
		httpServer = GrizzlyServerFactory.createHttpServer( uri, restApp );
		Assert.assertTrue( httpServer.isStarted());
		URI targetUri = UriBuilder.fromUri( uri ).path( UrlConstants.APPLICATIONS ).build();
		received = Utils.readUrlContent( targetUri.toString());

	} finally {
		if( httpServer != null )
			httpServer.stop();
	}

	String expected = JSonBindingUtils.createObjectMapper().writeValueAsString( Arrays.asList( this.app ));
	Assert.assertEquals( expected, received );
}
 
開發者ID:roboconf,項目名稱:roboconf-platform,代碼行數:27,代碼來源:ServletRegistrationComponentTest.java

示例6: main

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException 
{
    final HttpServer server = startServer();
    
    System.out.println(
            String.format("NERD API started with WADL available at " + 
                          "%sapplication.wadl", 
            BASE_URI)
     );
    
    Thread warmUp = new Thread() {
        public void run() {}
    };
    warmUp.start();
    while(running) {
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    
    System.in.read();
    server.stop();        
}
 
開發者ID:NERD-project,項目名稱:nerd-api,代碼行數:26,代碼來源:Server.java

示例7: main

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException {
    try {
        FileHandler fh = new FileHandler("Doodle.log");
        logger.addHandler(fh);
        //logger.setLevel(Level.ALL);  
        SimpleFormatter formatter = new SimpleFormatter();
        fh.setFormatter(formatter);
        Engine.getInstance();
        // the following statement is used to log any messages  
        logger.info("Service started");
        HttpServer httpServer = startServer();
        System.out.println(String.format("Jersey app started with WADL available at "
                + "%sapplication.wadl\nTry out %sverbalizer\nHit enter to stop it...",
                BASE_URI, BASE_URI));
        System.in.read();
        httpServer.stop();
    } catch (Exception e) {
        logger.warning("Messed up handlers");
        e.printStackTrace();
    }
}
 
開發者ID:dice-group,項目名稱:DALI,代碼行數:22,代碼來源:Main.java

示例8: main

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
/**
 * Main method.
 * @param args
 * @throws IOException
 */
public static void main(String[] args) throws IOException {
    final HttpServer server = startServer();
    System.out.println(String.format("Jersey app started with WADL available at "
            + "%sapplication.wadl\nHit enter to stop it...", BASE_URI));
    System.in.read();
    server.stop();
}
 
開發者ID:ljug,項目名稱:java-tutorials,代碼行數:13,代碼來源:Main.java

示例9: main

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
/**
 * Main method.
 * @param args
 * @throws IOException
 */
public static void main(String[] args) throws IOException {
    EntityManagerFactory emf =
  Persistence.createEntityManagerFactory("net.cofares.ljug_jersey-service_jar_1.0-SNAPSHOTPU");
 
 //EntityManager em = emf.createEntityManager();
    final HttpServer server = startServer();
    System.out.println(String.format("Jersey app started with WADL available at "
            + "%sapplication.wadl\nHit enter to stop it...", BASE_URI));
    System.in.read();
    server.stop();
}
 
開發者ID:ljug,項目名稱:java-tutorials,代碼行數:17,代碼來源:Main.java

示例10: main

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
/**
 * Main method.
 * 
 * @param args
 * @throws IOException
 */
public static void main(String[] args) throws IOException {
	SLF4JBridgeHandler.removeHandlersForRootLogger();
	SLF4JBridgeHandler.install();
	final HttpServer server = startServer();
	System.out.println(String.format(
			"Jersey app started with WADL available at "
					+ "%sapplication.wadl\nHit enter to stop it...",
			BASE_URI));
	System.in.read();
	server.stop();
}
 
開發者ID:nherbaut,項目名稱:jersey-hateos-example,代碼行數:18,代碼來源:Main.java

示例11: main

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException {
    final HttpServer server = startServer();
    logger.info(String.format("Jersey app started with WADL available at "
            + "%sapplication.wadl\nHit enter to stop it...", BASE_URI));
    System.in.read();
    server.stop();
}
 
開發者ID:psenger,項目名稱:Jersey2-Security-JWT,代碼行數:8,代碼來源:Main.java

示例12: main

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

	final HttpServer server = startServer();
	
	CycleOurCityManager.getInstance();
	CycleOurCitySecurityManager.getManager();
	
    System.out.println(String.format("Jersey app started with WADL available at "
            + "%sapplication.wadl\nHit enter to stop it...", BASE_URI));
    System.in.read();
    server.stop();
}
 
開發者ID:rodrigojmlourenco,項目名稱:CycleOurCity,代碼行數:18,代碼來源:Main.java

示例13: main

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
public static void main(String... args) throws Exception {
    ResourceConfig rc = new ResourceConfig(
        ContactsResource.class, Main.class
    );
    URI u = new URI("http://0.0.0.0:8080/");
    HttpServer server = GrizzlyHttpServerFactory.createHttpServer(u, rc);
    System.err.println("Server running on following IP addresses:");
    dumpIPs();
    System.err.println("Press Enter to shutdown the server");
    System.in.read();
    server.stop();
}
 
開發者ID:dukescript,項目名稱:maven-archetypes,代碼行數:13,代碼來源:Main.java

示例14: main

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
/**
 * Main method.
 * @param args
 * @throws IOException
 */
public static void main(String[] args) throws IOException {
    logger.info("Entered the main method...");
    final HttpServer server = startServer();


    logger.info(String.format("Jersey app started with WADL available at "
            + "%sapplication.wadl\nHit enter to stop it...", BASE_URI));

    System.in.read();
    server.stop();
}
 
開發者ID:jtmrice,項目名稱:IEPD-Java-Bindings,代碼行數:17,代碼來源:Main.java

示例15: main

import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
/**
 * Main method.
 * @param args
 * @throws IOException
 */
public static void main(String[] args) throws IOException {
		Resource.populateData();
    final HttpServer server = startServer();
    System.out.println(String.format("Jersey app started with WADL available at "
            + "%sapplication.wadl\nHit enter to stop it...", BASE_URI));
    System.in.read();
    server.stop();
}
 
開發者ID:vdialani,項目名稱:CloudComputing,代碼行數:14,代碼來源:App.java


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