Hi Gurkan, actually two instances needs to be restores: Conversation (request scoped bean) and ConversationContext (hold as ThreadLocal). WebBeansPhaseListener restores the last one. The Conversation is actually not set as a ThreadLocal, but instead retrieved from the ConversationBean every time it is requested, which itself relies on the ConversationService, which implementation in turn relies on the cid being set on the ViewRoot.
The problem with GET requests is, the ViewRoot is created for the requests (without a cid being set of course), so the cid needs to be set on the ViewRoot in order to be able to have the correct Conversation being looked up during the request. br, Sven 2009/11/18 Gurkan Erdogdu <[email protected]> > Hi; > > For GET requests, specification defines two ways > > 1* Redirect via JSF --> OWB handles --> Adding cid parameter to the URL. > 2* Ordinary GET requests --> You have to manage this scenario --> Adding > "cid" manually to URL > > In second case, if URL contains "cid" then conversation is restored in > WebBeansPhaseListener#AfterPhase#RESTORE_VIEW via > > String cid = > JSFUtil.getExternalContext().getRequestParameterMap().get("cid"); > > > --Gurkan > > 2009/11/18 Sven Linstaedt (JIRA) <[email protected]> > > > CID during GET requests must be set on UIViewRoot earlier than before > > render response > > > > > ------------------------------------------------------------------------------------- > > > > Key: OWB-171 > > URL: https://issues.apache.org/jira/browse/OWB-171 > > Project: OpenWebBeans > > Issue Type: Bug > > Components: Context and Scopes > > Reporter: Sven Linstaedt > > Assignee: Gurkan Erdogdu > > > > > > The problem: > > > > GET requests in JSF2 can be handled by the full lifecycle, if the view > > contains a <f:metadata/> with appropriate <f:viewParam/> components. > > Because no UIViewRoot is restored, but instead a new one is created, no > cid > > can be restored from the view root until WebBeansPhaseListener handles > > before render rensponse. > > > > If one requests the Conversation for injection during the lifecycle > > ConversationBean.createInstance() is called, which should lookup the > > conversation on the ConversationManager using the current sessionid and > cid. > > Both string based parameters are again looked up from the > > ConversationService. Unfortunately > ConversationService.getConversationId() > > uses the ViewRoot's attributes map of current FacesContext to retrieve > the > > cid, which will be first set in the render phase. This results in a new > > conversation being created. > > > > A possible solution would consists of setting the cid as early as the > view > > root is created in restore view. > > > > -- > > This message is automatically generated by JIRA. > > - > > You can reply to this email to add a comment to the issue online. > > > > > > > -- > Gurkan Erdogdu > http://gurkanerdogdu.blogspot.com >
