Package org.apache.myfaces.lifecycle

Examples of org.apache.myfaces.lifecycle.LifecycleImpl


     */
    protected void executePhase(FacesContext facesContext, PhaseId phase) throws Exception
    {
        if (lifecycle instanceof LifecycleImpl)
        {
            LifecycleImpl lifecycleImpl = (LifecycleImpl) lifecycle;
           
            int phaseId = phase.equals(PhaseId.RESTORE_VIEW) ? 0 :
                          phase.equals(PhaseId.APPLY_REQUEST_VALUES) ? 1 :
                          phase.equals(PhaseId.PROCESS_VALIDATIONS) ? 2 :
                          phase.equals(PhaseId.UPDATE_MODEL_VALUES) ? 3 :
                          phase.equals(PhaseId.INVOKE_APPLICATION) ? 4 : 5 ;
           
            Object phaseExecutor = null;
            if (phaseId < 5)
            {
                Field lifecycleExecutorsField = lifecycleImpl.getClass().getDeclaredField("lifecycleExecutors");
                if (!lifecycleExecutorsField.isAccessible())
                {
                    lifecycleExecutorsField.setAccessible(true);
                }
                phaseExecutor = ((Object[])lifecycleExecutorsField.get(lifecycleImpl))[phaseId];
            }
            else
            {
                Field renderExecutorField = lifecycleImpl.getClass().getDeclaredField("renderExecutor");
                if (!renderExecutorField.isAccessible())
                {
                    renderExecutorField.setAccessible(true);
                }
                phaseExecutor = renderExecutorField.get(lifecycleImpl);
            }
           
            Object phaseManager = facesContext.getAttributes().get(PHASE_MANAGER_INSTANCE);
            if (phaseManager == null)
            {
                Method getPhaseListenersMethod = lifecycleImpl.getClass().getDeclaredMethod("getPhaseListeners");
                if (!getPhaseListenersMethod.isAccessible())
                {
                    getPhaseListenersMethod.setAccessible(true);
                }
               
                Constructor<?> plmc = PHASE_MANAGER_CLASS.getDeclaredConstructor(new Class[]{Lifecycle.class, FacesContext.class, PhaseListener[].class});
                if (!plmc.isAccessible())
                {
                    plmc.setAccessible(true);
                }
                phaseManager = plmc.newInstance(lifecycle, facesContext, getPhaseListenersMethod.invoke(lifecycleImpl, null));
                facesContext.getAttributes().put(PHASE_MANAGER_INSTANCE, phaseManager);
            }
           
            Method executePhaseMethod = lifecycleImpl.getClass().getDeclaredMethod("executePhase", new Class[]{
                    FacesContext.class, PHASE_EXECUTOR_CLASS, PHASE_MANAGER_CLASS});
            if (!executePhaseMethod.isAccessible())
            {
                executePhaseMethod.setAccessible(true);
            }
View Full Code Here


     */
    protected void executePhase(FacesContext facesContext, PhaseId phase) throws Exception
    {
        if (lifecycle instanceof LifecycleImpl)
        {
            LifecycleImpl lifecycleImpl = (LifecycleImpl) lifecycle;
           
            int phaseId = phase.equals(PhaseId.RESTORE_VIEW) ? 0 :
                          phase.equals(PhaseId.APPLY_REQUEST_VALUES) ? 1 :
                          phase.equals(PhaseId.PROCESS_VALIDATIONS) ? 2 :
                          phase.equals(PhaseId.UPDATE_MODEL_VALUES) ? 3 :
                          phase.equals(PhaseId.INVOKE_APPLICATION) ? 4 : 5 ;
           
            Object phaseExecutor = null;
            if (phaseId < 5)
            {
                Field lifecycleExecutorsField = lifecycleImpl.getClass().getDeclaredField("lifecycleExecutors");
                if (!lifecycleExecutorsField.isAccessible())
                {
                    lifecycleExecutorsField.setAccessible(true);
                }
                phaseExecutor = ((Object[])lifecycleExecutorsField.get(lifecycleImpl))[phaseId];
            }
            else
            {
                Field renderExecutorField = lifecycleImpl.getClass().getDeclaredField("renderExecutor");
                if (!renderExecutorField.isAccessible())
                {
                    renderExecutorField.setAccessible(true);
                }
                phaseExecutor = renderExecutorField.get(lifecycleImpl);
            }
           
            Object phaseManager = facesContext.getAttributes().get(PHASE_MANAGER_INSTANCE);
            if (phaseManager == null)
            {
                Method getPhaseListenersMethod = lifecycleImpl.getClass().getDeclaredMethod("getPhaseListeners");
                if (!getPhaseListenersMethod.isAccessible())
                {
                    getPhaseListenersMethod.setAccessible(true);
                }
               
                Constructor<?> plmc = PHASE_MANAGER_CLASS.getDeclaredConstructor(new Class[]{Lifecycle.class, FacesContext.class, PhaseListener[].class});
                if (!plmc.isAccessible())
                {
                    plmc.setAccessible(true);
                }
                phaseManager = plmc.newInstance(lifecycle, facesContext, getPhaseListenersMethod.invoke(lifecycleImpl, null));
                facesContext.getAttributes().put(PHASE_MANAGER_INSTANCE, phaseManager);
            }
           
            Method executePhaseMethod = lifecycleImpl.getClass().getDeclaredMethod("executePhase", new Class[]{
                    FacesContext.class, PHASE_EXECUTOR_CLASS, PHASE_MANAGER_CLASS});
            if (!executePhaseMethod.isAccessible())
            {
                executePhaseMethod.setAccessible(true);
            }
View Full Code Here

   
    protected void executeBeforeRender(FacesContext facesContext) throws Exception
    {
        if (lifecycle instanceof LifecycleImpl)
        {
            LifecycleImpl lifecycleImpl = (LifecycleImpl) lifecycle;
           
            Object phaseExecutor = null;
            Field renderExecutorField = lifecycleImpl.getClass().getDeclaredField("renderExecutor");
            if (!renderExecutorField.isAccessible())
            {
                renderExecutorField.setAccessible(true);
            }
            phaseExecutor = renderExecutorField.get(lifecycleImpl);
           
            if (facesContext.getResponseComplete())
            {
                return;
            }
           
            Object phaseManager = facesContext.getAttributes().get(PHASE_MANAGER_INSTANCE);
            if (phaseManager == null)
            {
                Method getPhaseListenersMethod = lifecycleImpl.getClass().getDeclaredMethod("getPhaseListeners");
                if (!getPhaseListenersMethod.isAccessible())
                {
                    getPhaseListenersMethod.setAccessible(true);
                }
               
View Full Code Here

   
    public void executeAfterRender(FacesContext facesContext) throws Exception
    {
        if (lifecycle instanceof LifecycleImpl)
        {
            LifecycleImpl lifecycleImpl = (LifecycleImpl) lifecycle;
           
            Object phaseExecutor = null;
            Field renderExecutorField = lifecycleImpl.getClass().getDeclaredField("renderExecutor");
            if (!renderExecutorField.isAccessible())
            {
                renderExecutorField.setAccessible(true);
            }
            phaseExecutor = renderExecutorField.get(lifecycleImpl);
           
            Object phaseManager = facesContext.getAttributes().get(PHASE_MANAGER_INSTANCE);
            if (phaseManager == null)
            {
                Method getPhaseListenersMethod = lifecycleImpl.getClass().getDeclaredMethod("getPhaseListeners");
                if (!getPhaseListenersMethod.isAccessible())
                {
                    getPhaseListenersMethod.setAccessible(true);
                }
               
View Full Code Here

     */
    protected void executePhase(FacesContext facesContext, PhaseId phase) throws Exception
    {
        if (lifecycle instanceof LifecycleImpl)
        {
            LifecycleImpl lifecycleImpl = (LifecycleImpl) lifecycle;
           
            int phaseId = phase.equals(PhaseId.RESTORE_VIEW) ? 0 :
                          phase.equals(PhaseId.APPLY_REQUEST_VALUES) ? 1 :
                          phase.equals(PhaseId.PROCESS_VALIDATIONS) ? 2 :
                          phase.equals(PhaseId.UPDATE_MODEL_VALUES) ? 3 :
                          phase.equals(PhaseId.INVOKE_APPLICATION) ? 4 : 5 ;
           
            Object phaseExecutor = null;
            if (phaseId < 5)
            {
                Field lifecycleExecutorsField = lifecycleImpl.getClass().getDeclaredField("lifecycleExecutors");
                if (!lifecycleExecutorsField.isAccessible())
                {
                    lifecycleExecutorsField.setAccessible(true);
                }
                phaseExecutor = ((Object[])lifecycleExecutorsField.get(lifecycleImpl))[phaseId];
            }
            else
            {
                Field renderExecutorField = lifecycleImpl.getClass().getDeclaredField("renderExecutor");
                if (!renderExecutorField.isAccessible())
                {
                    renderExecutorField.setAccessible(true);
                }
                phaseExecutor = renderExecutorField.get(lifecycleImpl);
            }
           
            Object phaseManager = facesContext.getAttributes().get(PHASE_MANAGER_INSTANCE);
            if (phaseManager == null)
            {
                Method getPhaseListenersMethod = lifecycleImpl.getClass().getDeclaredMethod("getPhaseListeners");
                if (!getPhaseListenersMethod.isAccessible())
                {
                    getPhaseListenersMethod.setAccessible(true);
                }
               
                Constructor<?> plmc = PHASE_MANAGER_CLASS.getDeclaredConstructor(new Class[]{Lifecycle.class, FacesContext.class, PhaseListener[].class});
                if (!plmc.isAccessible())
                {
                    plmc.setAccessible(true);
                }
                phaseManager = plmc.newInstance(lifecycle, facesContext, getPhaseListenersMethod.invoke(lifecycleImpl, null));
                facesContext.getAttributes().put(PHASE_MANAGER_INSTANCE, phaseManager);
            }
           
            Method executePhaseMethod = lifecycleImpl.getClass().getDeclaredMethod("executePhase", new Class[]{
                    FacesContext.class, PHASE_EXECUTOR_CLASS, PHASE_MANAGER_CLASS});
            if (!executePhaseMethod.isAccessible())
            {
                executePhaseMethod.setAccessible(true);
            }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.lifecycle.LifecycleImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.