You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Jakob Korherr <ja...@gmail.com> on 2009/10/27 22:07:03 UTC

[jsf 2.0] UIViewRoot afterPhase

Hi,

While working on MYFACES-2374 "UIViewRoot.getBeforePhaseListener() and
UIViewRoot.getAfterPhaseListener() could be called on PhaseId.RESTORE_VIEW",
I found out that the mojarra javadoc was changed, so that only
UIViewRoot.getAfterPhaseListener should be called on RESTORE_VIEW.

Mojarra javadoc on UIViewRoot.setAfterPhaseListener says: "Allow an
arbitrary method to be called for the "afterPhase" event as the UIViewRoot
runs through its lifecycle. This method will be called for all phases
including PhaseId.RESTORE_VIEW."
Just a week ago UIViewRoot.setBeforePhaseListener also said "...for all
phases including PhaseId.RESTORE_VIEW.", now it says "...except
PhaseId.RESTORE_VIEW."

It is clear to me, why this was changed, because you have to restore the
view before you can access the attributes, not really difficult to see.
But why should we still call UIViewRoot.getAfterPhaseListener on
RESTORE_VIEW?

Spec says that we should only call an afterPhase method, if the relating
beforePhase method returned without an Exception. Of course, these
attributes of UIViewRoot are different to its "normal" PhaseListeners, but I
think that this behaviour is kind of strange.
Why don't we change it back to the way it was in jsf 1.2? So that
UIViewRoot.getBeforePhaseListener AND UIViewRoot.getAfterPhaseListener are
called for all phases except RESTORE_VIEW.

Also: Mojarra 2.0.1 does not call UIViewRoot.setAfterPhaseListener on
RESTORE_VIEW.

Thanks in advance.

Regards

Jakob Korherr

Re: [jsf 2.0] UIViewRoot afterPhase

Posted by Martin Marinschek <mm...@apache.org>.
Hi Jakob,

if UIViewRoot.afterRestoreView is not called by Mojarra in its current
state even though the spec language is clear, you should raise an
issue with the implementation.

If you are hinting into a direction where you say that the spec
language is not clear (which I think you do), then you should raise an
issue with the spec, and until that issue is resolved, implement it so
that it does the same as Mojarra currently does to remain
compatibility.

regards,

Martin

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: [jsf 2.0] UIViewRoot afterPhase

Posted by Simon Lessard <si...@gmail.com>.
Hi Jakob,

Because after restore view is actually one of the most used (along with
before render) and was specifically added to 2.0 for that purpose. It's not
possible to make it different because the spec say so, and thus MyFaces
might not pas the TCK if it was made differently. So, there's absolutely
nothing to do about it except raise the issue to the EG. But, as you
mentioned, the before restore is pretty much impossible since the attribute
is not yet restored.


Regards,

~ Simon

On Tue, Oct 27, 2009 at 5:07 PM, Jakob Korherr <ja...@gmail.com>wrote:

> Hi,
>
> While working on MYFACES-2374 "UIViewRoot.getBeforePhaseListener() and
> UIViewRoot.getAfterPhaseListener() could be called on PhaseId.RESTORE_VIEW",
> I found out that the mojarra javadoc was changed, so that only
> UIViewRoot.getAfterPhaseListener should be called on RESTORE_VIEW.
>
> Mojarra javadoc on UIViewRoot.setAfterPhaseListener says: "Allow an
> arbitrary method to be called for the "afterPhase" event as the UIViewRoot
> runs through its lifecycle. This method will be called for all phases
> including PhaseId.RESTORE_VIEW."
> Just a week ago UIViewRoot.setBeforePhaseListener also said "...for all
> phases including PhaseId.RESTORE_VIEW.", now it says "...except
> PhaseId.RESTORE_VIEW."
>
> It is clear to me, why this was changed, because you have to restore the
> view before you can access the attributes, not really difficult to see.
> But why should we still call UIViewRoot.getAfterPhaseListener on
> RESTORE_VIEW?
>
> Spec says that we should only call an afterPhase method, if the relating
> beforePhase method returned without an Exception. Of course, these
> attributes of UIViewRoot are different to its "normal" PhaseListeners, but I
> think that this behaviour is kind of strange.
> Why don't we change it back to the way it was in jsf 1.2? So that
> UIViewRoot.getBeforePhaseListener AND UIViewRoot.getAfterPhaseListener are
> called for all phases except RESTORE_VIEW.
>
> Also: Mojarra 2.0.1 does not call UIViewRoot.setAfterPhaseListener on
> RESTORE_VIEW.
>
> Thanks in advance.
>
> Regards
>
> Jakob Korherr
>