本文整理匯總了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
}
示例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();
}
示例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();
}
示例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();
}
示例9: shutdown
import org.glassfish.grizzly.http.server.HttpServer; //導入方法依賴的package包/類
private void shutdown(final HttpServer httpServer) {
httpServer.shutdown();
}
示例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();
}