Refine search
@Override public void encodeBegin(FacesContext context, UIComponent component) throws IOException { ResponseWriter writer = context.getResponseWriter(); PrimeApplicationContext applicationContext = PrimeApplicationContext.getCurrentInstance(context); ProjectStage projectStage = context.getApplication().getProjectStage(); boolean csvEnabled = applicationContext.getConfig().isClientSideValidationEnabled(); ELContext elContext = context.getELContext(); ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory(); ValueExpression ve = expressionFactory.createValueExpression(elContext, themeParamValue, String.class); if (!projectStage.equals(ProjectStage.Production)) { writer.write("PrimeFaces.settings.projectStage='" + projectStage.toString() + "';");
protected void checkProjectStage(@Observes StartupEvent startupEvent) { javax.faces.application.ProjectStage jsfProjectStage = FacesContext.getCurrentInstance().getApplication().getProjectStage(); if(!ProxyUtils.getUnproxiedClass(this.projectStage.getClass()).getSimpleName().equals( jsfProjectStage.name() )) { this.logger.warning("The value of the JSF 2 project stage (" + jsfProjectStage.name() + ") is different from the CODI project stage (" + this.projectStage + ")"); } } }
private void setProjectStageFromValue(String value, ProjectStage defaultStage) { 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 = defaultStage; } }
if (FacesContext.getCurrentInstance().getApplication(). getProjectStage().equals(ProjectStage.Development)) { for (Class currClass = clazz; currClass != null && !javax.faces.render.Renderer.class.equals(currClass);
@Override public String getRequestPath() { final FacesContext facesContext = FacesContext.getCurrentInstance(); parameters.add(REQUEST_PARAM_RESOURCE_VERSION + "=" + resourceVersion); if (!facesContext.isProjectStage(ProjectStage.Production)) { parameters.add("stage=" + facesContext.getApplication().getProjectStage().toString()); return facesContext.getApplication().getViewHandler().getResourceURL(facesContext, pathBuilder.toString());
FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext externalContext = facesContext.getExternalContext(); facesContext.getExternalContext()).getWebConfigProvider(facesContext.getExternalContext()); if (webConfigProvider.getFacesServletMappings(facesContext.getExternalContext()).isEmpty()) { if (!facesContext.isProjectStage(ProjectStage.Production)) ProjectStage projectStage = facesContext.getApplication().getProjectStage(); StringBuilder message = new StringBuilder("\n\n"); message.append("*******************************************************************\n"); message.append("*** WARNING: Apache MyFaces-2 is running in "); message.append(projectStage.name().toUpperCase()); message.append(" mode."); int length = projectStage.name().length(); for (int i = 0; i < 11 - length; i++)
public ProjectStage getProjectStage() { // If the value has already been determined by a previous call to this // method, simply return that value. if (_projectStage == null) { FacesContext context = FacesContext.getCurrentInstance(); String stageName = context.getExternalContext().getInitParameter( ProjectStage.PROJECT_STAGE_PARAM_NAME); // If a value is found found if (stageName != null) { /* * see if an enum constant can be obtained by calling ProjectStage.valueOf(), passing the value from the * initParamMap. If this succeeds without exception, save the value and return it. */ try { _projectStage = ProjectStage.valueOf(stageName); return _projectStage; } catch (IllegalArgumentException e) { //log.log(Level.SEVERE, "Couldn't discover the current project stage", e); } } _projectStage = ProjectStage.Production; } return _projectStage; }
ResponseWriter writer = facesContext.getResponseWriter(); && JavascriptUtils.isJavascriptAllowed(facesContext.getExternalContext()) && !behaviors.isEmpty()) ProjectStage projectStage = facesContext.getApplication().getProjectStage(); if(projectStage.equals(ProjectStage.Development) || projectStage.equals(ProjectStage.UnitTest)) log.warning("ALT attribute is missing for : " + uiComponent.getId());
ResponseWriter writer = facesContext.getResponseWriter(); writer.startElement(HTML.SCRIPT_ELEM, component); writer.writeAttribute(HTML.SCRIPT_TYPE_ATTR, HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null); writer.endElement(HTML.SCRIPT_ELEM); } else { if (!facesContext.getApplication().getProjectStage().equals( ProjectStage.Production)) { facesContext.addMessage(component.getClientId(), new FacesMessage("Component with no name and no body content, so nothing rendered."));
public boolean isProjectStage(ProjectStage stage) { if (stage == null) { throw new NullPointerException(); } if (stage.equals(getApplication().getProjectStage())) { return true; } return false; }
/** * <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() + "($|,.*)"); }
ctx.getFacesContext().getAttributes().put("facelets.ContentType", v); ctx.getFacesContext().getAttributes().put(RIConstants.FACELETS_ENCODING_KEY, v); root.getAttributes().put(RIConstants.FACELETS_ENCODING_KEY, v); if (ctx.getFacesContext().getAttributes().containsKey("com.sun.faces.uiCompositionCount") && LOGGER.isLoggable(Level.INFO) && ctx.getFacesContext().getApplication().getProjectStage().equals(ProjectStage.Development)) { LOGGER.log(Level.INFO, "f:view contracts attribute found, but not used at top level");
@Override public void encodeBegin(FacesContext context, UIComponent component) throws IOException { ResponseWriter writer = context.getResponseWriter(); PrimeConfiguration cc = RequestContext.getCurrentInstance(context).getApplicationContext().getConfig(); ProjectStage projectStage = context.getApplication().getProjectStage(); writer.startElement("head", component); writer.writeAttribute("id", component.getClientId(context), "id"); UIViewRoot viewRoot = context.getViewRoot(); for (UIComponent resource : viewRoot.getComponentResources(context, "head")) { boolean shouldRender = true; if (!projectStage.equals(ProjectStage.Production) || cc.isLegacyWidgetNamespace()) { writer.startElement("script", null); writer.writeAttribute("type", "text/javascript", null); if (!projectStage.equals(ProjectStage.Production)) { writer.write("PrimeFaces.settings.projectStage='" + projectStage.toString() + "';");
WebConfiguration webConfig = WebConfiguration.getInstance(facesContext.getExternalContext()); String value = webConfig.getEnvironmentEntry(WebConfiguration.WebEnvironmentEntry.ProjectStage); projectStage = ProjectStage.valueOf(value); } catch (IllegalArgumentException iae) { if (LOGGER.isLoggable(INFO)) {
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 boolean isProjectStage(ProjectStage stage) { if (stage == null) { throw new NullPointerException(); } return stage.equals(getApplication().getProjectStage()); }
@Override public Object put(String key, Object value) { if (value != null && ProjectStage.Development.equals(stage) && !(value instanceof Serializable)) { LOGGER.log(Level.WARNING, "warning.component.uiviewroot_non_serializable_attribute_viewmap", new Object[] { key, value.getClass().getName() }); } return super.put(key, value); }
public FacesRenderKitImpl() { webConfig = WebConfiguration.getInstance(); String value = webConfig.getEnvironmentEntry(WebConfiguration.WebEnvironmentEntry.ProjectStage); if (value == null) { value = webConfig.getOptionValue(WebContextInitParameter.JavaxFacesProjectStage); } try { if (value != null) { if (ProjectStage.valueOf(value).equals(ProjectStage.Development)) { webConfig.overrideContextInitParameter(WebContextInitParameter.FaceletsDefaultRefreshPeriod, WebContextInitParameter.FaceletsDefaultRefreshPeriod.getDefaultValue()); } } } catch (IllegalArgumentException e) { } }
/** * 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(); } }
/** * Returns <code>true</code> if we're in JSF development stage. This will be the case when the * <code>javax.faces.PROJECT_STAGE</code> context parameter in <code>web.xml</code> is set to * <code>Development</code>. * @param context The involved servlet context. * @return <code>true</code> if we're in development stage, otherwise <code>false</code>. * @since 2.1 * @see Application#getProjectStage() */ public static boolean isFacesDevelopment(ServletContext context) { if (facesDevelopment == null) { String projectStage = null; try { projectStage = lookup(PROJECT_STAGE_JNDI_NAME); } catch (IllegalStateException ignore) { logger.log(FINEST, "Ignoring thrown exception; will only happen in buggy containers.", ignore); return false; // May happen in a.o. GlassFish 4.1 during startup. } if (projectStage == null) { projectStage = context.getInitParameter(PROJECT_STAGE_PARAM_NAME); } facesDevelopment = Development.name().equals(projectStage); } return facesDevelopment; }