Package javax.faces.lifecycle

Examples of javax.faces.lifecycle.Lifecycle


    public Lifecycle getLifecycle(String id)
            throws FacesException
    {
        synchronized (_lifecycles)
        {
            Lifecycle lifecycle = _lifecycles.get(id);
            if (lifecycle == null)
            {
                throw new IllegalArgumentException("Unknown lifecycle '" + id + "'.");
            }
            return lifecycle;
View Full Code Here


        if (this.delegateWindowHandling)
        {
            try
            {
                //the first wrapper is always DeltaSpikeLifecycleWrapper which can't extend from LifecycleWrapper
                Lifecycle externalWrapper = ((DeltaSpikeLifecycleWrapper)this.wrapped).getWrapped();
                delegateAttachWindow(facesContext, externalWrapper);
            }
            catch (Exception e)
            {
                try
View Full Code Here

        }
    }

    private void attachWindowOnUnwrappedInstance(FacesContext facesContext, Lifecycle wrapped) throws Exception
    {
        Lifecycle wrappedLifecycle = null;

        if (wrapped instanceof LifecycleWrapper)
        {
            wrappedLifecycle = ((LifecycleWrapper)wrapped).getWrapped();
        }
View Full Code Here

                = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
       
        //Lifecycle lifecycle = lifecycleFactory.getLifecycle(getLifecycleId());
        for (Iterator<String> it = lifecycleFactory.getLifecycleIds(); it.hasNext();)
        {
            Lifecycle lifecycle = lifecycleFactory.getLifecycle(it.next());
           
            // add phase listeners
            for (String listenerClassName : getDispenser().getLifecyclePhaseListeners())
            {
                try
                {
                    lifecycle.addPhaseListener((PhaseListener)
                            ClassUtils.newInstance(listenerClassName, PhaseListener.class));
                }
                catch (ClassCastException e)
                {
                    log.severe("Class " + listenerClassName + " does not implement PhaseListener");
                }
            }

            // if ProjectStage is Development, install the DebugPhaseListener
            FacesContext facesContext = FacesContext.getCurrentInstance();
            if (facesContext.isProjectStage(ProjectStage.Development) &&
                    MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isDebugPhaseListenerEnabled())
            {
                lifecycle.addPhaseListener(new DebugPhaseListener());
            }
        }
    }
View Full Code Here

    {
        LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(
                FactoryFinder.LIFECYCLE_FACTORY);

        String currentId;
        Lifecycle currentLifecycle;
        Iterator lifecycleIds = lifecycleFactory.getLifecycleIds();
        while (lifecycleIds.hasNext())
        {
            currentId = (String) lifecycleIds.next();
            currentLifecycle = lifecycleFactory.getLifecycle(currentId);
            currentLifecycle.addPhaseListener(phaseListener);
        }
    }
View Full Code Here

    FacesContext context = null;
    try
    {
      // Get the FacesContext instance for this request
      Lifecycle lifecycle = getLifecycle();
      context = getFacesContext(request, response, lifecycle, redirectParams);
      ExternalContext extCtx = context.getExternalContext();

      // Use request from ExternalContext in case its been wrapped by an
      // extension
View Full Code Here

    private void configureLifecycle()
    {
        // create the lifecycle used by the app
        LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder
                .getFactory(FactoryFinder.LIFECYCLE_FACTORY);
        Lifecycle lifecycle = lifecycleFactory.getLifecycle(getLifecycleId());

        // add phase listeners
        for (Iterator iterator = getDispenser().getLifecyclePhaseListeners(); iterator.hasNext();)
        {
            String listenerClassName = (String) iterator.next();
            try
            {
                lifecycle.addPhaseListener((PhaseListener) ClassUtils.newInstance(listenerClassName));
            }
            catch (ClassCastException e)
            {
                log.error("Class " + listenerClassName + " does not implement PhaseListener");
            }
View Full Code Here

    FacesContext context = null;
    try
    {
      // Get the FacesContext instance for this request
      Lifecycle lifecycle = getLifecycle();
      context =
          getFacesContextFactory().getFacesContext(mPortletConfig, request, response, lifecycle);
      ExternalContext extCtx = context.getExternalContext();

      // Use request from ExternalContext in case its been wrapped by an
      // extension
      RenderRequest extRequest = (RenderRequest) extCtx.getRequest();

      scopeId = extRequest.getParameter(REQUEST_SCOPE_ID_RENDER_PARAM);

      if (restoreBridgeRequestScopeData(context, scopeId))
      {
        // Because the Bridge is required to always save/restore the
        // VIEW_STATE
        // parameter -- always attempt a restore
        extRequest = restoreActionParams(context);

        // only restores if first render after action
        // afterwards not restored from Bridge request scope
        // rather its saved/restored by Faces.
        restoreFacesView(context, scopeId);
      }

      // Ensure the ContentType is set before rendering
      if (extCtx.getResponseContentType() == null)
      {
        response.setContentType(extRequest.getResponseContentType());
      }

      // ensure that isPostback attribute set if VIEW_STATE param exists
      if (extCtx.getRequestParameterValuesMap().containsKey(ResponseStateManager.VIEW_STATE_PARAM))
      {
        extCtx.getRequestMap().put(Bridge.IS_POSTBACK_ATTRIBUTE, Boolean.TRUE);
      }

      // Note: if the scope wasn't restored then the Faces
      // FACES_VIEW_STATE
      // parameter will not have been carried into this render and hence
      // default Faces impls will not see this render as occuring in a
      // in a postback (isPostback() will return false. This means Faces
      // will create a new Tree instead of restoring one -- the semantics
      // one should get if the Bridge can't access its requestScope.

      // if the requestScope restored the ViewRoot then this must be
      // the first render after the action -- hence the tree isn't yet
      // stored/managed by Faces -- we can merely render it
      if (context.getViewRoot() == null)
      {
        // add self as PhaseListener to prevent action phases from
        // executing
        lifecycle.addPhaseListener(this);
        try
        {
          lifecycle.execute(context);
        }
        catch (Exception e)
        {
          // When exception occurs remove stored scope so don't
          // get stuck replaying the error when/if user refreshes
          if (scopeId != null)
          {
            removeRequestScopes(scopeId);
          }
        }
        finally
        {
          lifecycle.removePhaseListener(this);
        }
      }
      getLifecycle().render(context);
     
      // When we have navigated to this view between the action and render
View Full Code Here

    EasyMock.expect(flashScope.getBoolean(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY))).andStubReturn(
        Boolean.FALSE);
    EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
        .andStubReturn(null);

    Lifecycle lifecycle = new NoEventLifecycle(jsfMock.lifecycle());

    UIViewRoot existingRoot = new UIViewRoot();
    existingRoot.setViewId(VIEW_ID);

    EasyMock.replay(new Object[] { context, flowExecutionContext, flowMap, flashScope });
View Full Code Here

    EasyMock.expect(flashScope.getBoolean(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY))).andStubReturn(
        Boolean.FALSE);
    EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
        .andStubReturn(null);

    Lifecycle lifecycle = new NoEventLifecycle(jsfMock.lifecycle());

    UIViewRoot existingRoot = new UIViewRoot();
    existingRoot.setViewId(VIEW_ID);
    AjaxViewRoot ajaxRoot = new AjaxViewRoot(existingRoot);
View Full Code Here

TOP

Related Classes of javax.faces.lifecycle.Lifecycle

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.