|Oracle® Fusion Middleware Portal Development Guide for Oracle WebLogic Portal
10g Release 3 (10.3.4)
Part Number E14243-06
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:
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 Oracle Enterprise Pack for Eclipse 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.
Example 12-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
<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; 240x320)"/> <useragent-regex value=".*PDA; Windows CE.*NetFront/3.*" priority="1"/> </classification>
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 Example 12-1. The value
1 is the highest priority. Enter any whole number for the priority value.
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 Example 12-1 is
Figure 12-1 shows the sequence of multichannel framework processing that occurs when a device accesses a portal.
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 12-1, the name is
The user agent request property is automatically included with any portal application that you create in Oracle Enterprise Pack for Eclipse. You can view this property by opening the following file in your Oracle Enterprise Pack for Eclipse 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.
The following sections describe how to use the portal framework to create device-specific content and presentation.
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:
Click the ellipsis button in the Client Classifications field, as shown in Figure 12-2.
The Manage Portlet Classifications dialog displays. Figure 12-3 shows an example:
The client-classifications.xml file must already exist in the project's WEB-INF directory in order for this dialog to display.
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.
The instructions for this step assume that you want to disable a subset of classifications and leave the rest enabled.
Select the Disabled Classifications radio button to disable the portlet for any classifications.
Use the Add button to move desired classifications into the Selected Classifications column.
By default, a classification is enabled unless you disable it.
When you are finished, click OK to save your settings.
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
Example 12-2 shows some 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. <p/> <client:default> <img style="padding: 10;" align="Bottom" src="<render:jspUri/>images /sunset-big.gif"/> </client:default> Different versions of the same image will be selected based on the client classification. For the "default" client, a large image will appear. For the "palm" and "pocketpc", a smaller version of the image will be used. For the "nokia" classification, a greyscale image will be used (purely as an example). <p/> <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"> <p/> This additional content is also included if the client is not a "nokia" or "palm" classification. <p/></client:when-not>
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 (
For instructions on creating skins and skeletons for Look And Feels, refer to Chapter 7, "User Interface Development with Look And Feel Features."
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 Oracle Fusion Middleware Interaction Management Guide for Oracle WebLogic Portal.