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 + ")"); } } }
/** * 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; }
/** * 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; }
/** * This template method called from {@link #setUp()} to append appropriate init parameters to the test server. * The default implementation sets state saving method to the "server", default jsf page suffix to the ".xhtml" * and project stage to UnitTest */ protected void setupJsfInitParameters() { facesServer.addInitParameter( StateManager.STATE_SAVING_METHOD_PARAM_NAME, StateManager.STATE_SAVING_METHOD_SERVER); facesServer.addInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME, ".xhtml"); facesServer.addInitParameter(ProjectStage.PROJECT_STAGE_PARAM_NAME, ProjectStage.UnitTest.name()); }
/** * This template method called from {@link #setUp()} to append appropriate init parameters to the test server. * The default implementation sets state saving method to the "server", default jsf page suffix to the ".xhtml" * and project stage to UnitTest */ protected void setupJsfInitParameters() { facesServer.addInitParameter( StateManager.STATE_SAVING_METHOD_PARAM_NAME, StateManager.STATE_SAVING_METHOD_SERVER); facesServer.addInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME, ".xhtml"); facesServer.addInitParameter(ProjectStage.PROJECT_STAGE_PARAM_NAME, ProjectStage.UnitTest.name()); }
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++)
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++)
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++)
if (ps.name().equals(dsProjectStage.getClass().getSimpleName()))
if (ps.name().equals(dsProjectStage.getClass().getSimpleName()))