2 Replies Latest reply on Jul 13, 2009 11:55 PM by Arbi Sookazian

    exceptions and conversation

    Tilman Rossmy Newbie

      I configured pages.xml so that when an exception ocurrs the current long running conversation is ended, in order to be safe from some seemingly arbitrary behaviour. However I need a long running conversation at any point in time. So, is it possible to end and immediately start a long running conversation?

        • 1. Re: exceptions and conversation
          Arbi Sookazian Master

          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:


          why not?

          • 2. Re: exceptions and conversation
            Arbi Sookazian Master

            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:commandButton value="startLRC" action="#{equipmentProcessing.startLRC}"/>
                    <h:commandButton value="testKillStartLRC" action="#{equipmentProcessing.testKillThenStartLRC}"/>

            public String startLRC(){
                    return "/EquipmentProcessing.xhtml";
            public String testKillThenStartLRC(){
                    Conversation currentConversation = Conversation.instance();
                    if (currentConversation.isLongRunning())
                            log.info("this is a LRC!");
                            log.info("this is not a LRC!");
                    Conversation newConversation = new Conversation();
                    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...