Monday, March 10, 2014

Friendly URL

Friendly URL

WebSphere Portal 6.1 introduced concept of friendly URL, what that does is, let you set a friendly URL at the time of creating page. Friendly URL is different than the url mapping in following aspects

1.     By default the friendly URLs are disabled and you need to enable it

2.     The actual URL that you use for accessing page using friendly URL, is made of all the URL's starting from root. Ex. If you create a page under Home page and assign friendly URL testurl to it then you will have to first assign a friendly url to to Home page say home. Then final url for your page will be /home/testurl. In URL mapping you can directly assign a URL to any child page




These are the steps that i used to create Friendly URL mapping on my portal, First set value of
friendly.enabled property to true in ConfigService like this



After enabling this property now when you either create new page or when you go to Manage Properties button of the existing page you will get "Friendly URL name" input like this



Use the manage properties, portlet to assign URL labels to every page from Home to your destination page. In my case page hierarchy is like this Root -> Home -> fun -> Test URL. I did assign name home to Home page and fun to fun page and testurl to Test URL page. Now i can access Test URL page using /home/fun/testurl


Implementation
If you create a URL mapping using URL mapping portlet then it gets stored like this in xmlaccess


 <url-mapping-context action="update" domain="rel" label="flashquery" objectid="C_VVILMKG1089N00I2U8SB9F00G2">

  <access-control externalized="false" owner="uid=wasadmin,o=defaultwimfilebasedrealm" private="false"/>

  <portal-url resourceref="6_VVILMKG10G04D0I2C4HO3V0007" update="set"/>

</url-mapping-context>


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="6_CGAH47L008IC40I4BOR2EO00I3" 

create-type="explicit" domain="rel" objectid="6_VVILMKG100GBC0I2F1UTLJ0001" ordinal="1300" type="page">

  <supported-markup markup="html" update="set"/>

  <localedata locale="en">

    <title>Test Page</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[testurl]]></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>

No comments:

Post a Comment