Resolving variant URLs

The way MCS constructs basic variant URLs depends on a combination of settings, including the variant attributes, the associated asset group, and the MCS configuration file. In some server configurations, it may be possible to specify modifications to the basic URL in the configuration file. MCS may also process suffix information in XDIME attributes, or handle custom code to rewrite URLs. You can also define URLs directly on some XDIME elements.

The way MCS constructs basic variant URLs depends on a combination of settings, including the variant attributes, the associated asset group, and the MCS configuration file. In some server configurations, it may be possible to specify modifications to the basic URL in the configuration file. MCS may also process suffix information in XDIME attributes, or handle custom code to rewrite URLs. You can also define URLs directly on some XDIME elements.

Note:

Custom classes for modifying URLs are not supported in Mobile Portal Accelerator.

Local repository variants

The required URL value that you enter in the Content section of a policy editor always forms the last part of the variant URL. Usually this is the filename of the variant.

If you have not defined an asset group, MCS obtains the prefix from the MCS configuration file. For example, if the variant is an image, MCS concatenates the prefix-url attribute of the image-assets element tag in the MCS configuration file with the URL value.

<assets base-url="/[context_root]/">
  <audio-assets prefix-url="/audio/"/>
  <image-assets prefix-url="/images/"/>
  <script-assets prefix-url="/scripts/"/>
  <text-assets prefix-url="/text/"/>
</assets>

If you have defined an asset group in a policy, MCS uses its Base URL value from the asset group editor as a prefix. If neither the configuration file prefix, nor the asset group prefix is specified, MCS uses the URL attribute by itself.

Device variants

If you set the Base location attribute to 'Device', you are defining a variant stored on the device itself, such as an icon built into a mobile phone. Depending on the device the Base URL may require a file:/// prefix on the value. You might also use a WML icon reference as a variant value.

If you use a Base location setting of 'Default' on a variant, MCS will use the setting in the linked asset group.

Remote repository variants

When you need to address variants stored in a remote repository, you set the asset group Base location control to 'Server' and use the http:// prefix in the Base URL to identify the server. The remote repository server is responsible for resolving the variant location.

Note:

Temporary network and server problems may affect the operation of MCS in cases where you are relying on the remote policies.

Modifying basic URL values

MCS supports application and web server configurations in cases when the web server routes all requests to the application server after removing a specific prefix. You can define this prefix using the base-url attribute on the web-application element in the mcs-config.xml file. If this attribute is not specified then no changes are made to the variant URLs.

For other application server configurations, developers can use the AssetURLRewriter interface to modify the variant URLs before they are added to the output.

URL suffixes

Some variants support the addition of a URL suffix, specified as the assetURLsuffix attribute on the XDIME element. These may take the form of a query string, for example in entitlement information in systems where access to content is authorized or billed. MCS adds the suffix to the final variant URL without attempting to interpret it.

URLs in XDIME elements

If you use a URL directly in XDIME, MCS adds it to the generated page as an attribute of an element in the target markup.

Related topics