Skip to content

Instantly share code, notes, and snippets.

@antonarhipov
Created August 7, 2017 12:01
Show Gist options
  • Save antonarhipov/73072de7bced1a99cf1c07b1d19104a2 to your computer and use it in GitHub Desktop.
Save antonarhipov/73072de7bced1a99cf1c07b1d19104a2 to your computer and use it in GitHub Desktop.
Static initializer to start emebdded Jetty
public class App {
static {
new Thread(() -> {
Server server = new Server(8080);
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
server.setHandler(context);
try {
server.start();
server.join();
} catch (Exception e) {
e.printStackTrace();
}
}).start();
}
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment