Portal Development Guide

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Creating Portals for Multiple Device Types

Many types of web-enabled mobile devices can access your portals. Each type has unique requirements for the content that it can display.

With the multichannel framework provided in WebLogic Portal, you can extend your portals to include support for different mobile devices. This flexible framework lets you create a single portal that serves content to multiple web-capable devices seamlessly and simultaneously. You can also serve different content to different browsers, such as Mozilla Firefox, Netscape, and Internet Explorer.

When a device accesses a portal, the portal detects the device type and automatically serves the content you created for it within the assigned Look And Feel.

This chapter contains the following sections:


Enabling Multichannel Features in a Portal Web Application

When a device (whether a PC or a handheld) accesses a portal, it sends information about itself to the portal in the HTTP header, including the type of browser being used and the type of device. This combination of information defines a client, which is equivalent to the model of a device.

You define a client in the WebLogic Portal classifications configuration file using a user agent element. You can group several clients into a classification. For example, there are many models (client types) of Palm handheld devices, but they all fall under the classification of “Palm.”

To enable the multichannel framework in your portal web project, you create an XML configuration file that maps clients to classifications. You must name the file client-classifications.xml and place it in the WEB-INF directory. You can create the XML file from within Workshop for WebLogic by selecting File > New > Other > XML and following the steps in the wizard.

For each client entry that maps to a classification, you can include either an explicit user agent string that maps exactly to what a device sends, or you can enter a regular expression that encompasses multiple user agent strings.

Listing 9-1 shows an example of a client classification mapping in client-classifications.xml using explicit mappings (with the <useragent> tag) and a regular expression mapping (with the <useragent-regex> tag).

Listing 9-1 Example of a Client Classification Mapping in the client-classifications.xml File
<classification name="pocketpc" description="For the PocketPC">
   <useragent value="Mozilla/2.0 (compatible; MSIE 3.02; Windows CE; 240x320)"/>
   <useragent value="Mozilla/2.0 (compatible; MSIE 3.02; Windows CE; PPC;
   <useragent-regex value=".*PDA; Windows CE.*NetFront/3.*" priority="1"/>

You can use an explicit <useragent> value for only one classification. If you use more than one <useragent-regex> tag to map with regular expressions, it is possible that a device accessing a portal could map to more than one classification. To determine which classification the device is mapped to, use the priority attribute, as shown in Listing 9-1. The value 1 is the highest priority. Enter any whole number for the priority value.

Note: For portlets that are assigned client classifications, the value you enter for the description element is displayed in the WebLogic Portal Administration Console to show the classifications to which the portlet is assigned. Make sure you create descriptions that are easily understood by portal administrators.

Based on the mappings you define in the client-classifications.xml file, the user agent value in the <useragent> property is mapped to the classification name you provide. The classification name in Listing 9-1 is pocketpc.


Roadmap for Multichannel Processing

Figure 9-1 shows the sequence of multichannel framework processing that occurs when a device accesses a portal.

Figure 9-1 Multichannel Framework Processing Sequence

Multichannel Framework Processing Sequence

When a device accesses a portal-enabled server with a URL, the device sends a user agent string in the HTTP header to identify the client type. Because of the mappings you defined in the client-classification.xml file, the user agent string stored in the <useragent> property is mapped to the classification name you provided. As shown in Figure 9-1, the name is pocketpc.

The user agent request property is automatically included with any portal application that you create in Workshop for WebLogic. You can view this property by opening the following file in your Workshop for WebLogic workspace:


The portal uses that client classification name stored in the DefaultRequestPropertySet.req file throughout the portal framework to identify the content and presentation tailored to the device.

Based on the mapping you set up to match user agent strings in the HTTP request to classification names, the portal sends device-specific content and presentation to the different devices that access the portal.


Developing Portals for Use in a Multichannel Environment

The following sections describe how to use the portal framework to create device-specific content and presentation.

Manage Portlet Client Classifications

When you create a portlet, you can assign the portlet to be used by different devices (client classifications). With the portlet open in the editor, go to the Properties view and perform the following steps:

  1. Click the ellipsis button in the Client Classifications field, as shown in Figure 9-2.
  2. Figure 9-2 Portlet Properties View Showing the Client Classifications Property

    Portlet Properties View Showing the Client Classifications Property

    The Manage Portlet Classifications dialog displays. Figure 9-3 shows an example:

    Figure 9-3 Example of the Manage Portlet Classifications Dialog

    Example of the Manage Portlet Classifications Dialog

    Note: The client-classifications.xml file must already exist in the project’s WEB-INF directory in order for this dialog to display.
  3. In the Manage Portlet Classifications dialog, you select either to enable or to disable a subset of your client classifications; any classifications that you do not identify will automatically fall into the opposite category. Decide whether you want to enable a subset of your classifications and leave the remainder disabled, or disable a subset of classifications and leave the rest enabled.
  4. The instructions for this step assume that you want to disable a subset of classifications and leave the rest enabled.

    1. Select the Disabled Classifications radio button to disable the portlet for any classifications.
    2. Use the Add button to move desired classifications into the Selected Classifications column.
    3. By default, a classification is enabled unless you disable it.

  5. When you are finished, click OK to save your settings.

Use the Client Attribute in JSP Tags

WebLogic Portal includes JSP tags for creating device-specific inline content in JSPs. Only the content that meets the device criteria defined by the JSP tag is delivered to the device.

The relevant JSP tags have a required client attribute for mapping the JSP content to classifications. For the client value in the JSP tag, you must use the exact value that you used for the name in the client-classifications.xml file.

Listing 9-2 shows some possible uses of the client tag.

Listing 9-2 Example JSP File Showing Possible Uses of the Client Tag
<%@ taglib uri="http://www.bea.com/servers/portal/tags/client/cscm" prefix="client" %>
<%@ taglib uri="http://www.bea.com/servers/portal/tags/netuix/render" prefix="render" %>
This is a sample of manipulating content using the client-classification tag library.
   <img style="padding: 10;" align="Bottom" src="<render:jspUri/>images    /sunset-big.gif"/>
Different versions of the same image will be selected based on the client classification.  For the &quot;default&quot; client, a large image will appear.  For the &quot;palm&quot; and &quot;pocketpc&quot;, a smaller version of the image will be used.  For the &quot;nokia&quot; classification, a greyscale image will be used (purely as an example). 
<client:when client="palm,pocketpc"><img src="<render:jspUri/>images /sunset-small.gif"/><p/></client:when>
<client:when client="nokia"><img src="<render:jspUri/>images /sunset-small-greyscale.gif"/><p/></client:when>
Image placement is also altered slightly for the different classifications.
<client:when-not client="palm,nokia">
This additional content is also included if the client is not a &quot;nokia&quot; or &quot;palm&quot; classification.

Develop Appropriate Look And Feels

The Look And Feels (skins and skeletons) provided with WebLogic Portal include support for a few mobile devices (Nokia, Palm, and Pocket PC).

You can develop your own skins and skeletons to support different devices. When a Look And Feel is selected for a desktop, the portal framework reads the client classification property in the DefaultRequestPropertySet.req file and uses the Look And Feel logic to find skin and skeleton directories matching the name of the client classification.

Any portal web project that you create includes a default set of multichannel Look And Feels located in skin and skeleton subdirectories (\framework\skins\default and \framework\skeletons\default).

For instructions on creating skins and skeletons for Look And Feels, refer to User Interface Development with Look And Feel Features.

Interaction Management Development

Using the client classification name stored in the DefaultRequestPropertySet.req file, you can build and trigger personalization and campaigns for devices based on that property value.

For information on developing personalization and campaigns, refer to the Interaction Management Guide.

  Back to Top       Previous  Next