码头:如何更改启动临时目录 [英] Jetty: How to change startup temp directory

查看:81
本文介绍了码头:如何更改启动临时目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一个vaadin应用程序部署到码头.

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

但是当我使用start.jar运行码头时,它开始到

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

C:\Users\USERNAME\AppData\Local\Temp\jetty-0.0.0.0-8080-Application.war-....

尽管我已将其放入C:\Program Files\MyApp,但它始终在其中运行-包括保存的文件.

Although I've put it into C:\Program Files\MyApp, it always runs there - including the files it saves.

我如何告诉码头在它所在的地方开始,并且所有文件都相对于该基地?

How do I tell jetty to start right where it resides, and have all files relatively to this base?

我在Windows 7上,我们在谈论的是最新的独立码头包.

I'm on Windows 7, we're talking about the most recent, standalone jetty package.

任何想法都值得赞赏.

推荐答案

Jetty需要一个工作目录.

Jetty needs a working directory.

查找工作目录的搜索顺序如下:

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

  1. 如果 WebAppContext已指定了一个临时目录,请使用它.
  2. 如果ServletContext设置了javax.servlet.context.tempdir属性,并且目录存在,请使用它.
  3. 如果存在${jetty.base}/work目录,请使用它(仅对Jetty 9.1+有效)
  4. 如果存在${jetty.home}/work目录,请使用它.
    • 注意:从Jetty 9.1开始,此测试现在为${jetty.base}/work
  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

最简单的一个是#3 #4 ,只需在${jetty.home}${jetty.base}下创建一个work目录,然后重新启动Jetty.

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

下一个最简单的是#6 ,用于在启动Jetty JVM时指定自己的java.io.tmpdir.

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

其余的要求您为已部署的Web应用程序配置上下文.

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

Jetty 7或Jetty 8的示例:

Example for Jetty 7 or Jetty 8:

<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
                           "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath"><Property name="foo"/></Set>
  <Set name="war">/var/web/webapps/foo.war</Set>
  <Set name="tempDirectory">/var/web/work/foo</Set>
</Configure>

Jetty 9的示例(只是一个dtd更改):

Example for Jetty 9 (just a dtd change):

<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
                           "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath"><Property name="foo"/></Set>
  <Set name="war">/var/web/webapps/foo.war</Set>
  <Set name="tempDirectory">/var/web/work/foo</Set>
</Configure>

这篇关于码头:如何更改启动临时目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆