RSS (Really Simple Syndication) is a family of web feed formats used to publish frequently updated works—such as blog entries, news headlines, audio, and video—in a standardized format. A web feed (or news feed) is a data format used for providing users with frequently updated content. Content distributors syndicate a web feed, thereby allowing users to subscribe to it.
Liferay portal first provides secure RSS feeds (see Ray’s blogs post). All secure RSS feeds transparently support BASIC Authentication. Liferay portlet supports RSS feed type: ATOM 1.0, RSS 1.0 and RSS 2.0.
Liferay portal provides RSS feed for its content types like blogs entries, web content articles (by feeds), message boards threads, wiki pages, and so on.
Message Boards threads (using Struts Action):
/c/message_boards/rss?p_l_id=10447&mbCategoryId=10157
Blogs entries (using Struts PortletAction):
/web/guest/test/-/blogs/rss
Wiki pages (using Struts Action):
/c/wiki/rss?p_l_id=10447&companyId=10132&nodeId=11635&title=FrontPage&type=rss&version=2.0
Asset Publisher (using Struts PortletAction):
/web/guest/test/-/asset_publisher/7Pnm/rss?p_p_cacheability=cacheLevelPage
Web content feeds (use case I - using Struts PortletAction):
/web/guest/home/-/journal/rss/11301?doAsGroupId=10157&refererPlid=10447&_15_groupId=10157
Especially the portal provides RSS feeds for web content in following URLs:
Use case II (using Action): for a list of articles, including different versions
/c/journal/get_articles?groupId=@value@[&templateId=@value@][&structureId=@value@][&orderBy=@value@][&orderByType=@value@][&orderByCol=@value@][&type=@value@][&displayDateGT=@value@][&displayDateLT=@value@][&delta=@value@]
Use case III (using Action): for a given article by article ID
/c/journal/get_article?groupId=@value@&articleId=@value@
Above features are very useful in many use cases. Here let’s consider different requirements:
- Use Case A: Web content RSS feeds should be presented in authentication public path, like /c/web_content/rss
- Use Case B: Web content RSS feeds should be able to feed articles by different article types like press-release, feature, and types combination like press-release and feature
- Use Case C: Web content RSS feeds should be able to feed articles by authors
- Use Case D: Web content RSS feeds should be ordered by either modified date or display date; and only show the latest version.
This article will first address an implementation for above use cases (A, B, C, D) in Liferay 6; then it will show how to leverage Struts action hooks to implement above use cases in Liferay 6.1.
Making RSS feeds of web content highly configurable
In order to make RSS feeds configurable, add following properties.
## Custom RSS feeds
## default type and version: ATOM 1.0, RSS 1.0, RSS 2.0
custom.rss.default.type=atom
custom.rss.default.version=10
## custom RSS feeds display
## display style: abstract, full-content, content, title
custom.rss.display.style=content
## set default content field
## if custom.rss.display.style is set to content
custom.rss.default.content.field=CONTENT
## set maximum characters
custom.rss.display.length=350
## set default content type
custom.rss.default.content.type=press-release
## set default maximum value
custom.rss.default.delta.max=50
## enable or disable to display author
custom.rss.display.author.enabled=false
## Custom RSS feeds links URL
## enable or disable RSS links URL
## custom.rss.link.preview.enabled is in use if
## custom.rss.link.enabled is set to true.
## custom friendly URL like /${content.type}/${id}/${title} will be in use when
## custom.rss.link.preview.enabled is set to false and
## custom.rss.link.friendly.url.enabled is set to true
custom.rss.link.enabled=true
custom.rss.link.preview.enabled=false
custom.rss.link.friendly.url.enabled=true
## Custom RSS feeds title prefix
custom.rss.title.prefix=The Network
custom.rss.title.author.prefix=Contributed Articles by
## Custom RSS feeds via author
## possible values: press-release, feature
custom.rss.author.content.type=feature
New features in Liferay 6
Leveraging auth public path: /c/journal/get_articles, customize GetArticlesAction extending Action
Testing results:
Press releases
Features
Press releases and features
Features by author
Using Struts action hooks in Liferay 6.1
In brief, there are several kinds of hooks: portal properties, language properties, custom JSP, indexer post processors, service wrappers, servlet filters and servlets mapping, and struts actions in Liferay 6.1.
Struts action hook provides capabilities to override existing struts action and / or add new struts actions from plugins. With struts action hook, you can either add new struts actions to the portal core from plugins, or override any existing action within the portal core from plugins.
Above use cases (A, B, C and D, using auth public path /c/web_content/rss) could be implemented through portal properties and struts actions in following steps.
First, edit the liferay-hook.xml and add following fragment.
<hook>
<portal-properties>portal.properties</portal-properties>
<struts-action>
<struts-action-path>/web_content/rss</struts-action-path>
<struts-action-impl>com.liferay.knowledgebase.hook.action.RSSAction</struts-action-impl>
</struts-action>
</hook>
As shown in the above code, it specified at least three kinds of hooks: portal properties hooks and struts action hooks.
Secondly, add following line in the portal.properties.
auth.public.paths=/web_content/rss
The property auth.public.paths specifies public paths that don’t require authentication.
Last but not least, implement same logic in the com.liferay.knowledgebase.hook.action.RSSAction, which extends BaseStrutsAction implementing StrutsAction.
Abstracted from the book: Liferay Systems Development - Liferay Cookbook (coming out soon).
Summary
As you can see, new features (implementing use cases A, B, C, D) make RSS feeds of web content highly configurable - related ticket LPS-16041. In Liferay 6 or previous versions, these features were implemented as a fix patch, while same features were implemented in the plugin via portal properties hook plus struts actions hook.
Are these features useful?
Any suggestions or comments?

