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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With