How to make Jetty dynamically load “static” pages

前端 未结 10 802
耶瑟儿~
耶瑟儿~ 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条回答
  •  旧时难觅i
    2020-12-02 15:25

    I also had this problem.

    And I didn't want to create any additional classes and messing with web.xml

    So here is what you can do:

    Assuming you project is maven based and (lets say) called 'my-web-app'

    1. create a file my-web-app/jetty/jetty-config.xml

    2. put this stuff inside:

      
      
         
           org.eclipse.jetty.servlet.Default.useFileMappedBuffer
           false
         
      
      
    3. Here is your jetty config:

      
          org.eclipse.jetty
          jetty-maven-plugin
          
              
                  localhost
                  8801
              
              
                  /${project.artifactId}
              
              ${project.basedir}/jetty/jetty-config.xml
          
      
      

    This solution will add an attribute to you servlet-context which will disable static resources locking.

    Have fun :)

提交回复
热议问题