Example 2: Generate a friendly URL for web content

This example demonstrates a content URL generation filter that generates a friendly URL for web content.

This information applies to CF08 and later
Note: If you are using Combined Cumulative Fix 8 or later, complete the procedure for CF08 in Defining friendly URLs without state information for pages in your site to generate friendly URLs for web content. The content of Example 2: Generate a friendly URL for web content and its related subtopics is only an example for URL generation filters and is not recommended to generate friendly URLs for web content. If you already have completed the procedure in Defining friendly URLs without state information for pages in your site, do not deploy the URL generation filter of this example.

The filter determines the target portal page that is used to render the web content. If there is a web content page that has a content association that references a parent site area of the content, the filter creates a friendly URL to the content.

Friendly URLs for web content are constructed according to several factors. For example, the friendly URL /wps/myportal/home/news/news+1 is determined by the following details:
  • Content path: /Library1/News/News 1
  • Content association on the web content page where the content is rendered: /Library1/News site area
  • Friendly URL of this page: /home/news
To use the sample filter that is described here, each page for which a content URL is generated must have these characteristics:
  • The page must be a web content page with a friendly name.
  • The page must have a default content association that references the parent site area of the content item.
The friendly URLs that are generated by this sample filter do not contain any portlet state information. When a user clicks one of these friendly URLs from within a web content viewer that does maintain state information, the state information in the viewer is cleared.
Important:
  • These sample filter classes are not provided by default with IBM® Web Content Manager. Example code is provided here that you can take and use to implement the classes yourself.
  • Some web content URLs strictly require state information, for example the URLs that are generated by page navigation components. Therefore, web content URLs that are not generated by web content tags, such as the Placeholder or the URLCmpnt tag, are not processed by custom content URL generation filters.