Created
August 7, 2017 12:01
-
-
Save antonarhipov/73072de7bced1a99cf1c07b1d19104a2 to your computer and use it in GitHub Desktop.
Static initializer to start emebdded Jetty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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