Package javax.faces.context

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


        {
            if (FLASH.equals(strProperty))
            {
                //Access to flash object
                elContext.setPropertyResolved(true);
                Flash flash = externalContext(elContext).getFlash();
                //This is just to make sure after this point
                //we are not in "keep" promotion.
                setDoKeepPromotion(false);
               
                // 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)
        {
            Flash flash = (Flash) base;
            if (KEEP.equals(strProperty))
            {
                setDoKeepPromotion(true);
                // 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.
                return base;
            }
            else if (NOW.equals(strProperty))
            {
                //Prevent invalid syntax #{flash.keep.now.someKey}
                if (!isDoKeepPromotion())
                {
                    // 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(elContext).getRequestMap();
                }
            }
            else if (isDoKeepPromotion())
            {
                //Resolve property calling get or keep
                elContext.setPropertyResolved(true);
                //Obtain the value on requestMap if any
                Object value = externalContext(elContext).getRequestMap().get(strProperty);
                //promote it to flash scope
                flash.keep(strProperty);
                return value;
            }
            else
            {
                //Just get the value
                elContext.setPropertyResolved(true);
                return flash.get(strProperty);
            }
        }
        return null;
    }
View Full Code Here

     */
    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

     */
    protected void handleAfterPhase(FacesContext context,
                                    ListIterator<PhaseListener> listenersIterator,
                                    PhaseEvent event) {

        Flash flash = context.getExternalContext().getFlash();
        flash.doPostPhaseActions(context);
        while (listenersIterator.hasPrevious()) {
            PhaseListener listener = listenersIterator.previous();
            if (this.getId().equals(listener.getPhaseId()) ||
                PhaseId.ANY_PHASE.equals(listener.getPhaseId())) {
                try {
View Full Code Here

     */
     protected void handleBeforePhase(FacesContext context,
                                      ListIterator<PhaseListener> listenersIterator,
                                      PhaseEvent event) {

         Flash flash = context.getExternalContext().getFlash();
         flash.doPrePhaseActions(context);
         RequestStateManager.clearAttributesForPhase(context,
                                                     context.getCurrentPhaseId());
         while (listenersIterator.hasNext()) {
             PhaseListener listener = listenersIterator.next();
             if (this.getId().equals(listener.getPhaseId()) ||
View Full Code Here

     */
    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

    logger.debug("Saving current messages");
    List<FacesMessage> messages = facesContext.getMessageList();
    if (messages == null || messages.size() == 0)
      return;

    Flash flash = externalContext.getFlash();
    flash.setKeepMessages(true);
  }
View Full Code Here

        FacesContext facesContext = FacesContext.getCurrentInstance();
        if (facesContext == null) {
            throw new ContextNotActiveException("FacesContext is not active");
        }

        Flash ctx = facesContext.getExternalContext().getFlash();
        if (ctx == null) {
            throw new ContextNotActiveException("Flash is not active");
        }

        return ctx;
View Full Code Here

     */
    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

    protected void handleAfterPhase(FacesContext context,
                                    ListIterator<PhaseListener> listenersIterator,
                                    PhaseEvent event) {

        try {
            Flash flash = context.getExternalContext().getFlash();
            flash.doPostPhaseActions(context);
        } catch (UnsupportedOperationException uoe) {
            if (LOGGER.isLoggable(Level.FINE)) {
                 LOGGER.fine("ExternalContext.getFlash() throw UnsupportedOperationException -> Flash unavailable");
            }   
        }
View Full Code Here

TOP

Related Classes of javax.faces.context.Flash

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.