use of com.sun.faces.config.WebConfiguration.WebContextInitParameter.JakartaFacesProjectStage in project mojarra by eclipse-ee4j.
the class AbstractConfigProcessor method getProjectStage.
private ProjectStage getProjectStage(ServletContext sc, FacesContext facesContext) {
final String projectStageKey = AbstractConfigProcessor.class.getName() + ".PROJECTSTAGE";
ProjectStage projectStage = (ProjectStage) sc.getAttribute(projectStageKey);
if (projectStage == null) {
WebConfiguration webConfig = WebConfiguration.getInstance(facesContext.getExternalContext());
String value = webConfig.getEnvironmentEntry(WebConfiguration.WebEnvironmentEntry.ProjectStage);
if (value != null) {
if (LOGGER.isLoggable(FINE)) {
LOGGER.log(FINE, "ProjectStage configured via JNDI: {0}", value);
}
} else {
value = webConfig.getOptionValue(JakartaFacesProjectStage);
if (value != null) {
if (LOGGER.isLoggable(FINE)) {
LOGGER.log(FINE, "ProjectStage configured via servlet context init parameter: {0}", value);
}
}
}
if (value != null) {
try {
projectStage = ProjectStage.valueOf(value);
} catch (IllegalArgumentException iae) {
if (LOGGER.isLoggable(INFO)) {
LOGGER.log(INFO, "Unable to discern ProjectStage for value {0}.", value);
}
}
}
if (projectStage == null) {
projectStage = Production;
}
sc.setAttribute(projectStageKey, projectStage);
}
return projectStage;
}
Aggregations