Package javax.faces.context

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


                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

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

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

   }

   @Override
   public void putInFlash(String name, Object value)
   {
      final Flash flash = FacesContext.getCurrentInstance().getExternalContext().getFlash();
      if (value != null)
      {
         flash.put(name, value);
         flash.putNow(name, value);
         flash.keep(name);
      }
      else
      {
         flash.remove(name);
      }
   }
View Full Code Here

   }

   @Override
   public <T> T getFromFlash(String name, Class<T> type)
   {
      final Flash flash = FacesContext.getCurrentInstance().getExternalContext().getFlash();
      final Object result = flash.get(name);
      if (result != null)
      {
         return checkObject(result, type, "Flash-scoped object named '" + name + "' is not of type '" + type.getSimpleName() + "'");
      }
      else
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

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

        CaseStruct caseStruct = getViewId(context, fromAction, outcome, toFlowDocumentId);
        if (caseStruct != null) {
            ExternalContext extContext = context.getExternalContext();
            ViewHandler viewHandler = Util.getViewHandler(context);
            assert (null != viewHandler);
            Flash flash = extContext.getFlash();
            boolean isUIViewActionBroadcastAndViewdsDiffer = false;
            if (UIViewAction.isProcessingBroadcast(context)) {
                flash.setKeepMessages(true);
                String viewIdBefore = context.getViewRoot().getViewId();
                viewIdBefore = (null == viewIdBefore) ? "" : viewIdBefore;
                String viewIdAfter = caseStruct.navCase.getToViewId(context);
                viewIdAfter = (null == viewIdAfter) ? "" : viewIdAfter;
                isUIViewActionBroadcastAndViewdsDiffer = !viewIdBefore.equals(viewIdAfter);
            }
            if (caseStruct.navCase.isRedirect() || isUIViewActionBroadcastAndViewdsDiffer) {
               
                // perform a 302 redirect.
                String redirectUrl =
                      viewHandler.getRedirectURL(context,
                                                 caseStruct.viewId,
                                                 SharedUtils.evaluateExpressions(context, caseStruct.navCase.getParameters()),
                                                 caseStruct.navCase.isIncludeViewParams());
                try {
                    if (logger.isLoggable(Level.FINE)) {
                        logger.log(Level.FINE, "Redirecting to path {0} for outcome {1}and viewId {2}", new Object[]{redirectUrl, outcome, caseStruct.viewId});
                    }
                    // encode the redirect to ensure session state
                    // is maintained
                    updateRenderTargets(context, caseStruct.viewId);
                    flash.setRedirect(true);
                    extContext.redirect(redirectUrl);
                } catch (java.io.IOException ioe) {
                    if (logger.isLoggable(Level.FINE)) {
                        logger.log(Level.FINE,"jsf.redirect_failed_error",
                                   redirectUrl);
View Full Code Here

        {
            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

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.