+

Search Tips   |   Advanced Search

About friendly URLs for web content

With friendly URLs for web content, we can construct URLs to content items that are clear and concise. Although we can construct friendly URLs that reference web content items, Web Content Manager itself does not generate friendly URLs by default. However, to cause the web content viewer to generate friendly URLs, we can create a plug-in that implements a content URL generation filter.

These URLs are easier for users to remember and share and are a convenient way for users to create bookmarks to content items. External applications can also use friendly URLs to provide links directly to content items in the portal. To create effective friendly URLs for web content, understand how friendly URLs for portal pages are constructed and how friendly URLs for web content extend those URLs.


How friendly URLs for pages are constructed

For a page to be referenced as part of a friendly URL, assign a friendly URL name for the page. We can assign a friendly URL when you create the page, or we can edit the page properties after the page is created.

Friendly URLs take the following general form:

http://host_name:port_number/context_root/portal/page_id/[!ut/p/encoded_suffix]
The page_id portion of the friendly URL is made up of the friendly URL names of each page in the page structure. The page structure begins at the content root and ends with the currently selected page.

For example, we might have a portal page called Products with a friendly URL name of products. Under the Products page is another page called Appliances with a friendly URL name of appliances. When referenced as a complete friendly URL, you would enter the following URL to access the Appliances page:

http://www.example.com:10039/wps/portal/products/appliances
For friendly URLs to work for a specific page, define a friendly URL name for each page or label in the page structure. To suppress a friendly URL name from showing in the friendly URL, we can specify a friendly URL name of com.ibm.portal.friendly.wildcard for the page. For example, if the Products page has a friendly URL name of com.ibm.portal.friendly.wildcard, the friendly URL in the previous example for the Appliances page is abbreviated:
http://www.example.com:10039/wps/portal/appliances

When the portal displays a page using a friendly URL, the URL can include an encoded suffix at the end of the URL with the form !ut/p/base_codec/rich_state. This suffix contains information about the portals state that the portal might use when displaying the page. However, when bookmarking or sharing friendly URLs, it is not necessary to include the suffix.


How friendly URLs for web content are constructed

Friendly URLs for web content are constructed just as friendly URLs for pages but include additional information that identifies the path to a content item. When the portal decodes a friendly URL, it decodes the URL from beginning to end. Each path segment of the URL is matched with the friendly URL names of portal pages until no more matches can be located. The remainder of the URL is then considered to be path information to a content item.

This path information is mapped to a shared public render parameter scoped to the portal page identified by the URL. The fully qualified name of this path-info parameter is http://www.ibm.com/xmlns/prod/websphere/portal/publicparams:path-info. The path-info parameter can contain multiple values, with the individual values representing segments of a content path. The segments are concatenated using a forward slash (/) as a path separator.

Friendly URLs for web content take the following general form:

http://host_name:port_number/context_root/portal/page_id/path_to_content/[!ut/p/encoded_suffix]

When we add a web content viewer to a portal page, the web content viewer reads the path-info parameter. The viewer assembles the path to the content to be rendered by appending the path information to the content mapping defined for the current page. For example, we might have the following friendly URL for web content:

http://www.example.com:10039/wps/portal/products/appliances/welcome
Several conditions contribute to this URL:

When a web content viewer is added to the Appliances page, the web content viewer interprets the path-info information from the friendly URL. The viewer identifies welcome as path information that represents content in a web content library. By examining the content mapping on the page, the web content viewer locates the Web Content/Appliances site area and then displays the welcome content item.

The page_id portion of the friendly URL is always evaluated first. Because of this priority, ensure that the naming schemes do not overlap when setting up your portal page hierarchy and the web content hierarchy. In particular, the path_to_content information cannot begin with segments that could be part of the page_id portion of the friendly URL. If the first segment of the path_to_content information matches the friendly URL name of a portal page at that point in the page hierarchy, the friendly URL could reference the wrong page.

Considerations for the path-info parameter:


Content URL generation filters and friendly URLs

A content URL generation filter is used to customize the URLs that are generated by a web content viewer. The web content viewer generates a content URL whenever there is a URL to web content within content that the viewer is displaying. By creating a plug-in that implements a content URL generation filter, we can tailor the URLs to content items. For details, see Create a content URL generation filter class.


Troubleshooting friendly URLs for web content

If we are seeing unexpected behavior when using friendly URLs for web content, review these issues to help identify why the friendly URL is not working. Friendly URLs for web content take the following general form:

http://host_name:port_number/context_root/portal/page_id/path_to_content/[!ut/p/encoded_suffix]


Parent: Friendly URLs and web content viewers