Jetty: How to change startup temp directory

后端 未结 1 718
一生所求
一生所求 2020-11-29 12:08

I\'m trying to deploy a vaadin application to jetty.

But when I run jetty using start.jar, it starts to a subfolder of

C:\\Users\\USERNAM

1条回答
  •  不知归路
    2020-11-29 12:19

    Jetty needs a working directory.

    Its search order for finding a work directory is as follows:

    1. If the WebAppContext has a temp directory specified, use it.
    2. If the ServletContext has the javax.servlet.context.tempdir attribute set, and if directory exists, use it.
    3. If a ${jetty.base}/work directory exists, use it (only valid for Jetty 9.1+)
    4. If a ${jetty.home}/work directory exists, use it.
      • Note: starting with Jetty 9.1 this test is now ${jetty.base}/work
    5. If a ServletContext has the org.eclipse.jetty.webapp.basetempdir attribute set, and if the directory exists, use it.
    6. Use System.getProperty("java.io.tmpdir") and use it.

    The easiest one is either #3 or #4, just create a work directory underneath your ${jetty.home} or ${jetty.base} and restart Jetty.

    The next easiest is #6, to specify your own java.io.tmpdir when you start the JVM for Jetty.

    [jetty-distribution]$ java -Djava.io.tmpdir=/var/web/work -jar start.jar
    

    The rest require you to configure the context for that deployed webapp.

    Example for Jetty 7 or Jetty 8:

    
    
    
      
      /var/web/webapps/foo.war
      /var/web/work/foo
    
    

    Example for Jetty 9 (just a dtd change):

    
    
    
      
      /var/web/webapps/foo.war
      /var/web/work/foo
    
    

    0 讨论(0)
提交回复
热议问题