# Creating Portals for Mobile Devices

There are many types of Web-enabled mobile devices that can access your portals. Since these devices have different interfaces and different-sized viewing areas, each has a unique requirement for the type of content they display.

With the multichannel framework provided in WebLogic Workshop Portal Extensions, 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 Web-capable devices seamlessly and simultaneously. You can also serve different content to different browsers, such as Mozilla, Netscape, Opera, and Internet Explorer.

When a device accesses a portal, the portal knows what kind of device it is and automatically serves the device the content you created for it within the look & feel you created for it.

Adding multichannel capability to a portal Web project

You must add the multichannel framework to each portal Web project that will provide multichannel support.

To add multichannel capability to a portal Web project, right-click the portal Web project folder in WebLogic Workshop and choose Install > Default Portal Multichannel Files.

Building multichannel portals

This section describes the multichannel framework and the development tasks necessary for building portals that support multiple devices. Be sure you have completed the previous step of adding multichannel capability to a portal Web project.

When a device (whether it's a PC or a handheld) accesses a portal, it sends information about itself to the portal in the HTTP header—information such as 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. Clients, in turn, can be grouped into "classifications." For example, there are many models of Palm handheld devices, but they all fall under the classification of "Palm." Classifications are the key element in enabling multichannel support in portals.

The following illustration and table describe the multichannel framework and provide instructions for building content and presentation for mobile devices.

1 | When a device accesses a portal-enabled server with a URL, the device sends a user-agent string in the HTTP header that tells what kind of client it is. The server stores this user-agent string in the "User-Agent" request property for the portal application. The "User-Agent" request property is automatically included with any portal application you create in WebLogic Workshop Platform Edition. To view this property, open the following file in WebLogic Workshop: <PORTAL_APP>\data\request\DefaultRequestPropertySet.req. Portal developer tasks: None. This happens automatically.
2 | To enable multichannel support for devices, a portal Web project must be able to map the user-agent string stored in the "User-Agent" property to a classification. This mapping must be created before portals are accessed by mobile devices. Portal developer tasks: You must map clients to classifications in your portal Web project WEB-INF\client-classifications.xml file. The default client-classifications.xml file contains default client mappings. For each client entry that maps to a classification, you can enter either an explicit user-agent string that maps exactly to what a device sends, or you can enter a regular expression that can encompass multiple user-agent strings. The following example of a client classification mapping in client-classifications.xml shows explicit mappings (with the <useragent> tag) and a regular expression mapping (with the <useragent-regex> tag).
    <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>
An explicit <useragent> value can be used 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 above. The value "1" is the highest priority. Enter any whole number for the priority value. Note: For portlets that are assigned client classifications, the classification "description" value is used in the WebLogic Administration Portal to show which classifications the portlet is assigned to. Write descriptions that are easily understood by portal administrators. For information on user-agent strings and values for different devices, perform a Web search for "user-agent."
3 | Because of the client-classification.xml mappings you defined, the user-agent string stored in the "User-Agent" property is mapped to the classification name you provided. In the example mapping above, the name is "pocketpc". Portal developer tasks: None. This happens automatically.
4 | After the client is successfully mapped to a classification, the classification name is stored in the "Client Classification" property in the DefaultRequestPropertySet. Portal developer tasks: None. This happens automatically.
5 | The portal uses that client classification name stored in the DefaultRequestPropertySet throughout the portal framework to identify the content and presentation tailored to the device. Portal developer tasks: The portal is where you develop and enable specific content and presentation to be used for different mobile devices. The portal framework includes the following touch points for creating device-specific content and presentation: Portlet Development - When you create a portlet with the WebLogic Workshop Portal Extensions, you can assign the portlet to be used by different devices (client classifications). With the portlet open in the Portlet Designer, in the Property Editor window, do the following: Click the ellipsis icon [...] in the Client Classifications field to launch the Manage Portlet Classifications dialog box. In the dialog box, select whether you want to enable or disable classifications for the portlet. (If you disable classifications, the portlet is automatically enabled for the classifications you do not select for disabling.) Move the classifications you want to enable/disable from the Available Classifications list to the Selected Classifications list, and click OK. The list of classifications is read from the client-classifications.xml file. JSP Tags - The WebLogic Workshop Portal Extensions include a set of 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 JSP tags have a required "client" attribute for mapping the JSP content to classifications. For that client value in the JSP tag, you must use the exact value used for the name in the client-classification.xml file (the value being stored in the "Client Classification" property in the DefaultRequestPropertySet). See the Mobile Devices JSP Tags for more information. Look & Feel Development - The Look & Feels (skins and skeletons) provided with the WebLogic Workshop Portal Extensions include support for a few mobile devices (nokia, palm, and pocketpc). These skins and skeletons are included as subdirectories of the main skins and skeletons in your portal Web projects. For example, a pocketpc skin is included as part of the "default" skin in <project>\framework\skins\default\pocketpc. You can also develop your own skins and skeletons to support different devices. When a Look & Feel is selected for a desktop, the portal framework reads the "Client Classification" property in the DefaultRequestPropertySet and uses the Look & Feel logic to find skin and skeleton directories matching the name of the client classification. For instructions on creating skins and skeletons for Look & Feels, see Creating Skins and Skin Themes and Creating Skeletons and Skeleton Themes. Interaction Management Development - With the client classification name being stored in the "Client Classification" property of the DefaultRequestPropertySet, you can build and trigger personalization and campaigns for devices based on that property value. For information on developing personalization and campaigns, see Developing Personalized Applications.
6 | Based on the mapping you set up to match user-agent (client) strings in the HTTP request to classification names, the portal sends the device-specific content and presentation you developed to the different devices that access the portal. Portal developer tasks: None. This happens automatically.

## Samples

The Tutorial Portal, one of the Portal Samples provided with the WebLogic Workshop Portal Extensions, includes examples of multichannel functionality. Also, when you create a portal Web project, a WEB-INF\client-classifications.xml file is created automatically with default settings.

Any portal Web project you create also includes a default set of multichannel Look & Feels located in skin and skeleton subdirectories (<project>\framework\skins and <project>\framework\skeletons).

Related Topics

Mobile Devices JSP Tags

Creating Look & Feels

Creating Skins and Skin Themes

Creating Skeletons and Skeleton Themes

Creating Portlets