/** * Gets the boolean init parameter value from the specified context. If the parameter was not specified, the default * value is used instead. * * @param context * the application's external context * @param names * the init parameter's names * * @return the init parameter value as a boolean * * @throws NullPointerException * if context or name is <code>null</code> */ public static boolean getBooleanInitParameter(ExternalContext context, String[] names) { return getBooleanInitParameter(context, names, false); }
/** * Gets the boolean init parameter value from the specified context. If the parameter was not specified, the default * value is used instead. * * @param context * the application's external context * @param name * the init parameter's name * @param deprecatedName * the init parameter's deprecated name. * @param defaultValue * the default value to return in case the parameter was not set * * @return the init parameter value as a boolean * * @throws NullPointerException * if context or name is <code>null</code> */ public static boolean getBooleanInitParameter(ExternalContext context, String name) { return getBooleanInitParameter(context, name, false); }
private boolean isResourceCachingEnabled() { if (_resourceCacheEnabled == null) { FacesContext facesContext = FacesContext.getCurrentInstance(); //first, check to make sure that ProjectStage is production, if not, skip caching if (!facesContext.isProjectStage(ProjectStage.Production)) { _resourceCacheEnabled = Boolean.FALSE; return _resourceCacheEnabled; } ExternalContext externalContext = facesContext.getExternalContext(); if (externalContext == null) { return false; //don't cache right now, but don't disable it yet either } //if in production, make sure that the cache is not explicitly disabled via context param _resourceCacheEnabled = WebConfigParamUtils.getBooleanInitParameter(externalContext, ResourceHandlerCache.RESOURCE_HANDLER_CACHE_ENABLED_ATTRIBUTE, ResourceHandlerCache.RESOURCE_HANDLER_CACHE_ENABLED_DEFAULT); if (log.isLoggable(Level.FINE)) { log.log(Level.FINE, "MyFaces Resource Caching Enabled=" + _resourceCacheEnabled); } } return _resourceCacheEnabled; }