Hi,

premise: I am using Mojarra 2.0.1 and a nightly build of OWB.

While evaluating the above mentioned frameworks for and upcoming project of
my company I ran into and issue using long runnung conversations, which will
not get propagated to the next view.

The problem is after a postback the CID could not be retrieved from the
UIViewRoot attributes (WebBeansPhaseListener:85). A manual check while
debugging confirms this observation. So I turn towards the point, where the
CID is set (WebBeansPhaseListener:174) at the view's root.

Interestingly this works using JSF 1.x, so I digged a bit (and after that a
lot of) deeper: JSF 2.0 introduced a new mechanism called partial state
saving with the goal to reduce the needed amount of memory for view states
(aka component tree's state) in the session. The idea is quite simple: Much
of the components state's information can be rebuild from the view (or
precisely the Facelet of that view) and just the programmatically changes
state information (and of course user postback state changes) need to be
saved along with the component tree.

To decide when the the initial state from the view is fully set, all
components have a new flag "initialStateMarked", which is set after the
component tree is build in ViewHandlingStrategy.buildView() during
RENDER_RESPONSE, if there was not any postback before. All changes to the
tree after this point are written to a special map, only containing the
differences from the original view. This delta map is then saved as the
UIViewRoot tree state after the view is rendered in
ViewHandlingStrategy.renderView().

So where is the problem? OWB saves the CID before RENDER_RESPONSE (which
sounds correct to me). The initial state flag is set during RENDER_RESPONSE,
after the CID is set at UIViewRoot attributes. When the component state is
saved, the CID is not noticed, because it was set as part of the initial
state and not the delta state.

So far I have found one work around: There is an ServletContext init
parameter (javax.faces.FULL_STATE_SAVING_VIEW_IDS), which enables legacy
state saving for particular view IDs.

The only other solution I can think of currently is marking the UIViewRoot's
initialState flag before setting the CID in WebBeansPhaseListener.

Because I am neither an expert for JSF2 nor for JCDI I would like to hear
your opionen about this topic. Do you know of any side effects, if the
initial state is marked before RENDER_RESPONSE?


br, Sven

Reply via email to