Content and Request URL Mapping

The Jetspeed Portal implements request URL mapping features to support portlets designed to display content from repositories or other web sites. This makes it possible to augment the portal URL space with virtual PSML pages and hierarchies that mirror the paths or URL structure of the content source. These features are implemented by the Portal Site Component within the portal.

While accessing and displaying content is a responsibility left to portlets, the Portal Site Component allows dynamic page templates with these portlets to present content as portal pages. In addition, the request URL is mapped into a content access path that is passed as a request attribute to portlets, (see PortalReservedParameters.PATH_ATTRIBUTE and PortalReservedParameters.CONTENT_PATH_ATTRIBUTE). By default, matching concrete pages defined in the PSML are matched by requests first. If unmatched, requests are then classified by the Content Type Mapper implementation registered with the Portal Site Component. The provided implementation decomposes the request URL into a content access path and content type if it is recognized as a content request. This information is subsequently used by the Portal Site Component to find the most specific dynamic page that can be addressed by the path on the request URL. Fallback dynamic page selection is performed by searching in parent PSML folders and matching wildcard, '*', dynamic page content types.

Content and Request URL Mapping Configuration

The Portal Site content mapping is configured using a Content Type Mapper implementation specified in the portal Spring configuration, (typically in the page-manager.xml assembly file). The provided implementation matches request URLs using Perl regular expression patterns to determine content and system request access paths and dynamic page content types. As with other portal configurations, this object can be replaced with a custom implementation that might leverage external repository or web site information to classify the portal request.

Example provided Content Type Mapper configuration:

  <bean id="org.apache.jetspeed.portalsite.PortalSiteContentTypeMapper" 
       name="portalSiteContentTypeMapper"
       class="org.apache.jetspeed.portalsite.impl.PortalSiteContentTypeMapperImpl">
       <!-- content type mapping -->
       <constructor-arg index="0">
           <list>
               <bean class="org.apache.jetspeed.portalsite.impl.ContentTypeMapping">
                   <constructor-arg index="0"><value>\w[.](\w+)&#36;</value></constructor-arg> <!-- use &#36; for '$' -->
                   <constructor-arg index="1"><value>&#36;1</value></constructor-arg> <!-- use &#36; for '$' -->
               </bean>
           </list>
       </constructor-arg>
       <!-- dynamic page path mapping -->
       <constructor-arg index="1">
           <list>
               <bean class="org.apache.jetspeed.portalsite.impl.RequestPathMapping">
                   <constructor-arg index="0"><value>/preview/</value></constructor-arg>
                   <constructor-arg index="1"><value>/</value></constructor-arg>
               </bean>
               <bean class="org.apache.jetspeed.portalsite.impl.RequestPathMapping">
                   <constructor-arg index="0"><value>.domain.com</value></constructor-arg>
                   <constructor-arg index="1"><value>doc</value></constructor-arg>
                   <constructor-arg index="2"><value>/(?:draft|scratch)/</value></constructor-arg>
                   <constructor-arg index="3"><value>/pub/</value></constructor-arg>
               </bean>
           </list>
       </constructor-arg>
       <!-- system page path mapping -->
       <constructor-arg index="2">
           <list>
               <bean class="org.apache.jetspeed.portalsite.impl.RequestPathMapping">
                   <constructor-arg index="0"><value>/preview/</value></constructor-arg>
                   <constructor-arg index="1"><value>/</value></constructor-arg>
               </bean>
           </list>
       </constructor-arg>
       <!-- external content path mapping -->
       <constructor-arg index="3">
           <list>
               <bean class="org.apache.jetspeed.portalsite.impl.RequestPathMapping">
                   <constructor-arg index="0"><value>[.](\w+)&#36;</value></constructor-arg> <!-- use &#36; for '$' -->
                   <constructor-arg index="1"><value></value></constructor-arg>
               </bean>
           </list>
       </constructor-arg>
       <!-- enable content type fallback -->
       <constructor-arg index="4"><value>true</value></constructor-arg>
  </bean>

The above configuration specifies the following content and request URL mapping:

  • Content types are taken from the request URL file extension.
  • Dynamic page request paths are modified by stripping the '/preview' prefix.
  • Dynamic page request paths for 'doc' content types against the '.domain.com' servers are modified by replacing the '/draft' and '/scratch' prefix with '/pub'.
  • Concrete portal page and folder request paths, (i.e. system pages), are also modified by stripping the '/preview' prefix
  • Content page content access paths types are constructed from the request URL by stripping the file extension.
  • Wildcard dynamic page content type fallback is enabled.
See the javadoc for the following classes for more information on configuring these Spring beans: