6 Replies Latest reply on Feb 21, 2007 10:55 AM by gavin.king

    end-conversation

      Could somebody please explain when you'd have beforeRedirect set to true vs false for end-conversation in pages.xml? I can't seem to figure out when you'd use it and what the difference would be in your application.

      Thanks.

        • 1. Re: end-conversation
          gavin.king

          If you set beforeRedirect=true, during a request which ends in a browser redirect, the conversation context is destroyed during the initial request (before the redirected request) meaning that you won't have access to conversation-scoped state when the next page is rendered (you'll lose all the FacesMessages, etc). OTOH, you also won't see the ugly "?cid=4" crap in the URL :-)

          • 2. Re: end-conversation

            Oh...I didn't realize the behavior under "true" wasn't default behavior.

            If there wasn't a redirect, wouldn't the conversation be over on the re-rendered page (and if you did a GET for something else the conversation would not come with it)? Then how can a conversation propagate across a GET that happens immediately after the render in the form of a redirect?

            Confused...whatever...I'll just memorize that.

            • 3. Re: end-conversation
              gavin.king

              Re-read the documentation, and closely observe the behavior of the booking demo. By default, Seam propagates all conversations across redirects.

              (Yes, even temporary conversations!)

              (Yes, even conversations that you already @Ended.)

              Which is almost always what you want, in practice.

              • 4. Re: end-conversation
                gavin.king

                In fact, you are probably already taking advantage of this behavior in you app, without realizing it.

                • 5. Re: end-conversation

                  I just noticed that you can put end-conversation underneath a pages element. Would that end the conversation...on page load? Or would it mark the conversation as temporary, meaning that everything that happens in that page would still be in the same conversation?

                  Does setting beforeRedirect to true change whatever the above behavior is?

                  • 6. Re: end-conversation
                    gavin.king

                    It means demote a long-running conversation to temporary.

                    But since this stuff occurs just before render response, before-redirect has no effect when it occurs in this place.