I'm trying to migrate a JSF 2/Glassfish 3.1 app from JSF managed beans to using CDI. The first problem was the rather surprising lack of a view scope in Weld. I looked at RenderScoped in Seam 3 but unfortunately had all kinds of problems, presumably due to the known issues with Seam 3/Glassfish 3.1. Also seam-faces won't allow mixing managed beans and CDI beans so there's no phased migration possible, no doubt for good reasons.
I need view scope or the ajaxified PrimeFaces components won't work, and I've now got Steven Verborgh's ViewScoped implementation working. The man deserves a medal.
Now for my question, as a test I've got 2 @ViewScoped beans and I'd like to use a conversation scoped bean to pass parameters between 2 pages (I've found it least confusing to always have a backing bean per page). In the JSF managed bean environment I've been using view parameters which can be laborious to use in certain circumstances.
So what I've done is define a TransferBean which is @Conversation Scoped and I @Inject this into both the @ViewScoped beans. Just prior to navigating from one page to the other I call transferBean.getConversation.begin(), copy the necessary data into the instance and navigate to the next page. In the preRenderView listener for the next page I setup a reference to the "parameter" data in the transfer bean from the view scoped bean and end the conversation, as it's no longer required.
This actually works, but the first problem I've encountered is that the next page is showing as ...next.xhtml?cid=1 in the browser (I used faces-redirect=true), but as I ended the conversation in the preRenderView if the user hits browser refresh they get a 'no conversation found to restore' error.
Is there anything I can to do to avoid this error? I had a look through the FAQ, KB and searched the forums but couldn't see anything that seemed to match.