-
1. Re: how to leave a long running conversation and start a new
marcelkolsteren Feb 7, 2008 4:29 PM (in response to marcelkolsteren)Leaving the long-running conversation programatically in the action method turns out to be no solution: Seam's ConversationInterceptor throws an IllegalStateException before the method is executed, because the @Begin annotation doesn't specify "join=true". I could try to work around this by registering another action listener to the command button, which fires before the main action method, and which leaves the conversation. That makes the construction even more artificial.
Anyone who knows an elegant solution? -
2. Re: how to leave a long running conversation and start a new
c_inconnu Feb 14, 2008 1:08 PM (in response to marcelkolsteren)Hi
I have a similar problem and i am quite new to Seam. Has anyone a solution ?
marcelkolsteren could you please explain how you did it using the API ?
Thanks -
3. Re: how to leave a long running conversation and start a new
marcelkolsteren Feb 14, 2008 2:29 PM (in response to marcelkolsteren)Good to know that I'm not the only one who needs this functionality. I posted my solution for switching to another long running conversation on my weblog: http://marcelkolsteren.blogspot.com.
-
4. Re: how to leave a long running conversation and start a new
c_inconnu Feb 15, 2008 4:05 AM (in response to marcelkolsteren)Thanks for the input. It is what i was looking for.
However, it is strange that there is no direct support for this... I was wondering if using one big top level conversation then nested conversations couldn't do the job (i am a noob, remember :) ?
In fact, my problem is to manage workspace a la eclipse (http://jboss.com/index.html?module=bb&op=viewtopic&t=130054).
If someone from the Seam team may answer to that question, it will be a real help!
Thanks anyway -
5. Re: how to leave a long running conversation and start a new
ajay_gupta0512 Feb 15, 2008 9:22 PM (in response to marcelkolsteren)Folks,
We faced a similar situation a few days ago. The user could click on a hyperlink in a page to go to a different page which was required to open in a new non-nested conversation. Before redirecting to the new page, the application was required to process the edits the user had made on the screen, save those changes and not end the conversation (instead, leave the conversation since the user could come back to the first page by back buttoning from the 2nd page).
The solution we went with was:
1. On the JSP page, use <h:commandLink> to post the form data back to the server so that the POST will propagate conversation.
2. Process the form submit using standard JSF phases.
3. Determine which page to redirect the user to.
4. In phase V, return the navigation constant corresponding to the 2nd page.
5. In pages.xml, use:
<page view-id="/first-page.jsp">
<rule if-outcome="shouldRedirect">
<raise-event type="leaveConversation" />
<redirect view=id="/secondPage.jsp">
6. Define an event listener for leaveConversation event. In the @Observer method for this event, do as follows:
i. Conversation.leave().
ii. Get conversation entry for the Conversation object and call unlock() on it.
This worked perfectly. I know this is not an ideal solution.
We would like to suggest that Seam team support ability for specification of a tag like <leave-conversation> in pages.xml (similar to <begin-conversation> and <end-conversation>). That will be the ideal solution to this problem. -
6. Re: how to leave a long running conversation and start a new
marcelkolsteren Feb 17, 2008 5:55 PM (in response to marcelkolsteren)Thanks for presenting your solution to a similar problem. We share the hope for attention of the Seam team to these conversation switching issues. In your case, the new conversation only starts after the redirect, in the next request. That makes a big difference. I need to switch to another conversation inside an action method, and I would like the new conversation to be active in the render response phase, without redirecting. So the ideal solution that you present won't help me out.
-
7. Re: how to leave a long running conversation and start a new
dgsmith2 Feb 23, 2012 1:39 PM (in response to marcelkolsteren)Marcel, now that it has been a solid 4 years since your post your blog link is no longer up to date. Any chance you have your solution posted somewhere else?
-
8. Re: how to leave a long running conversation and start a new
dgsmith2 Mar 8, 2012 10:31 AM (in response to dgsmith2)A "solution" we came up with was to use a redirect call within the action method. I don't know if we will encounter any issues in regards to moving on before Seam may or may not have had opportunity to complete any of its tasks (e.g., flushing contexts, etc)
FacesManager.instance().redirect