Chapter 6. CMS Portlet
Prev |  | Next

## Chapter 6. CMS Portlet

### Roy Russo

`<roy @ jboss dot org>`

JBoss Portal packages a Web Content Management System capable of serving and allowing administration of web content. This chapter describes the CMS Portlet which is responsible for serving resources requested, the following chapter describes the CMSAdmin Portlet and all administration functionality.

## 6.1. Introduction

The CMS Portlet displays content from the file store inside a portlet window, or, in the case of binary content, outside of the portlet window altogether.

## 6.2. Features

The CMSPortlet handles all requests for all content types.

The methodology of serving content within the CMSPortlet, allows for some beneficial features, like:

1. Search-engine friendly URLs: http://domain/[portal]/content/company.html
2. Serve binaries with simple urls independant of the portal: http://domain/content/products.pdf
3. Deploy several instances of the CMSPortlet on any page and configure them to display different start pages.
4. Localization support: CMSPortlet will display content based on the user request locale, or display content using the default locale setting.

## 6.3. CMS Configuration

### 6.3.1. Portlet Configuration

The CMS Portlet allows an administrator to configure the initial start page displayed via its deployment descriptor, located in jboss-portal.sar/portal-core.war/WEB-INF/portlet.xml

          <init-param>
             <description>Default path to index page.</description>
             <name>indexpage</name>
             <value>/default/index.html</value>
          </init-param>

### 6.3.2. Service Configuration

JBoss Portal uses Apache Jackrabbit as its Java Content Repository implementation. Configuration of the service descriptor, allows for changing many of the variables associated with the service.

Here is the default configuration for the CMS repository found under `portal-cms.sar/META-INF-INF/jboss-service.xml` :

          ...
          <attribute name="DoChecking">true</attribute>
          <attribute name="DefaultContentLocation">portal/cms/conf/default-content/default/</attribute>
          <attribute name="DefaultLocale">en</attribute>
          <attribute name="RepositoryName">repotest</attribute>
          <attribute name="HomeDir">${jboss.server.data.dir}${/}portal${/}cms${/}conf</attribute>

Below is a list of items found in the service descriptor and their definitions. Only items commonly changed are covered here and it is recommended you do not change any others unless you are very brave.

- DoChecking: Should the portal attempt to check for the existence of the repository configuration files and default content on startup?
- DefaultContentLocation: Location of the default content used to pre-populate the repository.
- DefaultLocale: Two-letter abbreviation of the default locale the portal should use when fetching content for users. A complete ISO-639 list can be found here .
- HomeDir: Location of configuration information for the repository when in 100% FileSystem store mode. Otherwise, its in the database. ;-)

Also note that there is an additional parameter that decides under which path the portal should serve requests for content, located in the same jboss-service.xml:

             ...
       <mbean
             code="org.jboss.portal.core.cms.CMSObjectCommandMapper"
             name="portal:mapper=CMSObject"
             xmbean-dd="org/jboss/portal/core/cms/CMSObjectCommandMapper.xml">
          <attribute name="Prefix">content</attribute>
          <attribute name="TargetWindowRef">default.default.DefaultCMSPortletWindow</attribute>
          <depends optional-attribute-name="Mapper" proxy-type="attribute">portal:mapper=PrefixDelegating</depends>
          <depends optional-attribute-name="CMSService" proxy-type="attribute">portal:service=CMS</depends>
       </mbean>
             ...

- Prefix: This is the context path prefix that will trigger the portal to render content. By default, navigating to a URL such as http://localhost:8080/[portal_context]/content/Test.PDF will trigger the portal to display the PDF isolated from the portal pages. The path following the Prefix has to be absolute when fetching content.

## 6.4. Localization Support

The CMS Portlet now serves content based on the user's locale setting. For example: if a user's locale is set to Spanish in his browser, and he requests URL: default/index.html , the CMSPortlet will first try and retrieve the Spanish version of that file. If a Spanish version is not found, it will then try and retrieve the default language version set for the CMSPortlet.

Prev | Up | Next
Chapter 5. Portal Object Management - Dynamicity | Home | Chapter 7. CMSAdmin Portlet