10 Replies Latest reply on Jun 28, 2007 11:50 AM by Venkat Danda

    clarification about propagation=

    Leo Baschy Novice

      First, that propagation="end" was hard to find. There was no example in the reference doc. I think only recently it mentions for s:link that propagation accepts "end" as option.

      Pete mentioned a while ago that "none" leaves the conversation sitting around, while "end" disposes of it. So I'd like to use "end" more often, not to leave conversations around.

      What's puzzling though is the following:

      If in a my.page.xml for good reasons I have

      <page>
       <begin-conversation join="true" />
      </page>


      and then in that page I also have an "exit" with

      <s:link view="/myOther.xhtml" value="Outta Here" propagation="end" />


      then what happens if when I get to myOther.xhtml the conversation is still there. Actually I see its id passed in the URL with cid=1 even though in the URL there also is a conversationPropagation=end.

      Now you folks who wrote that might think that's ok, but let's look at it as users of Seam.

      That seems to be in contradiction to these ideas: begin-conversation promotes when entering the page. Then it is a long-running conversation. Propagation="end" should be effective on its way out of the page, leave the conversation behind.

      I'm sure there is a reason. I've been looking at figure 9-3 in the The Java EE 5 Tutorial by Ball et al. when reading Seam reference section 6.1. This still puzzles me.

      I'm getting used to the fact that the there are requests (that I knew well from writing servlets) and responses trying hard to help give the appearance of objects in the UI, and there can be a redirect that makes things complicated.

      But can I please have a begin-conversation and then offer the user a link outta there where he ends that conversation? Simply?

      For now I'll stick with propagation="none" though I think I want "end", no conversations lying around after "none".

      Using a build from around March 15th.

        • 1. Re: clarification about propagation=
          Gavin King Master

          Um. Dude. How the hell am I supposed to know what conversation you want to end when clicking the link if I don't pass the conversation id??!

          • 2. Re: clarification about propagation=
            Leo Baschy Novice

            I admit, you have to know what conversation to end. I looked closer at what I'm doing, and the problem/question seems to be:

            Should propagation="end" end the conversation when entering the target page or when leaving (!) the target (!) page?

            I argue it should when entering, but it apparently does when leaving.

            In my test case I am coming via

            <s:link view="/myOther.xhtml" value="Outta Here" propagation="end" />


            into page myOther.xhtml that coincidentally also has in its myOther.page.xml

            <page>
             <begin-conversation join="true" />
            </page>


            My thought was like this: The propagation="end" means to end the conversation it was coming from (in my.xhtml).

            End it. Now. First thing when dealing with conversations in the JSF Request-Response Life Cycle. Where in Seam Reference 6.1 it says "At the end of the restore view phase of the JSF request lifecycle, Seam attempts to restore any previous long-running conversation context. If none exists, Seam creates a new temporary conversation context."

            I'd expect the propagation="end" at that point to make that conversation go away, and hence fulfill the "none exists" test.

            If I have a propagation="none" it is gone indeed.

            But if I have propagation="end" then the conversation still is there, and begin-conversation picks it up.

            Me thinks this just happened as implementation detail, implementing propagation="end" like or similar to @End or like end-conversation, while it should be implemented to be effective at the same time as propagation="none" would be.

            • 3. Re: clarification about propagation=
              Pete Muir Master

              Of course propagation="end" works the same as

              <end-conversation />
              and @End - that's certainly it's contract!. Remember that what end actually does is demote the long running conversation to temporary. So, you demote your lrc to temporary and hence the lrc context is still available at the next request but the conversation is temporary.

              You need to use
              <end-conversation beforeRedirect="true" />(on the navigation rule, and then you can do a begin-conversation in your destination.page.xml) to get the behaviour you're after.
              


              • 4. Re: clarification about propagation=
                Leo Baschy Novice

                Then how about introducing propagation="kill" which mostly works like propagation="none" but doesn't let the conversation linger around until it times out.

                As I want to use these inside <s:link/> and not inside navigation rules that beforeRedirect="true" doesn't work for me, does it?

                • 5. Re: clarification about propagation=
                  Pete Muir Master

                  Put a feature request in for beforeRedirect on s:conversationPropagation in JIRA

                  • 6. Re: clarification about propagation=
                    Leo Baschy Novice

                    Pete, I think you're thinking of uses of s:link with action="some.action", while...

                    I'm thinking of uses of s:link with view="/some.xhtml".

                    There is no action involved. I don't think there is a redirect. Right off to the target page with a GET from a URL, render it, done.

                    I want to use s:link, with all its functionality, benefits, etc. Just, please, kill that old conversation.

                    That said, I don't think "beforeRedirect on s:conversationPropagation" would be the answer. Right or wrong? Just trying to be correct.

                    • 7. Re: clarification about propagation=
                      Pete Muir Master

                      oic - oops.

                      Ok, I think that what you are after doesn't fit into the way Seam's conversations work - it's this whole thing about end not ending a conversation, just demoting it.

                      Put it in JIRA as a feature request and see what Gavin says - perhaps I'm wrong - but especially as the functionality you are after *is there* if you do this via navigation rules...

                      • 8. Re: clarification about propagation=
                        Leo Baschy Novice

                        Found something that works as I want it to:

                        <s:link view="/myOther.xhtml" action="#{conversation.end}" value="Outta Here" />


                        Not sure whether to call that syntax sweet, but it seems to work.

                        • 9. Re: clarification about propagation=
                          Leo Baschy Novice

                          I recant. The <s:link view="/myOther.xhtml" action="#{conversation.end}" value="Outta Here" /> doesn't work like an action on the source page, but on the target page.

                          Now I have tested it works to write one component like

                          import org.jboss.seam.annotations.Name;
                          import org.jboss.seam.core.Conversation;
                          
                          @Name("conversaction")
                          public class Conversaction {
                          
                           public String endAndTo(String viewId) {
                           Conversation.instance().end();
                           return viewId;
                           }
                          }


                          and to have link from source page /my.xhtml like

                          <s:link action="#{conversaction.endAndTo('/myOther.xhtml')}" value="Outta Here" />


                          On the down side it appears that any <f:param name="paramToMyOtherName" value="paramToMyOtherValue" /> doesn't arrive at the target page.

                          Also, regrettably, it does cost an extra redirect.

                          Would have been nicer instead to have used a built-in

                          <s:link view="/myOther.xhtml" propagation="kill" value="Outta Here" />


                          • 10. Re: clarification about propagation=
                            Venkat Danda Newbie

                            In my app, whenever user clicks on some of the menu links I am starting the new conversation and specifying the propagation="end" on every menu link. My expectation is to kill the current conversation whenever click on link. Right now what's happening is its not complaining on creating the new conversation but the previous conversation data is carry over to the new one.

                            If you introduce propagation='kill', does my problem is going to resolve? I would appreciate if anyone suggests work around/solution to the problem.