FACELETS_REFRESH_PERIOD的默认值是什么? [英] What is the default for FACELETS_REFRESH_PERIOD?
问题描述
在JSF应用程序中,参数javax.faces.FACELETS_REFRESH_PERIOD可用于启用/禁用XHTML文件的自动重新加载。
In a JSF application, the parameter javax.faces.FACELETS_REFRESH_PERIOD can be used to enable/disable automatic reloading of XHTML files.
我目前正在研究正确的配置对于生产部署,并偶然发现,我们目前运行FACELETS_REFRESH_PERIOD = 1即使在生产中,这显然不是一个好主意。
I am currently researching the right configuration for production deployments, and accidentally found out that we currently run with FACELETS_REFRESH_PERIOD=1 even in production, which is obviously not a good idea.
这导致的问题:是此参数的默认值?
This lead to the question: What is the default value for this parameter?
理想情况下,为了简单起见,我想从我们的生产配置中省略FACELETS_REFRESH_PERIOD,希望它使用安全默认值为-1。但是,这似乎并不是这样的,因为没有参数,刷新似乎启用(与Mojarra和MyFaces)。
Ideally, I'd like to just omit FACELETS_REFRESH_PERIOD from our production config for simplicity's sake, and hoped it would use a "safe" default value of -1. However, this does not seem to be the case, because without the parameter, refreshing seems to be enabled (with both Mojarra and MyFaces).
我检查了JSF规范,而它描述的参数,它不给出默认值。
I checked the JSF spec, and while it describes the parameter, it does not give a default. Is this a deliberate omission in the spec?
推荐答案
默认值取决于实现。
鉴于您使用的是Mojarra,您可以在 com.sun.faces.config.WebConfiguration
class:
Given that you're using Mojarra, you can find the default in the com.sun.faces.config.WebConfiguration
class:
768 FaceletsDefaultRefreshPeriod(
769 "javax.faces.FACELETS_REFRESH_PERIOD",
770 "2"
771 )
(行号来自Mojarra 2.0.0) / em>
(line numbers are from Mojarra 2.0.0)
因此,默认值为 2
。我在任何Mojarra文档中找不到这个。您可以向Mojarra的用户发布问题报告,以便更好地记录。
The default is thus 2
. I can't find this in any Mojarra documentation. It might be worth to post an issue report to Mojarra guys to better document it.
MyFaces已根据其文档还默认值 2
。
MyFaces has according its documentation also a default value of 2
.
更新:从Mojarra 2.2.11,如果项目阶段生产
-1 >。另请参见问题3788 。
Update: From Mojarra 2.2.11, the default value is set to -1
if project stage is Production
. See also issue 3788.
这篇关于FACELETS_REFRESH_PERIOD的默认值是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!