[jsr-314-open] Faces continues processes lifecycle even when facesContext.responseComplete() has been called
Andy Schwartz
andy.schwartz at oracle.com
Wed Sep 9 14:39:55 EDT 2009
As far as I can tell, Mojarra does this:
1. Execute before phase listeners.
2. If responseComplete is called by a before phase listener, skip
execution of the phase.
3. If any exceptions were thrown by a before phase listener, queue the
exception.
4. Execute after phase listeners
5. Skip the rest of the lifecycle.
From Phase.java:
> try {
> handleBeforePhase(context, listeners, event);
> if (!shouldSkip(context)) {
> execute(context);
> }
> } catch (Throwable e) {
> queueException(context, e);
> } finally {
> try {
> handleAfterPhase(context, listeners, event);
> } catch (Throwable e) {
> queueException(context, e);
> }
So the only processing that occurs after responseComplete is:
- Exception handling
- After phase listener execution
This seems reasonable/expected to me.
Lincoln -
Based on the stack below it looks like FacesContext.release() has been
called from a before phase listener. Is that true? Why/where is
release() being called?
Andy
Dan Allen wrote:
> Since the specification doesn't make an exception for this case, I
> would say that this is an inconsistency in the implementation. I
> recommend creating an issue report in Mojarra.
>
> -Dan
>
> On Sun, Sep 6, 2009 at 12:00 PM, Lincoln Baxter, III
> <lincolnbaxter at gmail.com <mailto:lincolnbaxter at gmail.com>> wrote:
>
> If the current response has already been completed before
> RESTORE_VIEW phase (eg, because a PhaseListener called
> facesContext.responseComplete() beforePhase ), Faces continues to
> attempt lifecycle processing. I'm thinking that this should be
> handled by halting lifecycle processing as defined in the API --
> Is this a bug or a something we need to discuss? What do you guys
> think?
>
>
> /**
> * <p>Signal the JavaServer Faces implementation that the HTTP
> response
> * for this request has already been generated (such as an
> HTTP redirect),
> * and that the request processing lifecycle should be
> terminated as soon
> * as the current phase is completed.</p>
> *
> * @throws IllegalStateException if this method is called after
> * this instance has been released
> */
> public abstract void responseComplete();
>
>
> Caused by: java.lang.IllegalStateException
> at
> com.sun.faces.context.FacesContextImpl.assertNotReleased(FacesContextImpl.java:639)
> at
> com.sun.faces.context.FacesContextImpl.getCurrentPhaseId(FacesContextImpl.java:515)
> at
> javax.faces.event.ExceptionQueuedEventContext.<init>(ExceptionQueuedEventContext.java:148)
> at
> javax.faces.event.ExceptionQueuedEventContext.<init>(ExceptionQueuedEventContext.java:101)
> at com.sun.faces.lifecycle.Phase.queueException(Phase.java:152)
> at com.sun.faces.lifecycle.Phase.queueException(Phase.java:145)
> at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:105)
> at
> com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
> at
> com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:310)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> --
> *Lincoln Baxter, III*
> Co-Founder of OcpSoft <http://ocpsoft.com>
> Author of PrettyFaces <http://ocpsoft.com/prettyfaces> URL
> Rewriting for JSF
>
>
>
>
>
> --
> Dan Allen
> Senior Software Engineer, Red Hat | Author of Seam in Action
> Registered Linux User #231597
>
> http://mojavelinux.com
> http://mojavelinux.com/seaminaction
> http://in.relation.to/Bloggers/Dan
More information about the jsr-314-open-mirror
mailing list