Announcement Announcement Module
Collapse
No announcement yet.
Interportlet communication using Spring Webflow 2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Interportlet communication using Spring Webflow 2

    Hi All,

    I am working on Interportlet communication using JSR 286 and spring webflow 2.
    I am Implementing the IPC in two ways
    1.Public render parameters 2. Event handling
    1.Using Public render parameters method IPC is working properly
    2. Using Event handling, I am able to set the event in source portlet web flow using FlowHandlerAdapter class and it is setting properly.
    Problem: I am trying to retrive the event in the target portlet webflow, but i am not able to receive the event. I am able to receive the event in the target portlet FlowhandlerAdapter but it is not visible in the target webflow.
    Could you please let me know how to access the portlet events in the Spring webflow 2.

    Source Code in portlet.xml file
    <portlet>
    <description>UJ City Portlet</description>
    <portlet-name>uj-city-portlet</portlet-name>
    <display-name>uj-city-portlet</display-name>

    <portlet-class>
    org.springframework.web.portlet.DispatcherPortlet
    </portlet-class>
    <init-param>
    <name>contextConfigLocation</name>
    <value>/WEB-INF/flows/city/city-config.xml</value>
    </init-param>
    <init-param>
    <name>viewRendererUrl</name>
    <value>/WEB-INF/servlet/view</value>
    </init-param>
    <expiration-cache>0</expiration-cache>
    <supports>
    <mime-type>text/html</mime-type>
    <portlet-mode>view</portlet-mode>
    </supports>
    <portlet-info>
    <title>UJ City Portlet</title>
    </portlet-info>
    <supported-publishing-event>
    <!--<qname xmlns:x="http://westpac.com.au/events">x:cityEvent</qname>
    -->
    <name>cityEvent</name>
    </supported-publishing-event>
    <!-- -->
    <supported-public-render-parameter>cityKey</supported-public-render-parameter>

    </portlet>

    <portlet>
    <description>UJ City Info Portlet</description>
    <portlet-name>uj-cityinfo-portlet</portlet-name>
    <display-name>uj-cityinfo-portlet</display-name>

    <portlet-class>
    org.springframework.web.portlet.DispatcherPortlet
    </portlet-class>
    <init-param>
    <name>contextConfigLocation</name>
    <value>/WEB-INF/flows/cityinfo/cityinfo-config.xml</value>
    </init-param>
    <init-param>
    <name>viewRendererUrl</name>
    <value>/WEB-INF/servlet/view</value>
    </init-param>
    <expiration-cache>0</expiration-cache>
    <supports>
    <mime-type>text/html</mime-type>
    <portlet-mode>view</portlet-mode>
    </supports>
    <portlet-info>
    <title>UJ City Info Portlet</title>
    </portlet-info>
    <supported-processing-event>
    <name>cityEvent</name>
    <!--<qname xmlns:x="http://westpac.com.au/">x:cityEvent</qname> -->
    </supported-processing-event>
    <!-- -->
    <supported-public-render-parameter>cityKey</supported-public-render-parameter>

    </portlet>

    <default-namespace>http://westpac/</default-namespace>
    <event-definition>
    <name>cityEvent</name>
    <!--<qname xmlns:x="http://westpac.com.au/events">x:cityEvent</qname>-->
    <value-type>java.lang.String</value-type>
    </event-definition>
    <!-- -->
    <public-render-parameter>
    <identifier>cityKey</identifier>
    <qname xmlns:x="http://westpac/">x:cityKey</qname>
    </public-render-parameter>

    ===================
    Source portlet webflow action class
    public class EventPOCAction extends FormAction {


    public Event callEvent(RequestContext reqContext)throws Exception
    {
    //final CityInfoBean cityInfoBean = (CityInfoBean) getFormObject(reqContext);
    final CityInfoBean cityInfoBean = (CityInfoBean)reqContext.getFlowScope().get("cityI nfoBean");
    System.out.println("EventPOCAction--Class----cityInfoBean*****===:"+cityInfoBean);
    if(cityInfoBean!=null)
    System.out.println("EventPOCAction--Class----cityInfoBean*****:"+cityInfoBean.getCityId());

    System.out.println("Inside Call Event method:"+reqContext.getExternalContext().getNative Request());

    if(reqContext.getExternalContext().getNativeRespon se() instanceof ActionResponse)
    {
    System.out.println("Action Response Object is received");
    System.out.println("Action Response Object is received and setting event in source flow");
    ActionResponse actionResponse=(ActionResponse)reqContext.getExter nalContext().getNativeResponse();
    actionResponse.setEvent("cityEvent", cityInfoBean.getCityId());
    actionResponse.setRenderParameter("cityKey", cityInfoBean.getCityId());
    }

    return success();
    }
    }

    ====================================
    Target Portlet Webflow Action class
    public org.springframework.webflow.execution.Event callTargetEventRender(RequestContext reqContext)throws Exception
    {

    String cityId=null;


    if(reqContext.getExternalContext().getNativeReques t() instanceof RenderRequest)
    {

    RenderRequest renderRequest =(RenderRequest)reqContext.getExternalContext().ge tNativeRequest();
    Map map=renderRequest.getParameterMap();
    if(map!=null)
    {
    System.out.println("Map size is:"+map.size());
    Set set=map.keySet();
    System.out.println("Set Values:"+set);
    }

    Enumeration enumerator=renderRequest.getParameterNames();

    while(enumerator.hasMoreElements())
    {
    System.out.println("Parameters in Render Request:"+enumerator.nextElement());
    }


    cityId=renderRequest.getParameter("cityKey");

    }

    if(cityId!=null&& cityId.length()!=0)
    {
    System.out.println("City Id is Not Null:"+cityId);
    CityInfoBean cityInfoBean=cityDB.getCityInfo(cityId);

    reqContext.getFlowScope().put("cityInfoBean", cityInfoBean);
    System.out.println("TargetEventPOCAction--class--cityInfoBean*****===:"+cityInfoBean);
    if(cityInfoBean!=null)
    System.out.println("TargetEventPOCAction--class--cityInfoBean*****:"+cityInfoBean.getCityId());
    }
    //System.out.println("TargetEventPOCAction--class--Object:"+obj);
    //final CityInfoBean cityInfoBean = (CityInfoBean) getFormObject(reqContext);

    return success();
    }

  • #2
    I want the same.
    Do you have a solution?

    Comment


    • #3
      http://forum.springsource.org/showthread.php?t=106099

      Comment

      Working...
      X