writer.write("PrimeFaces.settings.projectStage='" + projectStage.toString() + "';");
/** * Lookup the configured stage by looking for the parameter <code>stage<code>. * If the value of <code>stage</code> cannot be determined, the default * {@link javax.faces.application.ProjectStage#Production} is returned. * * @see ObjectFactory#getObjectInstance(Object, javax.naming.Name, javax.naming.Context, * java.util.Hashtable) */ @Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { if (obj instanceof Reference) { Reference ref = (Reference) obj; RefAddr addr = ref.get("stage"); if (addr != null) { String val = (String) addr.getContent(); if (val != null) { return val.trim(); } } else { if (LOGGER.isLoggable(WARNING)) { LOGGER.warning("'stage' property not defined. Defaulting to Production"); } } } return Production.toString(); } }
/** * Lookup the configured stage by looking for the parameter <code>stage<code>. * If the value of <code>stage</code> cannot be determined, the default * {@link javax.faces.application.ProjectStage#Production} is returned. * * @see ObjectFactory#getObjectInstance(Object, javax.naming.Name, javax.naming.Context, * java.util.Hashtable) */ @Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { if (obj instanceof Reference) { Reference ref = (Reference) obj; RefAddr addr = ref.get("stage"); if (addr != null) { String val = (String) addr.getContent(); if (val != null) { return val.trim(); } } else { if (LOGGER.isLoggable(WARNING)) { LOGGER.warning("'stage' property not defined. Defaulting to Production"); } } } return Production.toString(); } }
return ProjectStage.Production.toString();
/** * Lookup the configured stage by looking for the parameter <code>stage<code>. * If the value of <code>stage</code> cannot be determined, the default * {@link javax.faces.application.ProjectStage#Production} is returned. * * @see ObjectFactory#getObjectInstance(Object, javax.naming.Name, javax.naming.Context, * java.util.Hashtable) */ @Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { if (obj instanceof Reference) { Reference ref = (Reference) obj; RefAddr addr = ref.get("stage"); if (addr != null) { String val = (String) addr.getContent(); if (val != null) { return val.trim(); } } else { if (LOGGER.isLoggable(WARNING)) { LOGGER.warning("'stage' property not defined. Defaulting to Production"); } } } return Production.toString(); } }
/** * <p> * Determines if the feature is enabled in current project stage. * </p> * * <p> * Can be configured with either any {@link ProjectStage} items separated by comma, or with keyword 'All' or 'None' * representing all application stages or no stage respectively. * </p> * * @return true if the feature is enabled in current stage; false otherwise */ private boolean enabled() { String configuredPhases = PropertiesMappingConfiguration.getConfiguration(associatedConfiguration); if (configuredPhases == null) { return false; } ProjectStage projectStage = FacesContext.getCurrentInstance().getApplication().getProjectStage(); return "All".equals(configuredPhases) || configuredPhases.matches("(^|.*,)" + projectStage.toString() + "($|,.*)"); }
parameters.add("stage=" + facesContext.getApplication().getProjectStage().toString());
if (facesContext.getApplication().getProjectStage().toString().toLowerCase().trim().equals("development")){ logger.info("Handler is not used with Myfaces unless both org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS" + " and org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE context-params are true");
@Override public String getRequestPath() { String path; if (_resourceHandlerSupport.isExtensionMapping()) { path = ResourceHandler.RESOURCE_IDENTIFIER + '/' + getResourceName() + _resourceHandlerSupport.getMapping(); } else { String mapping = _resourceHandlerSupport.getMapping(); path = ResourceHandler.RESOURCE_IDENTIFIER + '/' + getResourceName(); path = (mapping == null) ? path : mapping + path; } FacesContext facesContext = FacesContext.getCurrentInstance(); String metadata = null; boolean useAmp = false; if (getLibraryName() != null) { metadata = "?ln=" + getLibraryName(); path = path + metadata; useAmp = true; if (!facesContext.isProjectStage(ProjectStage.Production) && ResourceLoaderUtils.JSF_JS_RESOURCE_NAME.equals(getResourceName()) && ResourceLoaderUtils.JAVAX_FACES_LIBRARY_NAME.equals(getLibraryName())) { // append &stage=?? for all ProjectStages except Production path = path + "&stage=" + facesContext.getApplication().getProjectStage().toString(); } } return facesContext.getApplication().getViewHandler().getResourceURL(facesContext, path); }
path = path + "&stage=" + facesContext.getApplication().getProjectStage().toString();
path = path + "&stage=" + facesContext.getApplication().getProjectStage().toString();
path = path + "&stage=" + facesContext.getApplication().getProjectStage().toString();
path = path + "&stage=" + facesContext.getApplication().getProjectStage().toString();
path = path + "&stage=" + facesContext.getApplication().getProjectStage().toString();
writer.write("PrimeFaces.settings.projectStage='" + projectStage.toString() + "';");
writer.write("PrimeFaces.settings.projectStage='" + projectStage.toString() + "';");