9 Replies Latest reply on May 10, 2010 7:39 AM by Adam Warski

    What scopes will we have out-of-the-box?

    B Tomic Newbie

      I am just interested to know what scopes will Seam 3 provide out of the box? Will we have Page scope? Also, I've heard there will be no temporary conversations, but we will be given the Flash scope instead. Is this true? Won't this severely affect the ability to code conversational components that would behave the same in temporary and long-running conversations?

        • 1. Re: What scopes will we have out-of-the-box?
          B Tomic Newbie

          In a different thread, I learned that transient conversations no longer survive redirects, and that JSF2's flash scope is now used for this. Yet the Weld ref docs say:



          The conversation context propagates across redirects, making it very easy to implement the common POST-then-redirect pattern, without resort to fragile constructs such as a 'flash' object. The container automatically adds the conversation id to the redirect URL as a request parameter.

          But the more I read on CDI/JSF2/Seam3 the more I realize how little they have in common with the previous versions and how little I actually understand them... and I could find nothing conclusive on flash vs transient conversations in Seam 3. Only some old threads and some scattered info here and there. Will Seam 3 have both? Will conversations work differently than in Seam 2?


          It would really be great if anyone could shed some light on this... I would be very much grateful for any piece of info as I am zealously interested in these new technologies, especially Seam 3.

          • 2. Re: What scopes will we have out-of-the-box?
            Adam Warski Master

            Your confusion is probably caused because Seam2 in fact had two kinds on conversation scopes: transient and long-running, between which you could convert.


            Weld/Seam3 only has the conversation scope, which is the equivalent of the long-running conv scope in Seam2. So it survives redirects, but you need a running (active) conversation). Otherwise it spans a single request.


            Regarding the Seam2 Page scope, it will be present in Seam3 under the name View scope.


            Flash scope is also different than transient conv. scope, as it always spans two requests - at least that's my understanding.


            A page with scopes translations would probably be good :)


            Adam

            • 3. Re: What scopes will we have out-of-the-box?
              Arbi Sookazian Master

              Understanding/explaining scope mappings and backwards compatibility would be nice.

              • 4. Re: What scopes will we have out-of-the-box?
                B Tomic Newbie

                I also think Weld reference docs should explicitly say that all statements regarding conversations are true for long running ones only. It is very misleading as it is, especially for Seam 2 developers.

                • 5. Re: What scopes will we have out-of-the-box?
                  Arbi Sookazian Master

                  Bojan Tomic wrote on Apr 20, 2010 10:43:


                  I also think Weld reference docs should explicitly say that all statements regarding conversations are true for long running ones only. It is very misleading as it is, especially for Seam 2 developers.


                  This is a very good point, esp. considering that most devs (initially anyways) using Weld/Seam3 will have experience with Seam 2.x.

                  • 6. Re: What scopes will we have out-of-the-box?
                    Adam Warski Master

                    An initial version of scopes translation is available here:


                    http://seamframework.org/Seam3/Seam2ToSeam3MigrationNotes


                    Adam

                    • 7. Re: What scopes will we have out-of-the-box?
                      B Tomic Newbie

                      Thanks for pointing it out. It's a very useful piece of info.


                      On a related note, I can seem to decide if the lack of transient conversations is good or bad. On one hand, the CDI way seems more logical but, on the other, it makes you code beans differently depending on whether you just want them to survive redirects or live in a LRC. What if you want both?


                      For some reason I fail to imagine all the implications of the difference between CDi and Seam 2 conversations. Could someone share their opinion on this? Do you see this change as clearing up the confusion or as taking the power away from you? I'd really appreciate hearing others' views.


                      P.S.
                      Seam 2 trained me to think of flash scope as something bad. Less flexible and versatile than conversations. But now I am trained to think of them as complementing... and it's confusing.

                      • 8. Re: What scopes will we have out-of-the-box?
                        Nicklas Karlsson Master

                        I think the target is to abstract away the conversation/flash scope so that Seam 3 will provide the tools that just works for the right jobs (e.g. message propagation over redirects etc). And the provide documentation and best practices docs when you need to tune stuff manually.

                        • 9. Re: What scopes will we have out-of-the-box?
                          Adam Warski Master

                          I'm just guessing here, but it could have been that jboss was voting for conversations as they were in Seam2, while other EG group members wanted otherwise; you know, politics ;). But it's only my guess.


                          Anyway, apart from flash and conversation scopes, in Seam3 there's also the View scope, which has some of old transient conversations functionality (surviving postbacks). I think that after a couple of applications written using Weld it will become clear if lots of hacking is needed because of the lack of transient conversations, or the opposite: are the current scopes enough.


                          So far the only problem I've hit is that the flash scope doesn't seem to be working well (it's buggy in JSF), when I was trying to use it to store FacesMessages. And anyway, it isn't really as good a place to store them as the old transient conversations: sometimes you want the context to survive a redirect (when a request ends in a redirect) and sometimes not (when a request ends in a render, i.e. a postback with a redirect). In the latter case scoping the component as flash is too much.


                          Adam