Friendly URL's Vs URL mappings in Websphere Portal

Friendly URL's
WebSphere Portal 6.1. introduced a friendly URL service. It simplifies creating friendly URLs for pages within portal structure. Click on Page Properties icon to give friendly URL which will be appended to portal URL



Friendly URL's from 6.1 , work very similar to the existing URL mapping feature. Important thing to remember about friendly URLs is path must reflect pages hierarchy. Example

1. Create page called "blog" under the content root and specify friendly URL for this page as "blog"
2. Create page called "home" under the "blog" page and specify the friendly URL for this page as "home"
3. Create page called "posting1" under the "home" page and specify the friendly URL for this page as "posting1"

you can access the pages as

http://localhost:10040/wps/portal/blog/home for the home page
http://localhost:10040/wps/portal/blog/home/posting1 for the posting1 page

Using URL mapping , you can access the pages as similar to Friendly URL's
  1. Created URL Mapping as "blog" and point to blog Page
  2. Created URL Mapping as "home" under the "blog" context and point to "home" Page
  3. Created URL Mapping as "posting1" under the "home" context and point to "posting1" Page

How its different from the URL mappings:

Earlier we used to maintain mappings separately (Its not part of the portal page metadata), but if you assign friendly URL to a page then it gets stored as value of com.ibm.portal.friendly.name parameter in the page level metadata

<content-node action="update" active="true" allportletsallowed="true" content-parentref="3_BDGEF479FE090I4BOYUE80JN74" 
create-type="explicit" domain="rel" objectid="9_BDGEF479FE090I4BOYUEL32J74" ordinal="200" type="page">
  <supported-markup markup="html" update="set"/>
  <localedata locale="en">
    <title>SivaVaka</title>
  </localedata>
  <parameter name="com.ibm.portal.IgnoreAccessControlInCaches" type="string" update="set"><![CDATA[false]]></parameter>
  <parameter name="com.ibm.portal.bookmarkable" type="string" update="set"><![CDATA[Yes]]></parameter>
  <parameter name="com.ibm.portal.friendly.name" type="string" update="set"><![CDATA[sivavaka]]></parameter>
  <parameter name="com.ibm.portal.remote-cache-expiry" type="string" update="set"><![CDATA[0]]></parameter>
  <parameter name="com.ibm.portal.remote-cache-scope" type="string" update="set"><![CDATA[NON-SHARED]]></parameter>
  
URL mapping
 
 <url-mapping-context action="update" domain="rel" label="flashquery" objectid="7_KG10VI89N0I2UF0LM8SB0V90G2">
  <access-control externalized="false" owner="uid=wpsadmin,o=defaultwimfilebasedrealm" private="false"/>
  <portal-url resourceref="6_3_BDGEF479FE090I4BOYUE80JN74" update="set"/>
</url-mapping-context>  
 
Main advantage here is , No need to maintain the URL mappings separately from the pages , but portal still attaches the navigational state to the URL when we browsing through the navigation



Note: If service disabled (disabled in some installations), follow below steps to enable it:
  • log in to WebSphere Application Server console
  • navigate to Resources -> Resource Environment -> Resource Environment Providers
  • click WP ConfigService on the  providers list
  • click Custom properties under Additional properties section
  • add new property called friendly.enabled and set it to true
  • save changes
  • restart server
.

1 comment: