Examples of Flash


Examples of javax.faces.context.Flash

            }
            if (log.isLoggable(Level.FINEST))
                log.finest("entering " + renderExecutor.getPhase() + " in " + LifecycleImpl.class.getName());
   
            PhaseListenerManager phaseListenerMgr = new PhaseListenerManager(this, facesContext, getPhaseListeners());
            Flash flash = facesContext.getExternalContext().getFlash();
           
            try
            {
                facesContext.setCurrentPhaseId(renderExecutor.getPhase());
               
                flash.doPrePhaseActions(facesContext);
               
                // let the PhaseExecutor do some pre-phase actions
                renderExecutor.doPrePhaseActions(facesContext);
               
                phaseListenerMgr.informPhaseListenersBefore(renderExecutor.getPhase());
                // also possible that one of the listeners completed the response
                if (isResponseComplete(facesContext, renderExecutor.getPhase(), true))
                {
                    return;
                }
               
                renderExecutor.execute(facesContext);
            }
           
            catch (Throwable e) {
                // JSF 2.0: publish the executor's exception (if any).
               
                publishException (e, renderExecutor.getPhase(), facesContext);
            }
           
            finally
            {
                phaseListenerMgr.informPhaseListenersAfter(renderExecutor.getPhase());
                flash.doPostPhaseActions(facesContext);
               
                // publish a field in the application map to indicate
                // that the first request has been processed
                requestProcessed(facesContext);
            }
View Full Code Here

Examples of javax.faces.context.Flash

                    return null;
                }

                //Access to flash object
                elContext.setPropertyResolved(true);
                Flash flash = externalContext.getFlash();
                //This is just to make sure after this point
                //we are not in "keep" promotion.
                setDoKeepPromotion(false, facesContext);
               
                // Note that after this object is returned, Flash.get() and Flash.put()
                // methods are called from javax.el.MapELResolver, since
                // Flash is instance of Map.
                return flash;
            }
        }
        else if (base instanceof Flash)
        {
            FacesContext facesContext = facesContext(elContext);
            if (facesContext == null)
            {
                return null;
            }
            ExternalContext externalContext = facesContext.getExternalContext();
            if (externalContext == null)
            {
                return null;
            }
            Flash flash = (Flash) base;
            if (KEEP.equals(strProperty))
            {
                setDoKeepPromotion(true, facesContext);
                // Since we returned a Flash instance getValue will
                // be called again but this time the property name
                // to be resolved will be called, so we can do keep
                // promotion.
                elContext.setPropertyResolved(true);
                return base;
            }
            else if (NOW.equals(strProperty))
            {
                //Prevent invalid syntax #{flash.keep.now.someKey}
                if (!isDoKeepPromotion(facesContext))
                {
                    // According to the javadoc of Flash.putNow() and
                    // Flash.keep(), this is an alias to requestMap, used
                    // as a "buffer" to promote vars to flash scope using
                    // "keep" method
                    elContext.setPropertyResolved(true);
                    return externalContext.getRequestMap();
                }
            }
            else if (isDoKeepPromotion(facesContext))
            {
                //Resolve property calling get or keep
                elContext.setPropertyResolved(true);
                //promote it to flash scope
                flash.keep(strProperty);
                //Obtain the value on requestMap if any
                Object value = externalContext.getRequestMap().get(strProperty);
                return value;
            }
            else
            {
                //Just get the value
                elContext.setPropertyResolved(true);
                return flash.get(strProperty);
            }
        }
        return null;
    }
View Full Code Here

Examples of javax.faces.context.Flash

                viewId = ((ViewExpiredException) throwable).getViewId();
            }
            else if(throwable instanceof ContextNotActiveException)
            {
                FacesContext facesContext = exceptionQueuedEventContext.getContext();
                Flash flash =  facesContext.getExternalContext().getFlash();

                //the error page uses a cdi scope which isn't active as well
                if(flash.containsKey(ContextNotActiveException.class.getName()))
                {
                    break;
                }

                if(facesContext.getViewRoot() != null)
                {
                    viewId = facesContext.getViewRoot().getViewId();
                }
            }

            if(viewId != null)
            {
                FacesContext facesContext = exceptionQueuedEventContext.getContext();
                UIViewRoot uiViewRoot = facesContext.getApplication().getViewHandler().createView(facesContext, viewId);

                if (uiViewRoot == null)
                {
                    continue;
                }

                if(facesContext.isProjectStage(ProjectStage.Development) ||
                        ProjectStageProducer.getInstance().getProjectStage() ==
                                org.apache.myfaces.extensions.cdi.core.api.projectstage.ProjectStage.Development)
                {
                    throwable.printStackTrace();
                }

                facesContext.setViewRoot(uiViewRoot);
                exceptionQueuedEventIterator.remove();

                Flash flash =  facesContext.getExternalContext().getFlash();
                flash.put(throwable.getClass().getName(), throwable);
                flash.keep(throwable.getClass().getName());

                this.viewNavigationHandler.navigateTo(DefaultErrorView.class);

                break;
            }
View Full Code Here

Examples of javax.faces.context.Flash

                }
                phaseManager = plmc.newInstance(lifecycle, facesContext, getPhaseListenersMethod.invoke(lifecycleImpl, null));
                facesContext.getAttributes().put(PHASE_MANAGER_INSTANCE, phaseManager);
            }
           
            Flash flash = facesContext.getExternalContext().getFlash();
           
            try
            {
                facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
               
                flash.doPrePhaseActions(facesContext);
               
                // let the PhaseExecutor do some pre-phase actions
               
                //renderExecutor.doPrePhaseActions(facesContext);
                Method doPrePhaseActionsMethod = phaseExecutor.getClass().getMethod("doPrePhaseActions", FacesContext.class);
View Full Code Here

Examples of javax.faces.context.Flash

                phaseManager = plmc.newInstance(lifecycle, facesContext, getPhaseListenersMethod.invoke(lifecycleImpl, null));
                facesContext.getAttributes().put(PHASE_MANAGER_INSTANCE, phaseManager);
            }
           
           
            Flash flash = facesContext.getExternalContext().getFlash();
           
            //phaseListenerMgr.informPhaseListenersAfter(renderExecutor.getPhase());
            Method informPhaseListenersAfterMethod = phaseManager.getClass().getDeclaredMethod("informPhaseListenersAfter", PhaseId.class);
            if(!(informPhaseListenersAfterMethod.isAccessible()))
            {
                informPhaseListenersAfterMethod.setAccessible(true);
            }
            informPhaseListenersAfterMethod.invoke(phaseManager, PhaseId.RENDER_RESPONSE);
           
            flash.doPostPhaseActions(facesContext);
           
            facesContext.getExceptionHandler().handle();

            facesContext.getAttributes().remove(PHASE_MANAGER_INSTANCE);
           
View Full Code Here

Examples of javax.faces.context.Flash

        {
            log.finest("entering " + executor.getPhase() + " in " + LifecycleImpl.class.getName());
        }

        PhaseId currentPhaseId = executor.getPhase();
        Flash flash = context.getExternalContext().getFlash();

        try
        {
            /*
             * Specification, section 2.2
             * The default request lifecycle processing implementation must ensure that the currentPhaseId property
             * of the FacesContext instance for this request is set with the proper PhaseId constant for the current
             * phase as the first instruction at the beginning of each phase
             */
            context.setCurrentPhaseId(currentPhaseId);
           
            flash.doPrePhaseActions(context);
           
            // let the PhaseExecutor do some pre-phase actions
            executor.doPrePhaseActions(context);

            phaseListenerMgr.informPhaseListenersBefore(currentPhaseId);

            if (isResponseComplete(context, currentPhaseId, true))
            {
                // have to return right away
                return true;
            }
            if (shouldRenderResponse(context, currentPhaseId, true))
            {
                skipFurtherProcessing = true;
            }

            if (executor.execute(context))
            {
                return true;
            }
        }
       
        catch (Throwable e)
        {
            // JSF 2.0: publish the executor's exception (if any).
           
            publishException (e, currentPhaseId, context);
        }
       
        finally
        {
            phaseListenerMgr.informPhaseListenersAfter(currentPhaseId);
           
            flash.doPostPhaseActions(context);
           
        }
       
        context.getExceptionHandler().handle();
       
View Full Code Here

Examples of javax.faces.context.Flash

            {
                log.finest("entering " + renderExecutor.getPhase() + " in " + LifecycleImpl.class.getName());
            }
   
            PhaseListenerManager phaseListenerMgr = new PhaseListenerManager(this, facesContext, getPhaseListeners());
            Flash flash = facesContext.getExternalContext().getFlash();
           
            try
            {
                facesContext.setCurrentPhaseId(renderExecutor.getPhase());
               
                flash.doPrePhaseActions(facesContext);
               
                // let the PhaseExecutor do some pre-phase actions
                renderExecutor.doPrePhaseActions(facesContext);
               
                phaseListenerMgr.informPhaseListenersBefore(renderExecutor.getPhase());
                // also possible that one of the listeners completed the response
                if (isResponseComplete(facesContext, renderExecutor.getPhase(), true))
                {
                    return;
                }
               
                renderExecutor.execute(facesContext);
            }
           
            catch (Throwable e)
            {
                // JSF 2.0: publish the executor's exception (if any).
               
                publishException (e, renderExecutor.getPhase(), facesContext);
            }
           
            finally
            {
                phaseListenerMgr.informPhaseListenersAfter(renderExecutor.getPhase());
                flash.doPostPhaseActions(facesContext);
               
                // publish a field in the application map to indicate
                // that the first request has been processed
                requestProcessed(facesContext);
            }
View Full Code Here

Examples of javax.faces.context.Flash

     */
    public static Flash getCurrentInstance(ExternalContext context)
    {
        Map<String, Object> applicationMap = context.getApplicationMap();
       
        Flash flash = (Flash) applicationMap.get(FLASH_INSTANCE);
        if (flash == null)
        {
            // synchronize the ApplicationMap to ensure that only
            // once instance of FlashImpl is created and stored in it.
            synchronized (applicationMap)
View Full Code Here

Examples of javax.faces.context.Flash

   
    public static Flash getCurrentInstance(ExternalContext context, boolean create)
    {
        Map<String, Object> applicationMap = context.getApplicationMap();
       
        Flash flash = (Flash) applicationMap.get(FLASH_INSTANCE);
        if (flash == null && create)
        {
            // synchronize the ApplicationMap to ensure that only
            // once instance of FlashImpl is created and stored in it.
            synchronized (applicationMap)
View Full Code Here

Examples of javax.faces.context.Flash

                    return null;
                }

                //Access to flash object
                elContext.setPropertyResolved(true);
                Flash flash = externalContext.getFlash();
                //This is just to make sure after this point
                //we are not in "keep" promotion.
                setDoKeepPromotion(false, facesContext);
               
                // Note that after this object is returned, Flash.get() and Flash.put()
                // methods are called from javax.el.MapELResolver, since
                // Flash is instance of Map.
                return flash;
            }
        }
        else if (base instanceof Flash)
        {
            FacesContext facesContext = facesContext(elContext);
            if (facesContext == null)
            {
                return null;
            }
            ExternalContext externalContext = facesContext.getExternalContext();
            if (externalContext == null)
            {
                return null;
            }
            Flash flash = (Flash) base;
            if (KEEP.equals(strProperty))
            {
                setDoKeepPromotion(true, facesContext);
                // Since we returned a Flash instance getValue will
                // be called again but this time the property name
                // to be resolved will be called, so we can do keep
                // promotion.
                elContext.setPropertyResolved(true);
                return base;
            }
            else if (NOW.equals(strProperty))
            {
                //Prevent invalid syntax #{flash.keep.now.someKey}
                if (!isDoKeepPromotion(facesContext))
                {
                    // According to the javadoc of Flash.putNow() and
                    // Flash.keep(), this is an alias to requestMap, used
                    // as a "buffer" to promote vars to flash scope using
                    // "keep" method
                    elContext.setPropertyResolved(true);
                    return externalContext.getRequestMap();
                }
            }
            else if (isDoKeepPromotion(facesContext))
            {
                //Resolve property calling get or keep
                elContext.setPropertyResolved(true);
                //promote it to flash scope
                flash.keep(strProperty);
                //Obtain the value on requestMap if any
                Object value = externalContext.getRequestMap().get(strProperty);
                return value;
            }
            else
            {
                //Just get the value
                elContext.setPropertyResolved(true);
                return flash.get(strProperty);
            }
        }
        return null;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.