2 Replies Latest reply on Apr 24, 2012 7:31 PM by infoni

    Inter-portlet communication - ajax call scope

    infoni

      Hi,

       

      I created some portlets wich use the 286 inter-portlet communication: a portlet sends an event in the processAction method, it triggers a full page render and the consumers portlet process this event. It works as expected but i'm very curious about this message i can see in the logs, each time an event is sent:

       

      Apr 23, 2012 11:27:41 PM org.exoplatform.portal.webui.application.UIPortletActionListener$ProcessEventsActionListener execute

      INFO: Events were generated outside the scope of an AJAX call, hence will make a full render of the page

       

      Does it mean Gatein allows to send portlet events without a full page refresh, through ajax calls? I already tried to send an event with ajax (in the serveResource method), but the resourceResponse does not support the setEvent method. So, could someone explain what this log message exactly means? Is there somewhere a resource/wiki wich explains how to use in gatein the portlet events inside the scope of an ajax call?

       

      Thanks!

        • 1. Re: Inter-portlet communication - ajax call scope
          vstorm83

          Actually, GateIn currently doesn't use serveResource to process AJAX actions of portlets. To make an actions with ajax call, add "ajaxRequest=true" query parameter to your action url --> only the portlets that is triggered processAction or processEvent will be rerendered. Your portlet response will be wrapped in a predefined structured xml document, and then portal JS (PortalHttpRequest.js in eXoResources.war) will find and update your portlet html on the page

           

          I think the easiest way is to use WebUI framework that come with GateIn (you should reference an example portlet : GateIn/testsuite/webuibasedsamples)

          • 2. Re: Inter-portlet communication - ajax call scope
            infoni

            Thanks for your quick response Vu, i would love make this ajax feature work.

             

            I created in a simple jsp this action URL, with the  ajaxRequest=true parameter

             

              <portlet:actionURL var="actionURL">

                <portlet:param name="action" value="event"/>

                <portlet:param name="ajaxRequest" value="true"/>

              </portlet:actionURL>

             

            When this actionURL is triggered, in the processAction method i log the request parameter map and i can confirm  that it contains the ajaxRequest=true parameter. However even with this parameter, there is a full page render and i still read in the catalina log:

             

            Apr 25, 2012 12:43:53 AM org.exoplatform.portal.webui.application.UIPortletActionListener$ProcessEventsActionListener execute

            INFO: Events were generated outside the scope of an AJAX call, hence will make a full render of the page

             

            I may have something more to setup to make it work?

             

            My portlet must run on several portals, so i should not be able to use the gatein WebUI framework: i try to make it work only with the JSR 286 api and jQuery.

             

            thanks