Friday 10 February 2012

IPC (Inter Portlet Communication) in weblogic portal using WLP-Handled Events

In this post you will be able to understand and implement IPC using WLP-Handled Events. I will be using here 'Custom Event Handler' and backing file for the listener portlet to execute the further logic. In this way events are being handled by Weblogic Portal Framework and so not compatible with other JSR 286 portlet containers. Please refer Oracle Weblogic Documentation for details.

Assumption: Reader is aware of basic Weblogic portal framework

  Below are the steps to configure the IPC with 'Custom Event Handler' :


 1) Open the portlet in Portlet Editor.

 2) Click on 'Event Handlers' and click on tab 'WLP-Handled Events'.

 3) Add Handler as 'Handle Custom Event'

 4) Type 'Event Label' and 'Event Name'

 5) Select 'Listen To (wildcard)' to 'Selected Portlets'

 6) Select the portlet under 'Listen To (portlets)' , from where event need to be triggered

 7)  Now click on 'Add Action' and select 'Invoke BackingFile Method' ( in this particular example I am using backing file to listen the event).

 8) Type the method name ( see below for detail in next point).

 9) Create the method in the portlets backing file with signature HttpServletRequest request, HttpServletResponse response, Event event and do the following to get the data sent through payload from 1st portlet.
   9.1) Get PortletBacking context                                                                                                                                                                                                PortletBackingContext pbc = PortletBackingContext.getPortletBackingContext(request);
 9.2) Get Event String eventQName = event.getQName().toString();
 9.3) Get the payload event.getPayload();

10) Fire custom event from 1st portlet:
    QName qName = new QName("urn:com:oracle:wlp:netuix:event:custom", "<EventName from step 4>");
    PortletBackingContext pbc = PortletBackingContext.getPortletBackingContext(request);
        pbc.fireCustomEvent(qName, <payload>);

Note: Please refer Oracle Weblogic documentation for details.

  

No comments:

Post a Comment