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

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

From: Edward Burns <edward.burns_at_oracle.com>
Date: Wed, 26 Aug 2015 16:33:13 -0700

Hello Volunteers,

I'm calling Leonardo out specifically on this because he'll need to make
this change in MyFaces.

Continuing development work on CargoTracker [1] revealed an important
corner case we missed in JSF 2.3: interaction between UIViewAction and
Flows. 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.

This issue accounts for this omission by adding some spec language in
section 7.4.2 Default NavigationHandler Algorithm. There is an existing
paragraph there about the <redirect /> case, but it didn't mention
UIViewAction or flows. Here is the proposed new text of that paragraph.
I have also added a reference to it in the class javadoc in
UIViewAction. New text is listed on separate lines.

  If the <redirect/> element was specified in this <navigation-case>,

New> or this invocation of handleNavigation() was due to a UIViewAction
New> broadcast event where the new viewId is different from the current
New> viewId,

  resolve the <to-view-id> to a view identifier, using the
  algorithm in Section 7.4.2.1 “Requirements for Explicit Navigation in
  Faces Flow Call Nodes other than ViewNodes”. Call getRedirectURL() on
  the ViewHandler, passing the current FacesContext, the <to-view-id>,
  any name=value parameter pairs specified within <view-param> elements
  within the <redirect> element, and the value of the
  include-view-params attribute of the <redirect /> element if present,
  false, if not.

New> If this navigation results in a flow transition, include the
New> relevant flow metadata as entries in the parameters. This metadata
New> is the FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME and the
New> FlowHandler.FLOW_ID_REQUEST_PARAM_NAME for the flow that is the
New> destination of the transition. The names of the entries are the
New> values of FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME and
New> FlowHandler.FLOW_ID_REQUEST_PARAM_NAME. If the parameters map has
New> entries for either of these keys, both of the entries must be
New> replaced with the new values.

  The return from getRedirectURL() is the value to be sent to the client
  to which the redirect will occurr. Call getFlash().setRedirect(true)
  on the current FacesContext. Cause the current response to perform an
  HTTP redirect to this path, and call responseComplete() on the
  FacesContext instance for the current request. If the content of
  <to-view-id> is a value expression, first evaluate it to obtain the
  value of the view id.

I think this can be backported to 2.2 implementations without any
breakages in backward compatibility.

Thanks,

Ed

[1] https://java.net/jira/browse/CARGOTRACKER-69

-- 
| edward.burns_at_oracle.com | office: +1 407 458 0017
| 50 Business days til JavaOne 2015
| 65 Business days til DOAG 2015