4 Replies Latest reply on Jan 3, 2007 12:45 AM by Hari Cahyadi

    How to get conversation ID in portlet

    Hari Cahyadi Newbie

      How to get conversation ID in a potlet application?

        • 1. Re: How to get conversation ID in portlet
          Norman Richards Master

          Does #{conversation.id} not work?

          • 2. Re: How to get conversation ID in portlet
            Hari Cahyadi Newbie

            I am not try it yet, but as a description I have two portlet A and B that perform IPC, and I want to get the current conversation ID in potlet B, because every time I click on portlet A that perform IPC to portlet B it creates new conversation, not used the previous conversation, so if I can get the current conversation ID, I can killed previous conversation, so I am not facing memory problem, here is my code for portlet B :


            public class BPortlet extends MyFacesGenericPortlet {

            public static class Listener implements PortalNodeEventListener {

            public PortalNodeEvent onEvent(PortalNodeEventContext context,
            PortalNodeEvent event) {
            //Listener for IPC
            }

            @SuppressWarnings("unused")
            private static final Log log = LogFactory.getLog(BPortlet.class);

            private String viewPage = null;

            private String editPage = null;

            private String helpPage = null;

            @SuppressWarnings("unused")
            private FacesContext fContext;

            protected void doEdit(RenderRequest request, RenderResponse response)
            throws PortletException, IOException {
            ...
            }

            protected void doHelp(RenderRequest request, RenderResponse response)
            throws PortletException, IOException {
            ...
            }

            @Override
            public void init() throws PortletException, UnavailableException {
            ...
            }

            public void render(RenderRequest request, RenderResponse response)
            throws PortletException, IOException {
            ...
            }

            protected void setDefaultView() throws UnavailableException {
            ...
            }

            @Override
            public void processAction(ActionRequest request, ActionResponse response)
            throws PortletException, IOException {
            log.info((String)request.getParameter("conversationId"));
            log.info("{convesationId}");
            }

            @Override
            protected void doView(RenderRequest request, RenderResponse response)
            throws PortletException, IOException {
            ...
            }

            @Override
            protected FacesContext facesContext(PortletRequest request,
            PortletResponse response) {
            ...
            }

            @Override
            protected void facesRender(RenderRequest arg0, RenderResponse arg1)
            throws PortletException, IOException {
            ...
            }

            @Override
            protected ReleaseableExternalContext makeExternalContext(
            PortletRequest arg0, PortletResponse arg1) {
            ...
            }

            @Override
            protected void nonFacesRequest(RenderRequest arg0, RenderResponse arg1)
            throws PortletException {
            ...
            }
            @Override
            protected String selectDefaultView(RenderRequest arg0, RenderResponse arg1)
            throws PortletException {
            ...
            }

            }

            may be you can look at the process action method, I have try to get conversationID but it fails, can you help me with this problem....

            • 3. Re: How to get conversation ID in portlet
              Norman Richards Master

              I don't have a portal environment set up, so I've got no idea, but if there is a conversation active you can get the id with:

              Conversation.instance().getId()


              • 4. Re: How to get conversation ID in portlet
                Hari Cahyadi Newbie

                Norman, I have try

                Conversation.instance().getId()
                


                it works, but why the value is diferent from the value displayed in the url?