What is the default for FACELETS_REFRESH_PERIOD?

ⅰ亾dé卋堺 提交于 2020-01-01 08:04:01

问题


In a JSF application, the parameter javax.faces.FACELETS_REFRESH_PERIOD can be used to enable/disable automatic reloading of XHTML files.

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?

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).

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?


回答1:


The default is implementation dependent.

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         )

(line numbers are from Mojarra 2.0.0)

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 has according its documentation also a default value of 2.


Update: From Mojarra 2.2.11, the default value is set to -1 if project stage is Production. See also issue 3788.



来源:https://stackoverflow.com/questions/13033070/what-is-the-default-for-facelets-refresh-period

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!