Welcome to Developer's Home Sunday, April 20, 2014
Home - DevelopersHome.com

UAProf Profile Resolution


Preferences - Do not show ads

Now you know how to find the URL of a UAProf profile, the next step is to download it and retrieve some attribute values from it. Retrieving a UAProf attribute value is not as simple as retrieving the value of an HTTP header like Accept or User-Agent. The reason is that UAProf is a complex specification that has taken many things into consideration. This makes UAProf powerful but also makes it contains a lot of rules. For example:

  • The UAProf specification allows more than one UAProf profile for a mobile device, which means you may find more than one URL in the x-wap-profile header.

  • The UAProf profiles may contain a default description block, which is used to specify default values to attributes. The default values may be specified in the document locally or in an external profile.

  • Two headers, x-wap-profile-diff and Profile-diff, can be used to specify changes to the original user agent profiles.

To find the final value of an attribute, we have to perform a process called profile resolution:

  • Read the default attribute values.

  • Read the attribute values specified in the UAProf profiles.

  • Read the changes specified in the x-wap-profile-diff headers or the Profile-diff headers.

  • Merge all these values by following a certain order and a set of rules.

When a default value merges a non-default value, the default value is always overriden by the non-default value. When a non-default value merges another non-default value, the UAProf parser follows the resolution rule of the attribute. The UAProf specification has defined three resolution rules (Locked, Override and Append) that are used to tell the UAProf parser how to merge non-default values. Every attribute are associated with one of the resolution rules. The meanings of the three resolution rules are provided in the table below:


Resolution rule

Meaning

Locked

The attribute's final value is the first non-default value.

For example, the resolution rule of the ScreenSize attribute is Locked.

Override

The attribute's final value is the last non-default value.

For example, the resolution rule of the ColorCapable attribute is Override.

Append

The attribute's final value is the list of all non-default values.

For example, the resolution rule of the CcppAccept attribute is Append. (The CcppAccept attribute tells us the MIME media types acceptable by a mobile device.)

Let's say the first non-default occurrence of the CcppAccept attribute contains the items:

image/bmp
image/gif

The second non-default occurrence contains the items:

image/jpeg
image/png

After profile resolution, the CcppAccept attribute contains the items:

image/bmp
image/gif
image/jpeg
image/png


For more details about profile resolution, please refer to the UAProf specification.


Free Library / Tool for Retrieving UAProf Attribute Values

As you can see above, writing a UAProf parser to retrieve the values of attributes according to the UAProf specification requires a lot of work. Fortunately there is an open source library called DELI that can be used to query UAProf or CC/PP profiles in Java Servlets. It can be downloaded free of charge from the website http://delicon.sourceforge.net/.


A Simple Way for Retrieving UAProf Attribute Values

As mentioned earlier, determining the final value of an attribute involves a lot of steps according to the UAProf specification. However, in real life, mobile device manufacturers and mobile operators keep things simple. In most situations:

  • There is only one UAProf profile for a mobile device. So, you will not find more than one URL in HTTP headers such as x-wap-profile, Profile, etc.

  • The UAProf profile of a mobile device does not specify any default description blocks.

  • No x-wap-profile-diff or Profile-diff headers are used to specify additional changes to the UAProf profile.

Hence, to get the final value of an attribute, no more profile merging is necessary. All you need to do is to obtain the URL of the user agent profile, download the user agent profile and then retrieve the attribute values you needed from the document using any method you like, such as simple text matching and XML parsing.

The advantage of using this way is that it is very simple and straightforward and it works most of the time. The disadvantage is that the attribute values retrieved may be incorrect if the above three points are not true.

Preferences - Do not show ads


Page 9 of 10 Previous Page | Next Page
Contents at a Glance
Print this Web Page | | Back to Top
Custom Search

Feedback Form (Expand)

What do you think about this web page?






Detecting User Agent and Device Capabilities - Table of Contents Detecting User Agent and Device Capabilities - Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page