March 2, 2021
Hot Topics:

Portal Federation with WebLogic Portal WRSP: Advanced IPC Techniques

  • By Scott Nelson
  • Send Email »
  • More Articles »

Abstracting WSRP IPC Session Management

For a small project, having the listener manage the session object directly is both an adequate and acceptable solution. In the case of larger projects (where there will be more developers and/or more IPC over WSRP), it is probably going to be advantageous to have a more generic approach. You may have noticed that your backing file is abstract enough where it can be attached to any portlet listening for any event. You can have this same level of abstraction in the way you retrieve the value. To that end, you will build a light-weight handler to get the value from the on request from the listening portlet, and then remove the value from the session. Such a helper class would look like this:

package article.examples.portal.util.wsrp;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.beehive.netui.pageflow.scoping.
import com.bea.netuix.servlets.controls.portlet.backing.

public class IpcDataHandler
   public static final String IPC_DATA = ".data";
   public static Object getIpcData(HttpServletRequest request)
      HttpServletRequest        outerRequest     = null;
      HttpSession               outerSession     = null;
      Object                    ipcDataObj       = null;
      PortletBackingContext     pbc              = null;
      outerRequest     = ScopedServletUtils.
      outerSession     = outerRequest.getSession();
      pbc              = PortletBackingContext.
      ipcDataObj       = outerSession.getAttribute


      return ipcDataObj;

You then can use this helper in portlet B as follows:

Forward              forward      = null;
IpcDemo1FormBean     ipcValue     = null;

ipcValue = (IpcDemo1FormBean)IpcDataHandler.

   forward = new Forward("success", ipcValue);
   forward = new Forward("success");
return forward;

By using the above approach, the portlet can continue to work on a request level rather than having to access the session directly.

Look, Ma, No Forms!

There are times when a form submission is not the desired UI design, such as tables of data in portlet A where your listening portlet is only interested in one line or a single value (one example of this would be Yahoo! Or Google Finance in a portfolio view). In this case, the Netui tags provide a convenient way to pass these values without a form:

<netui:anchor action="ipcDemoCall2">
   <netui:parameter name="ipcValue" value="Example 1"/>
      IPC Link Example 1

The ipcDemoCall2 action in portlet A then puts the value into an event as follows:

import com.bea.netuix.servlets.controls.portlet.backing.
   private static final String IPC_VALUE = "ipcValue";

   @Jpf.Action(forwards = { @Jpf.Forward(name = "success",
      path = "index.jsp") })
   public Forward ipcDemoCall2()
      Forward forward = new Forward("success");
      PortletBackingContext     context          = null;
      HttpServletRequest        outerRequest     = null;
      outerRequest = ScopedServletUtils.
      context      = PortletBackingContext.
      return forward;

In this case, the value is simply a String rather than an object. Fortunately, you have created your generic helper to not care what kind of object is packed into the payload, so you can continue to pick up the value in the same way you handled it earlier.

Page Switching with WSRP

Earlier, you set up your event listening so that it would not matter whether the listening portlet was displayed or not:

<netuix:handleEvent event=
   "loadIpcPortletB" eventLabel="handleEvent1"

fromSelfInstanceOnly="false" onlyIfDisplayed="false"

Page 2 of 3

This article was originally published on May 28, 2008

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date