Arch2Arch Tab BEA.com
Syndicate this blog (XML)

How to access the IDK in a jsp screenflow in ALIP

Bookmark Blog Post

del.icio.us del.icio.us
Digg Digg
DZone DZone
Furl Furl
Reddit Reddit

Clinton Davidson's Blog | June 23, 2006  10:51 AM | Comments (0)


Accessing the IDK in a jsp screenflow is simple; from the point of view of the portal it is just another jsp page. The page is already gatewayed as it lives in the gateway space of both the worklist portlet and the details portlet.

To get portlet properties, for example portlet preferences, add the Plumtree imports and then retrieve the IPortletRequest:

<%@ page
    session="true"
    import="java.util.*,
    java.text.*,
    fuego.portal.*,
    fuego.xobject.util.XOContext,
    com.plumtree.remote.portlet.*%>

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://fuego.com/jsp/ftl" prefix="f" %>

<%
    // Setting Fuego Object Execution Context.
    XOContext.setJSPContext(request.getParameter("xoContextKey"));
%>

<%
  IPortletContext portletContext = PortletContextFactory.createPortletContext(request, response);
  IPortletRequest portletRequest = portletContext.getRequest();
  //get portlet settings values
  Map portletSettings = portletRequest.getSettingCollection(SettingType.Portlet);
%>

This approach can also be used to get the image server URI, stylesheet URI, other settings collections, and user information.

A more useful case is to capture the login token and soap endpoint, so the subsequent automatic activity can connect to the IDK. For example, this code was taken from a project to create a Collab discussion. The steps to do capture the login token and soap endpoint are to (1) create a Fuego object that can store the attributes for login token and soap endpoint, (2) set these attributes in the jsp page, and then (3) use these attributes in the automatic activity. Keep in mind that the login token is only good for a few minutes; the default is five minutes, but check the setting in the worklist and details portlet for the exact time. This means that the login token can be used for the next automatic activity, but not others.

Here’s an example of a jsp page that collects the login token and soap endpoint, and sets them in attributes for a Fuego object. The referenced fuego object in the jsp page is called discussion. It starts after getting the IPortletRequest above:

<%
  String loginToken = portletRequest.getLoginToken();
  //need to turn url into a string to put into hidden field
  String soapAPIEndpoint = portletRequest.getRemoteAPIEndpoint().toExternalForm();
%>

Then in the html, add two hidden fields to set the attributes. Note the use of f:fieldName with att and value to set the value of a field:

<!--login token-->
<input type="hidden"  <f:fieldName att="discussion.loginToken"/> value="<%=loginToken%>"/>
<!--soap api endpoint-->
<input type="hidden"  <f:fieldName att="discussion.soapAPIEndpoint"/> value="<%=soapAPIEndpoint%>"/>

Comments

Comments are listed in date ascending order (oldest first) | Post Comment



Only logged in users may post comments. Login Here.

Powered by
Movable Type 3.31