jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Re: [1403-UIViewActionEnterFlows] Leonardo: SPECIFCATION CHANGE

From: Leonardo Uribe <leonardo.uribe_at_irian.at>
Date: Tue, 1 Sep 2015 17:03:03 -0500

Hi

I tried the solution proposed (add query params before redirect). It works,
but I have to say from a pure Post-Redirect-Get pattern perspective, it
looks better to do the transition inside handleNavigation(...), as is
working in MyFaces right now (at least by default if no redirect is
specified). The reason is in that way, you can prevent enter the flow
twice, if the view is submitted again.

regards,

Leonardo Uribe

2015-08-31 20:16 GMT-05:00 Leonardo Uribe <leonardo.uribe_at_irian.at>:

> Hi
>
> I checked the code inside MyFaces and the case was taken into account, but
> the solution done was different. I remember I let this note inside the code:
>
> // The spec doesn't say anything about how to handle
> redirect but it is
> // better to apply the transition here where we have
> already calculated the
> // route than add the parameters and delegate to
> // FlowHandler.clientWindowTransition(facesContext)
> applyFlowTransition(facesContext, navigationContext);
>
> The reason was you could have situations where you enter into two flows at
> the same time, so I thought it was better to call
> FlowHandler.transition(...) instead
> FlowHandler.clientWindowTransition(...), passing the arguments.
> Theoretically, there is an algorithm in place in
> FlowHandler.clientWindowTransition(facesContext) to handle this case, but I
> don't know if do a change there will work or not.
>
> If <f:viewAction ...> works like a commandButton, the transition should
> happen on handleNavigation(...), but the problem is <f:viewAction ...>
> relies on a redirect to render the new view, but the action/actionListener
> is executed on the current request, not on the redirect. My first
> impression is if and only if navigationCase.isRedirect() is true, the
> params must be passed as specified on the spec, so the flow transition
> could happen in FlowHandler.clientWindowTransition(...).
>
> I'll try the solution proposed to see how it works.
>
> regards,
>
> Leonardo Uribe
>
> 2015-08-31 17:50 GMT-05:00 Edward Burns <edward.burns_at_oracle.com>:
>
>> >>>>> On Thu, 27 Aug 2015 21:12:34 +0200, arjan tijms <
>> arjan.tijms_at_gmail.com> said:
>>
>> AT> Hi,
>> AT> On Thu, Aug 27, 2015 at 1:33 AM, Edward Burns <
>> edward.burns_at_oracle.com> wrote:
>> >> In JSF 2.2, we provided for UIViewAction causing a redirect when
>> >> the current and new viewIds differ. We also provided for using GET
>> >> based navigation to enter and exit flows. What we missed was the
>> >> interaction between these two features.
>>
>> AT> This specifically mentions UIViewAction, but it looks like redirects
>> AT> (PRG pattern) to enter, exit or navigate between nodes in the flow
>> AT> does not work either (I used Mojarra 2.2.12 and 2.3.m04-snapshot).
>>
>> AT> I tried a variety of things, but could not make it work. PRG can be
>> AT> important here to prevent the one-url-behind problem. See this SO
>> AT> question as well:
>> AT>
>> http://stackoverflow.com/questions/23745606/how-to-enter-a-jsf-2-2-flow-with-faces-redirect
>>
>> Thanks for bringing that to my attention. Now that I have a fix for
>> 1403-ViewActionEnterFlows I will take a look at that StackOverflow
>> question. Perhaps it will prove to be resolved by the changes I made
>> for 1403-flows.
>>
>> Ed
>>
>> --
>> | edward.burns_at_oracle.com | office: +1 407 458 0017
>> | 46 Business days til JavaOne 2015
>> | 61 Business days til DOAG 2015
>>
>
>