Pagelet and Portlet Development

Pagelet vs. Portlet

A portlet is a reusable user interface widget displayed in the context of an enterprise portal environment. Modeled after the “window” metaphor from desktop user interfaces, portals typically display portlets as a series of windows or boxes arranged in columns on a page with borders, title bars, buttons, headers and footers rendered by the portal framework.

A pagelet is also a reusable user interface widget, but while portlets are intended for display only in portals, pagelets are designed to run on any web page. Any HTML fragment can be a pagelet, but pagelet developers can also take advantage of many of the APIs available to portlet developers to write pagelets that are parameterized and configurable, to dynamically interact with other pagelets, and respond to user input using Ajax patterns.

Pagelets can be consumed by both Ensemble and ALI portal. Portlets may have functionality that is tightly integrated with the portal, including a range of settings stored in the portal database, but most portlets can be modified or configured to work with Ensemble.

This page provides an introduction to cross-product development and an explanation of the differences between pagelets and portlets.

Cross-Product Pagelet Development

ALI portal and Ensemble both support AquaLogic development tools, including the AquaLogic Development Kit (IDK), Adaptive Tags, and the ALI Scripting Framework. These tools provide cross-product APIs that allow you to write a single pagelet for both ALI portal and Ensemble, as well as product-specific APIs to implement advanced functionality.

AquaLogic Development Kit (IDK)  

The AquaLogic Development Kit (IDK) includes APIs to support pagelets and portlets in Ensemble and ALI portal.

For a comparison of the methods in the bea.alui.proxy plumtree.remote.portlet packages, see IDK Proxy and Portlet APIs.

As noted above, the methods in the bea.alui.proxy package can be used in pagelets for both Ensemble and ALI portal. This package includes the IProxyRequest.getEnvironment method to support product-specific functionality within a cross-product pagelet. This method returns NONE if the page is executed outside a proxy/gateway, PLUMTREE or PORTLET if the page is gatewayed by the portal, and PROXY if the page is gatewayed (proxied) by Ensemble. To implement product-specific functionality, simply wrap the code in an if-then statement based on the environment, as shown in the code snippet below.
 

_proxyContext = ProxyContextFactory.getInstance().CreateProxyContext(request, response);
 

_proxyRequest = _proxyContext.GetProxyRequest();
if (_proxyRequest.GetEnvironment().GetType() == EnvironmentType.PORTLET)

{
// This pagelet is being run behind the ALI portal
// Do something product-specific
}

For a list of product-specific functionality, see the next section, Product-Specific Functionality and Configuration.

Adaptive Tags

Adaptive Tags are used to display contextual data and control Ensemble and ALI portal functionality from remote pagelets.

Unlike the IDK, Adaptive Tags use XML in pagelet content instead of code, which avoids a network round trip. Tags can be included in the markup returned by any proxied page (HTML, JSP or ASP.Net). Using the attributes defined in the tag, the Ensemble or ALI portal gateway transforms the XML and replaces it with standard HTML and/or executes the relevant operations.

The Adaptive Tag collection currently includes libraries for use in both ALI portal and Ensemble, as well as libraries that are specific to each environment.

For detailed information on Adaptive Tags, including sample code and instructions on creating custom tags, see Adaptive Tags.

ALI Scripting Framework

The ALI Scripting Framework is a set of client-side JavaScript libraries that provide services to pagelets and proxied/gatewayed pages. The ALI Scripting Framework allows portlets to:

For details on using the ALI Scripting Framework in your pagelets, see ALI Scripting Framework.

Product-Specific Functionality and Configuration

There are some key differences between Ensemble and ALI portal that affect pagelet development.

Security

Pagelet security is implemented differently in Ensemble and ALI portal. In both cases, there are two steps to securing pagelet content: authentication and access control.

Authentication

In Ensemble, each pagelet is associated with a resource that represents a web application. Authentication information for the web application is configured through the resource. Ensemble supports SSO and credential mapping. For details, see AquaLogic Ensemble Administrator Guide Chapter 5, "Proxy Authentication" and Chapter 6, "Credential Mapping." When a pagelet requires authentication with a back-end application, Ensemble uses the settings for the associated resource.

In ALI portal, each pagelet (portlet) is associated with a set of portal objects that represent the host server, web application, and pagelet file. Authentication information is configured through these objects. ALI portal also supports SSO and credential mapping. For details, see Portlet Security: Using the Credential Vault.   

Access Control

To control access to specific content or functionality, Ensemble uses roles. Pagelets and resources can access a user's role(s) in the current context through Adaptive Tags or IDK methods. For details, see Securing Pagelets and Proxied Applications.

In the ALI portal, access is controlled through a combination of roles (also known as settings rights), activity rights, and Access Control Lists (ACLs). For details, see Portlet Security.

Settings

Ensemble supports a subset of the setting types available to portlets through the ALI portal. The following settings are available in both Ensemble and ALI portal:

The ALI portal also stores five types of settings in the portal database (Portlet, User, Community, CommunityPortlet and Administrative). For details on using these settings, see Portlet Settings and Preferences.

In Ensemble, data can also be passed to a pagelet through a payload, covered next.

Pagelet Payload

In Ensemble, data can be passed to a pagelet through a payload. In addition to extracting the payload as raw text, the IDK Proxy API provides methods to extract an XML payload as an XML document.

You can configure a payload schema URL to point to an XML schema that can be used to validate an XML payload. Ensemble only supplies the URL to the pagelet; it is up to the pagelet to use the schema to validate the XML payload. For information on using payloads, see the AquaLogic Ensemble Administrator Guide "Chapter 9, "Pagelets" and IDK Quickstart: Hello World Pagelet (Java | .NET).

Deployment

The deployment steps for pagelets are different in Ensemble and the ALI portal.  

The options available for these objects are summarized in the next section, Configuration.

Configuration

The configuration options for pagelets are different in Ensemble and the ALI portal. The table below lists the locations of specific configuration components and summarizes the differences.

For details on pagelet configuration in Ensemble, see Ensemble Pagelet Configuration. For details on portlet configuration in the ALI portal, see ALI Portlet Configuration. For summarized instructions on deploying ALI portlets in Ensemble or Ensemble pagelets in ALI portal, see the bottom of this page.
 

Component

Ensemble Configuration Page: Tab

ALI Portal
Editor: Page

Notes

Server name and URL

Resource: General, Connections

Remote Server: Main Settings

In Ensemble, the server that hosts the pagelet is defined using a resource. The server name is entered on the General tab, and the URL is entered on the Connections tab. Ensemble allows you to define an External URL for the server to be displayed to users.  

In ALI portal, the server that hosts the pagelet/portlet is defined using a remote server (optional). If a remote server object is used, the base URL for the server is entered in the remote server editor. If a remote server object is not used, the complete pagelet/portlet URL is entered in the web service editor on the Main Settings page.

Timeout

Resource: General

Web Service: Main Settings

In Ensemble, the timeout is set for a resource, which includes all pagelets using that resource.

In ALI portal, the timeout is set for the specific pagelet/portlet. You can set a different timeout for gatewayed and non-gatewayed content.

Caching

n/a

Web Service: HTTP Configuration

In ALI portal, you can define a minimum and maximum cache time for pagelet/portlet content. (Caching is not configurable in Ensemble.)

Security

Resource: General,
Credential Mapping, Roles, SSO Logout Settings

Remote Server: Main Settings
Web Service: Advanced Settings, Authentication Settings

Security is implemented differently in Ensemble and ALI portal. For a summary, see the Security section above.

In both Ensemble and ALI portal, security settings are defined on a collection of pages. For details on configuring security, see Securing Pagelets and Proxied Applications (Ensemble) and Portlet Security (ALI portal).

Header forwarding

Resource: Headers

n/a

In Ensemble, this page allows you to define which headers are forwarded to a pagelet. (In ALI, all headers are forwarded to portlets and gatewayed pages.)

Gateway/proxy transformation

Resource: Connections

Web Service: HTTP Configuration

In Ensemble, you can choose whether or not to enable URL rewriting for URLs in the same directory as the resource. (URLs are transformed to use the External URL defined on the Connections tab.)

In ALI portal, you can define which pages are gatewayed and transformed by listing them on the HTTP Configuration page. You can also choose whether or not to transform JavaScript and CSS, and whether to display gatewayed pages with a portal header (hosted display mode).
 

Preferences

Resource: CSP
Pagelet: Parameters

Web Service: Preferences, User Information

Settings are implemented differently in Ensemble and ALI portal. For a summary, see the Settings section above.

In Ensemble, you must enter the session preferences and user information used by a pagelet on the CSP tab of resource configuration. Any attributes used by the pagelet must be configured on the Parameters tab of pagelet configuration.

In ALI portal, you must enter configure preferences used by a pagelet/portlet on the Preferences page of the web service editor, and any user information on the User Information page.

Pagelet name and description

Pagelet: General

Portlet: Main Settings

In Ensemble, the General tab of pagelet configuration also provides pagelet sample code for use in a consumer page.

Pagelet host server

Pagelet: General

Web Service: Main Settings
Portlet: Main Settings

In Ensemble, each pagelet has an associated resource, entered on the General tab of pagelet configuration.

In ALI portal, each pagelet/portlet has an associated web service, entered on the Main Settings page of the portlet editor. (Web services may have an associated remote server, entered on the Main Settings page of the web service editor.)

In-place refresh

Pagelet: General

Web Service: Advanced Settings

In Ensemble, you can define the refresh interval for the pagelet on the General tab of pagelet configuration.

In ALI portal, you can add refresh button to a pagelet/portlet by selecting the option on the Advanced Settings page of the web service editor.

In both Ensemble and ALI portal, you can use the ALI Scripting Framework to refresh pagelet content.

Pagelet URL

Pagelet: Location

Web Service: Main Settings

In Ensemble, the pagelet path is entered on the Location tab of pagelet configuration. This path is relative to the URL of the associated resource.

In ALI portal, the pagelet/portlet path is entered on the Main Settings page of the web service editor. If a remote server is used, the path is relative to the remote server URL; if not, the path must be an absolute URL.

Login token forwarding

Resource: CSP

Web Service: Advanced Settings

In both Ensemble and ALI portal, you must select the option to send the login token to access IDK Remote APIs.  

Allowed consumers

Pagelet: Consumers

Web Service: Alternative Browsing Devices

In Ensemble, you can limit the resources that can consume a pagelet.  

In ALI portal, there is no way to limit the pages that can use a pagelet/portlet. This page allows you to configure which devices are supported by a pagelet/portlet.

Associated pages

Pagelet: General

Web Service: Advanced URL Settings

In Ensemble, you can choose whether or not to include a pagelet in the Developer Pagelet Catalog.

In ALI portal, pagelets/portlets do not have documentation that can be surfaced through the portal. This page allows you to define associated pages for a pagelet/portlet, including help and configuration pages.

Debugging

n/a

Web Service: Debug Settings

In ALI portal, you can configure HTTP tracing to filter user or portlet debugging information.

Deploying ALI Portlets in Ensemble

Portlets designed for use in ALI portal can be used in Ensemble with some limitations, described above. Follow the steps below to register a portlet in Ensemble.

For a comparison of configuration settings, see Configuration above. For details on specific configuration settings, see Ensemble Pagelet Configuration.

  1. Create a Resource that points to the remote server that hosts the portlet application (the same URL used to configure the Remote Server for the portlet in the portal).

  2. Create a Pagelet that points to the portlet file on the remote server (enter the name of the portlet file as the URL suffix on the Location tab).

  3. Save the pagelet. Copy the Sample code XML declaration displayed on the General tab.

  4. Create an HTML page and paste in the XML declaration for the pagelet. If the pagelet uses preferences, they must be defined in the pt:ensemble.inject tag. Deploy the HTML page on a web server.

  5. Create a Resource that points to the web server that hosts the HTML page created in step 4.

  6. To view the pagelet in Ensemble, hit the HTML page on the resource created in step 5: http://<Ensemble_proxy_host>:<Ensemble_proxy_port>/HTMLserver/pagelet.html

Note: By default, new pagelets and resources are only accessible by the "administrator" user. For additional information on configuration, see the Ensemble documentation.

Deploying Ensemble Pagelets in ALI Portal

Ensemble pagelets are designed to support cross-platform implementations. The only Ensemble functionality that is not available in the ALI portal is pagelet payloads. Follow the steps below to register a pagelet in the ALI portal.

For a comparison of configuration settings, see Configuration above. For details on specific configuration settings, see ALI Portlet Configuration.

  1. Create a Remote Server that points to the pagelet server.

  2. Create a Web Service - Remote Portlet that points to the pagelet application file.

  3. Create a Portlet that uses the Web Service created in step 2.

  4. To view the portlet in ALI portal, add it to a portal page.