Hi
I was able to reproduce the problem. Thanks for the log, it helped a
lot to understand what's going on. It looks like the call to
restoreState was overriding view scope, so the fix done was add some
lines to check that case and avoid it. I added some junit tests and on
the way I fixed a small issue with view root metadata facet.
I hope these fixes will solve your problem. Let us know if that is the
case or not.
regards,
Leonardo Uribe
2015-03-24 16:39 GMT-05:00 Chris Kulinski chriskulin...@yahoo.com:
Leonardo - Thanks for the research and updated cases on the patch. We'll
apply your recent changes to our testing and try again.
Unfortunately, the additional fixes for this defect didn't fix our other
defect with missing View Scope. I'll create a new issue in the issue
tracker to watch this. We'll work on assembling a simple demo that shows the
problem.
The issue might happen because the View Pooling code doesn't always run
during RESTORE_VIEW phase. It only seems to run in RESTORE_VIEW for AJAX
post-backs. Any changes to our ViewScope objects that happen before
RENDER_RESPONSE are lost because it looks like the ViewScope is sometimes
reattached at RENDER_RESPONSE.
We've added manual debugging to the MyFaces source to attempt to show the
problem. Does this help enough to troubleshoot what's happening?
On the very first request to the view after application startup, the
behavior is correct. I guess this is because the View hasn't been flushed
and remapped by the pool yet. There is a second instance of the Bean
created, but that's maybe after the view is rendered (in saveViewRootState,
storeStatic and pushStaticStructureView).
2015-03-24 16:48:23,235 DEBUG
[com.autotrader.enterprise.common.context.LogPhaseListener] (default task-1)
Start Phase RESTORE_VIEW(1)
2015-03-24 16:48:23,374 DEBUG
[com.autotrader.enterprise.common.context.LogPhaseListener] (default task-1)
End Phase RESTORE_VIEW(1)
2015-03-24 16:48:23,400 INFO [stdout] (default task-1)
HelloCdiTwoScopedBean - constructed new instance
2015-03-24 16:48:23,406 DEBUG
[com.autotrader.enterprise.common.context.LogPhaseListener] (default task-1)
Start Phase RENDER_RESPONSE(6)
2015-03-24 16:48:23,420 INFO [stdout] (default task-1) POOLING:
retrieveStaticStructureMetadata root:/examples/ajaxsamples/helloAjax.xhtml
key:org.apache.myfaces.view.facelets.pool.impl.MetadataViewKeyImpl@f7711892
2015-03-24 16:48:23,420 INFO [stdout] (default task-1) POOLING:
retrieveStaticStructureMetadata metadatanull
2015-03-24 16:48:23,505 INFO [stdout] (default task-1) POOLING
root:/examples/ajaxsamples/helloAjax.xhtml dynamic:false
2015-03-24 16:48:23,505 INFO [stdout] (default task-1) POOLING:
saveViewRootState root:/examples/ajaxsamples/helloAjax.xhtml
2015-03-24 16:48:23,506 INFO [stdout] (default task-1) POOLING: storeStatic
root:/examples/ajaxsamples/helloAjax.xhtml
keyorg.apache.myfaces.view.facelets.pool.impl.MetadataViewKeyImpl@f7711892
2015-03-24 16:48:23,551 INFO [stdout] (default task-1)
HelloCdiTwoViewScopedBean - constructed new instance
2015-03-24 16:48:23,681 INFO [stdout] (default task-1) POOLING:
pushStaticStructureView
key:org.apache.myfaces.view.facelets.pool.impl.MetadataViewKeyImpl@f7711892
entry:org.apache.myfaces.view.facelets.pool.impl.SoftViewEntry@27ed7f
2015-03-24 16:48:23,683 DEBUG
[com.autotrader.enterprise.common.context.LogPhaseListener] (default task-1)
End Phase RENDER_RESPONSE(6)
On the next request, Pooling isn't executed until during RENDER_RESPONSE.
This bean is created after RESTORE_VIEW, but before RENDER_RESPONSE (via
PrettyFaces). The view is using a 2nd instance of the Bean for rendering,
without the values from the initial instance (after popStaticStructureView).
2015-03-24 17:18:51,090 DEBUG
[com.autotrader.enterprise.common.context.LogPhaseListener] (default task-6)
Start Phase RESTORE_VIEW(1)
2015-03-24 17:18:51,091 DEBUG
[com.autotrader.enterprise.common.context.LogPhaseListener] (default task-6)
End Phase RESTORE_VIEW(1)
2015-03-24 17:18:51,093 INFO [stdout] (default task-6)
HelloCdiTwoScopedBean - constructed new instance
2015-03-24 17:18:51,094 DEBUG
[com.autotrader.enterprise.common.context.LogPhaseListener] (default task-6)
Start Phase RENDER_RESPONSE(6)
2015-03-24 17:18:51,094 INFO [stdout] (default task-6) POOLING:
retrieveStaticStructureMetadata root:/examples/ajaxsamples/helloAjax.xhtml
key:org.apache.myfaces.view.facelets.pool.impl.MetadataViewKeyImpl@f7711892
2015-03-24 17:18:51,094 INFO [stdout] (default task-6) POOLING:
retrieveStaticStructureMetadata
metadataorg.apache.myfaces.view.facelets.pool.impl.ViewStructureMetadataImpl@15744d1
2015-03-24 17:18:51,094 INFO [stdout] (default task-6) POOLING:
popStaticStructureView
key:org.apache.myfaces.view.facelets.pool.impl.MetadataViewKeyImpl@f7711892
q:org.apache.myfaces.view.facelets.pool.impl.ViewPoolEntryHolder@672a58
2015-03-24 17:18:51,098 INFO [stdout] (default