码头如何弄清楚是否在开始时发动战争 [英] How does jetty figures out whether to expand a war on start or not

查看:69
本文介绍了码头如何弄清楚是否在开始时发动战争的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的Web应用程序使用Jetty服务器. 码头总是在服务器启动时扩展war文件吗? 如果不是,我该怎么做呢? 可以说,在第一次启动/部署后,现在如果我将战争文件替换为旧的战争文件,码头不会扩展旧的战争文件.

I am using Jetty server for for my web application. does jetty always expand a war file on server start? if not the how can i make it do so? lets say after first time start/deployment, now if i replace the war file to an old war file, jetty does not expand old war file.

推荐答案

默认情况下,Jetty始终会扩展WAR文件.

By default, Jetty always expands WAR files.

您可以使用但是,我想您实际上要问的是,Web应用程序/Servlet规范临时目录逻辑是如何工作的?

However, what I think you are actually asking about, is how does the web app / servlet spec temp directory logic work?

Jetty使用的tempDirectory由许多因素决定,这些因素主要由servlet规范规定. 有关详细信息,请参阅有关tempDirectory配置主题的先前答案.

The tempDirectory used by Jetty is determined by a number of factors, mostly dictated by the servlet spec. See prior answer about the topic of tempDirectory configuration for details.

当未指定/未配置临时目录时,使用

When the temp directory is unspecified / unconfigured a new temp directory is created using the following rough syntax.

File tempDir = new File(System.getProperty("java.io.tmpdir") +
   File.separator + "jetty-" + host + "-" + port + "-" + 
   resourceBase + "-_" + context + "-" + virtualhost + "-" + randomdigits +
   ".dir");

所使用的临时目录是持久性的,这意味着在服务器关闭时不会将其删除. 当确定WAR文件(或上下文可部署的XML)比持久性temp目录中的内容新时,可以使用temp目录将WAR解压缩.

The temp directory used is persisted, meaning it is not deleted on server shutdown. The temp directory is used to unpack the WAR into when the WAR file (or context deployable XML) is determined to be newer than the content in the persisted temp directory.

从Jetty 9.1开始,现在有一个WebAppContext.setPersistTempDirectory(boolean)可用于关闭临时目录的持久性.

Starting with Jetty 9.1, there is now a WebAppContext.setPersistTempDirectory(boolean) that can be used to turn off the temp directory persistence.

这篇关于码头如何弄清楚是否在开始时发动战争的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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