2 Replies Latest reply on Nov 26, 2007 1:34 PM by dustismo

    Getting proper conversation id after ending nested conversat

    dustismo

      Hello,

      I have a couple of servlets that I need to explicitly pass in the cid param to. I just noticed that the cid is incorrect if a nested conversation was just ended. Params in the url show cid=XX and parentConversationId=XX.. Obviously the cid is incorrect because the conversation is maintained until after the redirect (I could use endBeforeRedirect but I need the messaging).

      So the question is how can I get the correct cid as a parameter for my servlet?

      The following method does the trick, but it terribly stupid..

      public String getCid() {
       FacesContext context = FacesContext.getCurrentInstance();
       HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
       String id = Conversation.instance().getId();
       if (Conversation.instance().isNested()) {
       String parentId = request.getParameter("parentConversationId");
       if (parentId != null)
       id = Conversation.instance().getParentId();
       String convProp = request.getParameter("conversationPropagation");
       if (convProp != null && convProp.equals("end"))
       id = Conversation.instance().getParentId();
       }
       return id;
       }
      
      


      Is there an improved way to do this? (I am using seam 1.3a so maybe there is something in 2.0?)

      thanks for any help,
      Dustin