dev@javaserverfaces.java.net

Re: Abort further processing of a Faces Request?

From: Lincoln Baxter, III <lincolnbaxter_at_gmail.com>
Date: Wed, 6 Jan 2010 22:26:19 -0500

It looks like the request is aborted with context.responseComplete(), but
the listener.afterPhase(...) method is still called.


On Sun, Jan 3, 2010 at 5:34 PM, Manfred Riem <mriem_at_manorrock.org> wrote:

> Don't you still need to tell the Faces lifecycle the response is complete?
>
> Manfred
>
> -----Original Message-----
> From: Lincoln Baxter, III [mailto:lincolnbaxter_at_gmail.com]
> Sent: Sunday, January 03, 2010 1:58 PM
> To: dev_at_javaserverfaces.dev.java.net
> Subject: Abort further processing of a Faces Request?
>
> I'm trying to do a servlet forward in a PhaseListener, via
> ExternalContext.dispatch(), before RESTORE_VIEW phase.
>
> What happens, though, is that the lifecycle continues in the current
> thread, even though the request has been dispatched. It seems like
> dispatch() should do some kind of internal abort to tell Faces to stop
> processing. Or... faces should check to see if the request has been
> dispatched immediately before attempting the next phase.
>
> Assuming that there is no viewId specified, The result of this is an
> Explosion when faces attempts to create a UIViewRoot that doesn't
> exist, when instead, I feel the request should already have been
> aborted and no view should be created, even if there were to be a
> viewId defined.
>
> The forwarded thread completes successfully and the new page displays.
>
> Is this a bug, a spec enhancement, or user error?
>
> Caused by: java.lang.NullPointerException
> at javax.faces.component.UIViewRoot.setLocale(UIViewRoot.java:1470)
> at
>
> com.sun.faces.application.view.ViewHandlingStrategy.createView(ViewHandlingS
> trategy.java:203)
> at
>
> com.sun.faces.application.view.FaceletViewHandlingStrategy.createView(Facele
> tViewHandlingStrategy.java:636)
> at
>
> com.sun.faces.application.view.MultiViewHandler.createView(MultiViewHandler.
> java:161)
> at
>
> com.ocpsoft.pretty.application.PrettyViewHandler.createView(PrettyViewHandle
> r.java:52)
> at
>
> com.sun.faces.application.view.ViewMetadataImpl.createMetadataView(ViewMetad
> ataImpl.java:101)
> at
> com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:239)
> at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
> 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)
> ... 86 more
>
>
> Thanks,
> --
> Lincoln Baxter, III
> http://ocpsoft.com
> http://scrumshark.com
> "Keep it Simple"
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net
>
>


-- 
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"