Accessing Web content via a servlet (Content Serving using WCM connect Servlet)

Users can access content displayed via the Web Content Management servlet by connecting to a URL.This topic describes how to access Web content displayed using the Web Content Management servlet using a URL.
To create links to Web content within presentation templates or element designs you should use either a link element or the "insert link" feature. See the Link element and Inserting a link in an element topics for further information.

Accessing a Web page using a servlet,  The following URL structure is used to connect to a Web page:

1. Non-ascii characters can not be used in the query string section of URLs. For this reason, it is not good to name Web Content Management items using Non-ascii characters if you plan to use URLs to call Web Content Management items.
2. [PATH] can be the path to a site, site area, or content item. This must be entered for all types of content including components. In the case of components, this is the path to the site, site area, or content item that the component is displayed with.
3. srv= is either cmpnt or page.
srv=cmpnt    This will retrieve a component either from the component library or from a site, site area or content item. You must also specify the following:
source=    This determines where the component is being sourced from. This is either:
•    library.
•    site.
•    sitearea.
•    content.

This is the name of the component being retrieved.
srv=page    This will retrieve an Web Content Management content item. As srv=page is returned as default, this can be left out of the URL.
The presentation template to use when displaying this content is specified by adding:

URL to content
Example: http://host:10038/wps/wcm/connect/site/sitearea/content

URL to content with a presentation template defined

Example: http://host:10038/wps/wcm/connect/site/sitearea/content?presentationtemplate=library/presentationtemplate

URL to a library component

Example: http://host:10038/wps/wcm/connect/site/sitearea/content?srv=cmpnt&source=library&cmpntname=component

URL to a content component

Example: http://host:10038/wps/wcm/connect/site/sitearea/content?srv=cmpnt&source=content&cmpntname=component

Applying Custom Caching and Expiring Parameters.
Like any other URL request made to a Web Content Management Server, Custom Caching and Expiring parameters can be added to a request. See the topic, Using Custom Caching for further information.

In this example, the content being retrieved via URL will be saved in the Basic Site Cache, and expired after 9000 seconds (two and half hours).

Click Here to get more information on Connect Tags and Custom Caching

Model schemas for addressing resources (or) Generate the Feed with myContentHandler

Addressing a resource includes specifying the model to which the resource is associated. To do this, you specify a schema.

There is a schema defined for each model that the remote model SPI supports:
•    For addressing a resource in the content model: cm
•    For addressing a resource in the navigation model: nm
•    For addressing a resource in the layout model: lm
•    For addressing a resource in the portlet model: pm

Furthermore, you need to specify the resource of the model itself, as described in the following resource addressing specification:
model-uri = "cm:" page-oid |
            "nm:" navigationnode-oid |
            "lm:" [layoutnode-oid "@"] page-oid |
            "pm:" portlet-oid ["@" page-oid

The meanings of the syntax elements are as follows:

page-oid    :
This is the portal object ID of a content page. When you address portlet model resources, this is required for portlet windows, but it must not occur for any other portlet model resource identification.

navigationnode-oid   :  This is the object ID of a navigation model node.
layoutnode-oid         : This is the object ID of a layout model node.
portlet-oid                : This is the object ID of a layout control, portlet window, portlet entity, or
                                  portlet definition.
oid           :  This is the serialized string that represents a portal object ID. This is URI-escaped with UTF-8 encoding. The character @ is also escaped by using %40. You can also use unique names instead of object IDs. Unique names also have to be URI-escaped, and the @ character must be escaped. Note that every object ID has the defined scheme 'oid:'.

Note that the model schemes are mandatory for ambiguity reasons. For example content and navigation nodes currently have got the same object IDs.

Example 1: To obtain a feed of the root node of content model, that is the content node with the unique name wps.content.root, send an HTTP GET request to the following URL:

Example 2: To obtain a feed of the layout node with the object id '_7_0830M4HTFF0SHFCQ_2BV' on the content page with the object id '_6_0830M4HTFF0SHFCQ_4D', send an HTTP GET request to the following URL:

To Generate the Feed with myContentHandler

Click here for the more information related this.

Handling the "myportal" and "portal" for authenticated and un-authenticated users in WCM generated links

<URLCmpnt context="current" type="content" mode="portal" portalTarget="virtual_portal_name/name_of_the_URL_mapping"/>

Following are the steps to handle the "myportal" and "portal" in WCM generated links using tags like above

1. Go to <WebSphere Server root>\wp_profile\PortalServer\config
2. Open using text editing tool.
3. Uncomment this property :uri.home.substitution and set it to true (initially it is commented.)
uri.home.substitution = true
4. Open CMD goto <WebSphere Server root>\wp_profile\ConfigEngine
5. Type ConfigEngine.bat update-properties
6. Restart your portal server for your changes to effect.

This property automatically handles this portal myportal issue. i.e if user is logged it will be myportal, if logged out then portal.

Check out this link for more information on this:

Login into Websphere Portal directly (No Redirection to Login Portlet)

You can login to websphere portal without authenticating through the login portlet . At least while development phase its good idea to bookmark URL like below to enter into portal directly.