6 Replies Latest reply on Jun 3, 2008 8:01 AM by Leonids Maslovs

    how to end a conversation using <s:link>

    infinity2heaven Novice

      Home page link


      
      <s:link view="/home.xhtml" value="Home" propagation="end" />  
      
      



      I need to end the conversation (in the current page, served by a SFSB), when user clicks the 'home' link. I have a cleanup method in my SFSB's (both conversation scoped)


      
      @Remove
      
      @Destroy
      
      public void destroy() {
      
         Contexts.removeFromAllContexts("selectedTimePeriod");
      
      }
      
      



      But Destroy is never called, I'm guessing propagation=end is not really ending my conversation


      Any suggestions?


           

        • 1. Re: how to end a conversation using <s:link>
          Leonids Maslovs Newbie

          I believe All you need is add


          @End //!!!!!!!!!!!!!!!!
          @Remove
          @Destroy
          public void destroy() {
             log.info('here');
             Contexts.removeFromAllContexts("selectedTimePeriod");
          }
          



          annotation there.


          @Destroy - is bean related?
          @Remove - either?
          



          @Begin/@End annotations would mark your conversation properly.


          • 2. Re: how to end a conversation using <s:link>
            infinity2heaven Novice

            The answer is irrelevant to my question. I need to end teh current conversation when user clicks on any <s:link>, not in the SFSB (which I understand)

            • 3. Re: how to end a conversation using <s:link>
              Leonids Maslovs Newbie

              Sorry, I am a little confused (and it's kinda too late or too early  in my location ;)
              SFSB - Seam Front Side Bus?
              I could suggest You to mark some action method method as @End and pass it to the s:link


              <s:link action="#{bean.endSmth} />"
              



              and to see what happens.


              But, IMO propagation "end" should work.
              May be it's worth to pass the some action and digg into Conversations/Contexts via debugging console :)

              • 4. Re: how to end a conversation using <s:link>
                Leonids Maslovs Newbie

                I assume my answer is still irrelevant enough. :)


                +1 cent - possible solution to see what happens where - to invalidate session, reset conversation timeouts and so on.. Just to see what happens along the changes

                • 5. Re: how to end a conversation using <s:link>
                  infinity2heaven Novice

                  Ok, let me explain my use case. There are 3 main tabs A, B, C (menu). Each Tab internally may have multiple sub tabs under it. Let's say A1, A2, A3. And B1, B2, B3. Each of these subtabs, is backed by a conversation scoped SFSB (StateFul Session Bean).


                  Let's say the user is working on A1 and suddenly changes his mind and clicks on B. I  need to end the conversaion A1.(after showing a js popup that changes will be lost). I can't have an action here because I don't know from where he's coming. He could come from B1 or C3. The point is, the current conversation should end.


                  Seam reference says <s:link propagation="end"> would end the current conversation. But it doesn't look like as my @Destroy method is never called

                  • 6. Re: how to end a conversation using <s:link>
                    Leonids Maslovs Newbie

                    Hi Priya,


                    I see Your pain now. I think I am not the right man to speak about SFSB related stuff :) Anyway, my vision of the problem:



                    1. conversation isn't ended

                    2. conversation scoped bean cleanup procedure isn't called. As I see - it should be called onto a) remove from AS 2) destroying context



                    So, I would suggest You to demark/divide each of this do you really have. I would suggest You to use


                    @Observer(value="org.jboss.seam.endConversation")
                    public void observeConversationEnd() {
                    log.info("CONVERSATION Ended");
                              
                    }
                    @Observer(value="org.jboss.seam.beginConversation")
                    public void observeConversationStart() {
                    log.info("CONVERSATION Started");          
                    }
                    



                    or similar Just to see what is the state of conversations.
                    And once more- I would suggest you to call Conversation.instance().end() by hand - to see that happens.


                    I believe You could invoke this stuff from your *.jsf via


                    <s:link action="#{conversation.end}">
                    



                    So, what I would do myself (in order):



                    • Ensure conversation lifecycle through observers or smth. (In the worst case calling #{conversation.end} in action or via Seam Remoting.

                    • Only after that look on SFSB cleanup procedure invocation problems.