Package javax.faces.event

Examples of javax.faces.event.PhaseId


        }
    }

    public void processRemainingPhases(FacesContext facesContext)
    {
        PhaseId lastPhaseId = (PhaseId) facesContext.getAttributes().get(LAST_PHASE_PROCESSED);
        if (lastPhaseId == null)
        {
            processLifecycleExecute(facesContext);
            renderResponse(facesContext);
            return;
View Full Code Here


    public void beforePhase(PhaseEvent event) {
        if (AjaxContext.getCurrentInstance().isAjaxRequest()) {
            return;
        }

        PhaseId phaseId = event.getPhaseId();
        if (phaseId == PhaseId.RESTORE_VIEW) {
            // We want to add the saved messages back to the context immediately after the view is restored.
            // Remove them from the session once we've added them back, otherwise the messages will just keep
            // building up, since they are stored in session scope.
            List<FacesMessage> savedMessages = removeGlobalFacesMessagesFromSession();
View Full Code Here

    public void afterPhase(PhaseEvent event) {
        if (AjaxContext.getCurrentInstance().isAjaxRequest()) {
            return;
        }

        PhaseId phaseId = event.getPhaseId();
        if (phaseId == PhaseId.INVOKE_APPLICATION) {
            // We want to store the messages in the context after the application has done its processing.
            putGlobalFacesMessagesInSession();
        } else if (phaseId == PhaseId.RENDER_RESPONSE) {
            // If we've just rendered a response, this isn't a redirect, so we don't want to propogate messages.
View Full Code Here

    @Override
    public void doPrePhaseActions(FacesContext facesContext)
    {
        if (!_flashScopeDisabled)
        {
            final PhaseId currentPhaseId = facesContext.getCurrentPhaseId();
       
            if (PhaseId.RESTORE_VIEW.equals(currentPhaseId))
            {
                // restore the redirect value
                // note that the result of this method is used in many places,
View Full Code Here

     * or if setRedirect(true) was called on this request and we are
     * in phase 5 (invoke application).
     */
    private boolean _isLastPhaseInRequest(FacesContext facesContext)
    {
        final PhaseId currentPhaseId = facesContext.getCurrentPhaseId();
       
        boolean lastPhaseNormalRequest = PhaseId.RENDER_RESPONSE.equals(currentPhaseId);
        boolean lastPhaseIfRedirect = PhaseId.INVOKE_APPLICATION.equals(currentPhaseId)
                && _isRedirectTrueOnThisRequest(facesContext);
       
View Full Code Here

    private final void dispatchBehaviorEvent(UIComponent component, AjaxBehavior ajaxBehavior)
    {
        AjaxBehaviorEvent event = new AjaxBehaviorEvent(component, ajaxBehavior);

        PhaseId phaseId = ajaxBehavior.isImmediate() || isComponentImmediate(component) ?
                PhaseId.APPLY_REQUEST_VALUES :
                PhaseId.INVOKE_APPLICATION;

        event.setPhaseId(phaseId);
View Full Code Here

                            // happens when a PhaseListener removes another PhaseListener
                            // from UIViewRoot in its beforePhase method
                            throw new IllegalStateException("A PhaseListener must not remove " +
                                    "PhaseListeners from UIViewRoot.");
                        }
                        PhaseId listenerPhaseId = phaseListener.getPhaseId();
                        if (phaseId.equals(listenerPhaseId) || PhaseId.ANY_PHASE.equals(listenerPhaseId))
                        {
                            try
                            {
                                phaseListener.beforePhase(event);
                                beforePhaseSuccess[i + 1] = true;
                            }
                            catch (Throwable t)
                            {
                                beforePhaseSuccess[i + 1] = false; // redundant - for clarity
                                _getLogger().log(Level.SEVERE, "An Exception occured while processing the " +
                                                         "beforePhase method of PhaseListener " + phaseListener +
                                                         " in Phase " + phaseId, t);
                                return context.getResponseComplete() ||
                                        (context.getRenderResponse() && !PhaseId.RENDER_RESPONSE.equals(phaseId));
                            }
                        }
                    }
                }
                else
                {
                    // afterPhase
                    // process listeners in descending order
                    for (int i = beforePhaseSuccess.length - 1; i > 0; i--)
                    {
                        PhaseListener phaseListener;
                        try
                        {
                            phaseListener = phaseListeners.get(i - 1);
                        }
                        catch (IndexOutOfBoundsException e)
                        {
                            // happens when a PhaseListener removes another PhaseListener
                            // from UIViewRoot in its beforePhase or afterPhase method
                            throw new IllegalStateException("A PhaseListener must not remove " +
                                    "PhaseListeners from UIViewRoot.");
                        }
                        PhaseId listenerPhaseId = phaseListener.getPhaseId();
                        if ((phaseId.equals(listenerPhaseId) || PhaseId.ANY_PHASE.equals(listenerPhaseId))
                                && beforePhaseSuccess[i])
                        {
                            try
                            {
View Full Code Here

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

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

        try
        {
            /*
 
View Full Code Here

  @SuppressWarnings("unchecked")
  public void beforePhase(PhaseEvent phaseEvent) {
    if (LOG.isInfoEnabled()) {
      Date start = null;
      Map map = null;
      PhaseId phaseId = phaseEvent.getPhaseId();
      if (LOG.isDebugEnabled() || phaseId.getOrdinal() == 1) {

        ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();

        if (LOG.isTraceEnabled() && PhaseId.RESTORE_VIEW == phaseId) {
          // this is before restoreView

          Object request = externalContext.getRequest();
          if (request instanceof HttpServletRequest) {
            HttpServletRequest servletRequest = (HttpServletRequest) request;
            LOG.trace("RequestURI = " + servletRequest.getRequestURI());
          }
          Map headerMap = externalContext.getRequestHeaderMap();
          for (Object key : headerMap.keySet()) {
            LOG.trace("Header : \"" + key + "\" = \"" + headerMap.get(key) + "\"");
          }
          Map parameterMap = externalContext.getRequestParameterMap();
          for (Object key : parameterMap.keySet()) {
            LOG.trace("Param  : \"" + key + "\" = \"" + parameterMap.get(key) + "\"");
          }
        }

        start = new Date();
        map = externalContext.getRequestMap();
        map.put(KEY + phaseId.getOrdinal() + "S", start);
      }

      if (LOG.isDebugEnabled()) {
        Date end = null;
        int ordinal = phaseId.getOrdinal();
        while (end == null && ordinal > 0) {
          end = (Date) map.get(KEY + --ordinal + "E");
        }
        if (end != null) {
          LOG.debug("Time between phases " + ordinal + " and " + phaseId.getOrdinal() + ": "
              + (start.getTime() - end.getTime()) + " milliseconds");
        }
      }
      if (LOG.isTraceEnabled()) {
        LOG.trace("Before Phase :" + phaseId
View Full Code Here

  @SuppressWarnings("unchecked")
  public void beforePhase(PhaseEvent phaseEvent) {
    if (LOG.isInfoEnabled()) {
      Date start = null;
      Map map = null;
      PhaseId phaseId = phaseEvent.getPhaseId();
      if (LOG.isDebugEnabled() || phaseId.getOrdinal() == 1) {

        ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();

        if (LOG.isTraceEnabled() && PhaseId.RESTORE_VIEW == phaseId) {
          // this is before restoreView
          Map params = externalContext.getRequestParameterMap();
          for (Object key : params.keySet()) {
            LOG.trace("Param : \"" + key + "\" = \"" + params.get(key) + "\"");
          }
        }

        start = new Date();
        map = externalContext.getRequestMap();
        map.put(KEY + phaseId.getOrdinal() + "S", start);
      }

      if (LOG.isDebugEnabled()) {
        Date end = null;
        int ordinal = phaseId.getOrdinal();
        while (end == null && ordinal > 0) {
          end = (Date) map.get(KEY + --ordinal + "E");
        }
        if (end != null) {
          LOG.debug("Time between phases " + ordinal + " and " + phaseId.getOrdinal() + ": "
              + (start.getTime() - end.getTime()) + " milliseconds");
        }
      }
      if (LOG.isTraceEnabled()) {
        LOG.trace("Before Phase :" + phaseId
View Full Code Here

TOP

Related Classes of javax.faces.event.PhaseId

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.