2 Replies Latest reply on Oct 3, 2006 11:42 AM by Gavin King

    Problem with conversation stack(nested Pageflows blocker)

    Denis Karpov Newbie

       

      public class Pageflow implements Serializable {
      ...
       public static Pageflow instance()
       {
      ...
       return (Pageflow) Component.getInstance(Pageflow.class, ScopeType.CONVERSATION, true);
       }
      ...
      

      public class Component {
      ...
       public static Object getInstance(String name, ScopeType scope, boolean create)
       {
       Object result = scope.getContext().get(name);
       result = getInstance(name, create, result);
       return result;
       }
      ...
      


      public class ServerConversationContext implements Context {
      ...
       public Object get(String name) {
      ...
       LinkedList<String> stack = getIdStack();
      ...
       for ( String id: stack )
       {
       result = session.getAttribute( getKey(name, id) );
       if (result!=null) return result;
       }
       return null;
      ...
       }
      


      Using this pattern we can have only one such Component (in this case Pageflow) per Conversation stack. When we ask for a new instance we will get an old one from some parent Conversation.

      This is the main thing that prevents using nested Pageflows.

      May be it is reasonable to add another option in Component.getInstance() to lookup only in one current Conversation.