Here is my solution:
Add this method to org.jboss.seam.core.Manager
| /**
| * End a conversation together with all nested conversations. The
| * conversation passed in cid will be destroyed at the end of the
| * request while the nested conversations are destroyed immediately.
| *
| * @param cid the ID of the conversation
| */
| public void endConversationByID(String cid, boolean beforeRedirect)
| {
| log.debug("Ending long-running conversation");
|
| if ( Events.exists() )
Events.instance().raiseEvent("org.jboss.seam.endConversation");
|
| ConversationEntries ce = (ConversationEntries)
| Component.getInstance("org.jboss.seam.core.conversationEntries");
| setCurrentConversationId( cid );
| setCurrentConversationIdStack(
| ce.getConversationEntry( cid ).getConversationIdStack());
| setLongRunningConversation( false );
| destroyBeforeRedirect = beforeRedirect;
| endNestedConversations( cid );
| storeConversationToViewRootIfNecessary();
| }
|
In the bean do this:
| public String endParent()
| {
| Manager m =
(Manager)Component.getInstance("org.jboss.seam.core.manager");
| m.endConversationByID(Conversation.instance().getParentId(), false);
| return "next.seam";
| }
|
| //Assuming conversations 1->2->3
| public String endParentOfParent()
| {
| Manager m =
(Manager)Component.getInstance("org.jboss.seam.core.manager");
|
| // kill immediately 3, set Conversation.instance() to 2 and mark it to
| // be ended at the end of the request
| m.endConversationByID(Conversation.instance().getParentId(), false);
|
| // kill immediately 2, set Conversation.instance() to 1 and mark it to
| // be ended at the end of the request
| m.endConversationByID(Conversation.instance().getParentId(), false);
| return "next.seam";
| }
|
The endParent() kills the current conversation immediately and the parent at the end of
the request. If you want to kill the parent of the parent too, you can call
endConversationByID against Conversation.instance().getParentId() because the current
Conversation instance is actually the conversation scheduled to be destroyed at the end of
the request.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4039593#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...