簡體   English   中英

如何在 Jetty 中配置 webapps 部署目錄

[英]How to configure a webapps deployment directory in Jetty

這一定是一個簡單的答案,但我似乎找不到!

我剛剛開始在CentOS 5.5上使用Jetty 7.0.2 ,並使用默認設置部署了一個webapp (只需將我的 WAR 文件放在/webapps目錄中)。 當 Jetty 啟動時,它會將戰爭解壓到/tmp/jetty {something-warfilename-etc} 目錄中。

我知道 Jetty 有很多可以實現的自定義配置,但是現在,我只對設置提取的 war 文件的位置感興趣,這樣我就可以安全地修改.properties文件等。

提前致謝!

為什么不把解壓后的 war 文件放在webapps/中呢?

正如他們的文檔所說,如果 Jetty 在$JETTY_HOME/webapps/中找到目錄,它會很樂意將其部署為 servlet webapp。 然后您可以在不更改任何 Jetty 設置的情況下調整屬性文件。

這也意味着當您擁有應用程序的新版本時,您不必擔心 Jetty 會覆蓋對屬性文件的任何更改(盡管您仍然必須小心這一點)。

我知道這個問題很老,但我想要一個配置參數的答案,而不是解壓的 WAR 解決方案。 配置解決方案是在WebAppProvider中添加如下參數(在 8.1.8 中,這是在jetty-webapps.xml ):

<Set name="tempDir"><New class="java.io.File"><Arg>/usr/local/jetty-8.1.8/work</Arg></New></Set>

以便整個配置文件讀取如下內容:

<Configure id="Server" class="org.eclipse.jetty.server.Server">
    <Ref id="DeploymentManager">
          <Call id="webappprovider" name="addAppProvider">
            <Arg>
              <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
                <Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps</Set>
                <Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>
                <Set name="scanInterval">1</Set>
                <Set name="contextXmlDir"><Property name="jetty.home" default="." />/contexts</Set>
                <Set name="extractWars">true</Set>
                <Set name="tempDir"><New class="java.io.File"><Arg>/usr/local/jetty-8.1.8/work</Arg></New></Set>
              </New>
            </Arg>
          </Call>
    </Ref>
</Configure>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM