use of org.glassfish.grizzly.http.server.HttpServer in project jersey by jersey.
the class App method main.
/**
* Main application entry point.
*
* @param args application arguments.
*/
public static void main(String[] args) {
try {
System.out.println("Clipboard Jersey Example App");
final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, createApp(), false);
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
server.shutdownNow();
}
}));
server.start();
System.out.println(String.format("Application started.%n" + "Try out %s%s%n" + "Stop the application using CTRL+C", BASE_URI, ROOT_PATH));
Thread.currentThread().join();
} catch (IOException | InterruptedException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
}
}
use of org.glassfish.grizzly.http.server.HttpServer in project dukescript-presenters by dukescript.
the class Browser method server.
private static HttpServer server(RootPage r) {
int from = 8080;
int to = 65535;
// NOI18N
String port = System.getProperty("com.dukescript.presenters.browserPort");
if (port != null) {
from = to = Integer.parseInt(port);
}
HttpServer s = HttpServer.createSimpleServer(null, new PortRange(from, to));
final ServerConfiguration conf = s.getServerConfiguration();
conf.addHttpHandler(r, "/");
return s;
}
Aggregations