-
1. Re: exceptions and conversation
asookazian Jul 13, 2009 11:18 PM (in response to trossmy)You could try adding an <action> tag in the exception handler in your pages.xml which calls an action method in a JavaBean or SFSB/SLSB that programmatically ends the active LRC and begins a new temporary conversation and immediately promotes it to LRC. I've never tried this so caveat emptor...
I just check my idea and according to Seam pages.xml XSD/DTD, it's not legal to place an <action> tag inside <exception> tag.
I don't see 'exception' here:
http://www.jboss.com/products/seam/pages-2.1.xsd
why not?
-
2. Re: exceptions and conversation
asookazian Jul 13, 2009 11:55 PM (in response to trossmy)I am not sure if you can achieve your objective declaratively in the pages.xml.
But I tried the following experiment.
xhtml with conversation-scoped SFSB backing bean.
<h:form> <h:commandButton value="startLRC" action="#{equipmentProcessing.startLRC}"/> <h:commandButton value="testKillStartLRC" action="#{equipmentProcessing.testKillThenStartLRC}"/> </h:form>
@Begin(join=true) public String startLRC(){ return "/EquipmentProcessing.xhtml"; } public String testKillThenStartLRC(){ Conversation currentConversation = Conversation.instance(); if (currentConversation.isLongRunning()) log.info("this is a LRC!"); else log.info("this is not a LRC!"); currentConversation.endBeforeRedirect(); Conversation newConversation = new Conversation(); newConversation.begin(); return "/EquipmentProcessing.xhtml"; }
First I noticed if you return void in startLRC() method, then the cid is not postpended to the URL after postback to the same xhtml. When I return String, then I see cid=2 at the end of the URL after postback.
Then after postback, I click the second button and I see this output in the console:
this is a LRC!
even though in the debugger my currentConversation instance has only three properties (description, timeout, viewId) all of which are null.
After the testKillThenStartLRC() method returns and page postback again, there is no postpending of cid=x in the URL and when I navigate to the foo/debug.seam page, cid=2 is listed in the Conversations dataTable (which is totally unexpected b/c it should have been ended by the currentConversation.endBeforeRedirect(); statement)
Can someone please explain this behavior? There are no exceptions in the console...