private static final String CONTENT_PATH = "/content";
public static void main(String[] args) throws IOException, URISyntaxException, InterruptedException {
final int port = System.getenv("PORT") != null ? Integer.valueOf(System.getenv("PORT")) : 8080;
final URI baseUri = UriBuilder.fromUri("http://0.0.0.0/").port(port).build();
final Application application = Application.builder(ResourceConfig.builder().packages(BarServer.class.getPackage().getName()).build()).build();
application.addModules(new JsonJacksonModule());
final HttpServer httpServer = GrizzlyHttpServerFactory.createHttpServer(baseUri, application);
httpServer.getServerConfiguration().addHttpHandler(new StaticHttpHandler("src/main/webapp"), CONTENT_PATH);
for (NetworkListener networkListener : httpServer.getListeners()) {
if (System.getenv("FILE_CACHE_ENABLED") == null) {