How to make Jetty dynamically load “static” pages

前端 未结 10 784
耶瑟儿~
耶瑟儿~ 2020-12-02 14:57

I am building Java web applications, and I hate the traditional \"code-compile-deploy-test\" cycle. I want to type in one tiny change, then see the result INSTANTLY, without

10条回答
  •  一生所求
    2020-12-02 15:22

    Similar to @kybernetikos answer, but without having to recreate the DefaultServlet:

    // Startup stuff
    final Server server = new Server(port);
    WebAppContext webAppContext = new WebAppContext(path, "/")
    webAppContext.setInitParam(
            "org.eclipse.jetty.servlet.Default.useFileMappedBuffer", "false");
    
    server.setHandler(webAppContext);
    server.start();
    server.join();
    

    DefaultServlet will look for it's own copy of useFileMappedBuffer, which seems to be set deep inside of Jetty. But by prefixing the property name with as above, this value is preferred.

提交回复
热议问题