Refine search
CodiLifecycleWrapper(Lifecycle wrapped, List<PhaseListener> phaseListeners) { this.wrapped = wrapped; for (PhaseListener phaseListener : phaseListeners) { this.wrapped.addPhaseListener(phaseListener); } }
/** * Delegates to the wrapped {@link Lifecycle}. * @throws FacesException */ public void render(FacesContext context) throws FacesException { delegate.render(context); }
private void restoreView(FacesContext facesContext) { facesContext.renderResponse(); // call restore phase only lifecycle.execute(facesContext); }
private void executeLifecyle(FacesContext context) throws IOException, ServletException { try { ResourceHandler handler = context.getApplication().getResourceHandler(); if (handler.isResourceRequest(context)) { handler.handleResourceRequest(context); } else { lifecycle.attachWindow(context); lifecycle.execute(context); lifecycle.render(context); } } catch (FacesException e) { Throwable t = e.getCause(); if (t == null) { throw new ServletException(e.getMessage(), e); } if (t instanceof ServletException) { throw (ServletException) t; } if (t instanceof IOException) { throw (IOException) t; } throw new ServletException(t.getMessage(), t); } }
/** * Performs the standard duties of the JSF RENDER_RESPONSE phase. */ public void render() throws IOException { FacesContext facesContext = FlowFacesContext.getCurrentInstance(); if (facesContext.getResponseComplete()) { return; } facesContext.setViewRoot(this.viewRoot); try { logger.debug("Asking faces lifecycle to render"); this.facesLifecycle.render(facesContext); } finally { logger.debug("View rendering complete"); facesContext.responseComplete(); } }
public void beforePhase(final PhaseEvent event) { if (!initialized) { synchronized(this) { if (!initialized) { FacesContext facesContext = event.getFacesContext(); facesContext = (facesContext == null) ? FacesContext.getCurrentInstance() : facesContext; _resolverBuilder.build(facesContext, _resolverForJSP); LifecycleFactory factory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); for (Iterator<String> iter = factory.getLifecycleIds(); iter.hasNext();) { factory.getLifecycle(iter.next()).removePhaseListener(this); } initialized = true; } } } }
/** * Informs phase listeners after a phase is executed * * @param facesContext * The current faces context * @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()) { phaseListener.afterPhase(new PhaseEvent(FacesContext .getCurrentInstance(), phaseId, lifecycle)); } } }
/** * Performs cleanup tasks after the rendering process */ @Override public void render(FacesContext facesContext) { this.wrapped.render(facesContext); if (facesContext.getViewRoot() != null && facesContext.getViewRoot().getViewId() != null) { ViewAccessContext viewAccessContext = contextExtension.getViewAccessScopedContext(); if (viewAccessContext != null) { viewAccessContext.onProcessingViewFinished(facesContext.getViewRoot().getViewId()); } } }
public void processUserEvent() { FacesContext facesContext = FlowFacesContext.newInstance(requestContext, facesLifecycle); facesContext.setViewRoot(viewRoot); try { if (restored && !facesContext.getRenderResponse() && !facesContext.getResponseComplete()) { facesLifecycle.execute(facesContext); } if (JsfUtils.isPortlet(facesContext)) { requestContext.getFlashScope().put(ViewRootHolder.VIEW_ROOT_HOLDER_KEY, new ViewRootHolder(getViewRoot())); } } finally { facesContext.release(); } }
/** * Executes postback-processing portions of the standard JSF lifecycle including APPLY_REQUEST_VALUES through * INVOKE_APPLICATION. */ public void processUserEvent() { FacesContext facesContext = FlowFacesContext.getCurrentInstance(); // Must respect these flags in case user set them during RESTORE_VIEW phase if (!facesContext.getRenderResponse() && !facesContext.getResponseComplete()) { this.facesLifecycle.execute(facesContext); } }
/** * Broadcasts {@link org.apache.myfaces.extensions.cdi.core.api.startup.event.StartupEvent} and * {@link org.apache.myfaces.extensions.cdi.jsf.api.listener.request.BeforeFacesRequest} btw. * {@link org.apache.myfaces.extensions.cdi.jsf.api.listener.request.AfterFacesRequest} * <p/> * {@inheritDoc} */ public void execute(FacesContext facesContext) { broadcastApplicationStartupBroadcaster(); broadcastBeforeFacesRequestEvent(facesContext); WindowHandler windowHandler = CodiUtils.getContextualReferenceByClass(WindowHandler.class); if (windowHandler instanceof LifecycleAwareWindowHandler) { ((LifecycleAwareWindowHandler) windowHandler).beforeLifecycleExecute(facesContext); if (facesContext.getResponseComplete()) { // no further processing return; } } wrapped.execute(facesContext); }
@Override public void render(FacesContext context) throws FacesException { try { delegate.render(context); } finally { EtmPoint requestPoint = (EtmPoint) context.getAttributes().get(EtmJsfPlugin.ROOT_ETM_POINT); if (requestPoint != null) { requestPoint.collect(); context.getAttributes().remove(EtmJsfPlugin.ROOT_ETM_POINT); } } }
@Override public void execute(FacesContext context) throws FacesException { EtmPoint requestPoint = EtmManager.getEtmMonitor().createPoint(getDefaultRequestName(context)); context.getAttributes().put(EtmJsfPlugin.ROOT_ETM_POINT, requestPoint); delegate.execute(context); }
/** * Delegates to the wrapped {@link Lifecycle}. */ public void removePhaseListener(PhaseListener listener) { delegate.removePhaseListener(listener); }
/** * {@inheritDoc} */ public PhaseListener[] getPhaseListeners() { return this.wrapped.getPhaseListeners(); }
@Override public void execute(FacesContext context) throws FacesException { getWrapped().execute(context); }
public static void removeELResolverInitPhaseListener() { LifecycleFactory factory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); // remove ourselves from the list of listeners maintained by // the lifecycle instances for (Iterator<String> i = factory.getLifecycleIds(); i.hasNext();) { Lifecycle lifecycle = factory.getLifecycle(i.next()); for (PhaseListener cur : lifecycle.getPhaseListeners()) { if (cur instanceof ELResolverInitPhaseListener) { lifecycle.removePhaseListener(cur); } } } }
protected void attachClientWindowToLifecycle(FacesContext facesContext, Lifecycle lifecycle) { lifecycle.attachWindow(facesContext); } }
private void executeLifecyle(FacesContext context) throws IOException, ServletException { try { ResourceHandler handler = context.getApplication().getResourceHandler(); if (handler.isResourceRequest(context)) { handler.handleResourceRequest(context); } else { lifecycle.attachWindow(context); lifecycle.execute(context); lifecycle.render(context); } } catch (FacesException e) { Throwable t = e.getCause(); if (t == null) { throw new ServletException(e.getMessage(), e); } if (t instanceof ServletException) { throw (ServletException) t; } if (t instanceof IOException) { throw (IOException) t; } throw new ServletException(t.getMessage(), t); } }
/** * Performs the standard duties of the JSF RENDER_RESPONSE phase. */ public void render() throws IOException { FacesContext facesContext = FlowFacesContext.getCurrentInstance(); if (facesContext.getResponseComplete()) { return; } facesContext.setViewRoot(this.viewRoot); try { logger.debug("Asking faces lifecycle to render"); this.facesLifecycle.render(facesContext); } finally { logger.debug("View rendering complete"); facesContext.responseComplete(); } }