Package javax.faces.lifecycle

Examples of javax.faces.lifecycle.Lifecycle


      HttpServletResponse response) throws ServletException,
      IOException {

    LifecycleFactory lFactory = (LifecycleFactory)
        FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
    Lifecycle lifecycle =
        lFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
    FacesContextFactory fcFactory = (FacesContextFactory)
        FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
    FacesContext facesContext =
        fcFactory.getFacesContext(getServletContext(), request, response, lifecycle);
    try {
      Application application = facesContext.getApplication();
      ViewHandler viewHandler = application.getViewHandler();
      String viewId = getFromViewId();
      UIViewRoot view = viewHandler.createView(facesContext, viewId);
      facesContext.setViewRoot(view);

//    ExternalContext externalContext = facesContext.getExternalContext();
//    externalContext.getRequestMap().put("com.sun.faces.INVOCATION_PATH", "/faces");

      // invoke application
      String outcome = invokeApplication(facesContext);

      if (facesContext.getResponseComplete()) {
        return;
      }
      if (LOG.isDebugEnabled()) {
        LOG.debug("outcome = '" + outcome + "'");
      }
      NavigationHandler navigationHandler = application.getNavigationHandler();
      navigationHandler.handleNavigation(facesContext, null, outcome);
      lifecycle.render(facesContext);
    } finally {
      facesContext.release();
    }
  }
View Full Code Here


    /**
     * Return the <code>Lifecycle</code>.
     * @return the result
     */
    public static Lifecycle lifecycle () {
        Lifecycle res = (Lifecycle)FacesContext.getCurrentInstance()
            .getExternalContext().getRequestMap().get(LIFECYCLE);
        if (res != null) {
            return res;
        }
        LifecycleFactory factory = (LifecycleFactory)
View Full Code Here

    public static void addPhaseListenerForPortlet (PhaseListener pl) {
        PortletSession session = (PortletSession)FacesContext
            .getCurrentInstance().getExternalContext().getSession(true);
        if (session.getAttribute
            (LISTENER_REGISTERED, PortletSession.APPLICATION_SCOPE) == null) {
            Lifecycle lifecycle = lifecycle();
            lifecycle.addPhaseListener(new PhaseListener () {
                public PhaseId getPhaseId () {
                    return PhaseId.ANY_PHASE;
                }
                public void beforePhase (PhaseEvent e) {
                    handleEvent (false, e);
View Full Code Here

    FacesContext context = null;
    String scopeId = null;
    try
    {
      Lifecycle lifecycle = getLifecycle();
      // Get the FacesContext instance for this request
      context = getFacesContext(request, response, lifecycle, null);

      // For actions we only execute the lifecycle phase
      lifecycle.execute(context);

      // If responseComplete don't save any state as we aren't falling through to render
      // Usual occurs because of a redirect
      if (!context.getResponseComplete())
      {
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 (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

    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

     * @param phaseId
     *            The phase id about to be executed
     */
    protected void informPhaseListenersBefore(FacesContext facesContext,
            PhaseId phaseId) {
        Lifecycle lifecycle = getLifecycle();
        PhaseListener[] phaseListeners = lifecycle.getPhaseListeners();
        for (int i = 0; i < phaseListeners.length; i++) {
            PhaseListener phaseListener = phaseListeners[i];
            int listenerPhaseId = phaseListener.getPhaseId().getOrdinal();
            if (listenerPhaseId == PhaseId.ANY_PHASE.getOrdinal()
                    || listenerPhaseId == phaseId.getOrdinal()) {
View Full Code Here

     * @param phaseId
     *            The phase id that was executed
     */
    protected void informPhaseListenersAfter(FacesContext facesContext,
            PhaseId phaseId) {
        Lifecycle lifecycle = getLifecycle();
        PhaseListener[] phaseListeners = lifecycle.getPhaseListeners();
        for (int i = 0; i < phaseListeners.length; i++) {
            PhaseListener phaseListener = phaseListeners[i];
            int listenerPhaseId = phaseListener.getPhaseId().getOrdinal();
            if (listenerPhaseId == PhaseId.ANY_PHASE.getOrdinal()
                    || listenerPhaseId == phaseId.getOrdinal()) {
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

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.