Skip to main content

 Advanced

Advanced topics

Generator: GetContentFolderOverviewAuto

Class name:org.weborganic.bastille.psml.GetContentFolderOverviewAuto
Version:0.7.5 - 25 October 2012
Library:Bastille
Cacheable:Yes
Generated:2012-12-21

Description

Returns an overview of all the PSML files within a PSML content folder using the Berlioz path.

An overview is created by parsing every PSML file and extracting the following information from its content:

  • Title, using the first <heading/> element.
  • Summary, using the first <para/> element.
  • Properties, using all the <property/> elements.

This generator behaves as if it were using the Berlioz path as path parameter of the GetContentFolderOverview generator.

The Berlioz path depends on the mapping of the Berlioz servlet in the Web descriptor (web.xml) and usually corresponds to the value of the * in the path component of a matching URL. The Berlioz path is then appended to the /content folder with the added .psml extension to identify the file to load.

MappingURLPathFolder
/html/*/html/test/acme/test/acme/content/test/acme
*.html/test/acme.html/test/acme/content/test/acme
*.html/test.html?x=123#abc/test/content/test
*.xml/test/acme.xml/test/acme/content/test/acme

Configuration

No configuration is required.

The root of the PSML folder can be configured using the global property bastille.psml.root which can be either an absolute path or a relative path from the global repository.

By default, the PSML root is set to psml which usually corresponds to the /WEB-INF/psml folder of your Web app.

Parameters

This generator requires a path parameter. The path parameter must be a relative path from within the PSML content folder to a PSML file without the extension.

If the path resolves to a location outside the PSML folder, this generator won’t load the content.

Returned XML

The top level element is always the requested folder. Its child elements are either sub folders or files within that folder.

<overview folder="[folder name]" base="[folder path]">
  <!-- for each PSML file ... -->
  <entry name="[file name]">
    <title>[title]</title>
    <summary>[summary]</summary>
    <!-- for each property ... -->
    <property name="[name]" value="[value]" />
    
  </entry>
  
</overview>

Error handling

Folder does not exist

If the folder cannot be found, this generator sets the status to NOT_FOUND and no content.

Missing path parameter

If the path parameter is not specified, this generator sets the status to BAD_REQUEST and returns the following:

<error type="client" message="The parameter 'path' was not specified"/>

Usage

<generator class="org.weborganic.bastille.psml.GetContentFolderOverview" ... >
  <parameter name="path" value="[path]"/>
</generator>
Created on , last edited on