本文整理汇总了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();
}
示例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");
}
}
示例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();
}
示例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();
}
}
示例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 );
}
示例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();
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}