Skip to main content

 Advanced

Advanced topics

Generator: GetNavigation

Class name:org.weborganic.bastille.psml.GetNavigation
Version:0.7.0 - 6 October 2012
Library:Bastille
Cacheable:Yes
Generated:2012-12-21

Description

This generator returns the content of the navigation file in PSML located in /config/navigation.psml.

This generator is provided for convenience and behaves as if it were the GetConfigFile with the path parameter set to ‘navigation’. It results in a less verbose code for websites that use a file for their global navigation.

This generator comes as a replacement for the GetNavigation (web package) generator.

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 does not require or accept any parameter.

Returned XML

This generator wraps the content of the file with the <psml-file> element.

See the following:

<psml-file name="navigation.xml" base="/config/" status="[status]">
  <!-- PSML navigation file content -->
</psml-file>

Error handling

If the navigation file cannot be found or read, this generator returns the following:

<psml-file name="navigation.psml" base="/config/" status="not-found">
Unable to find file: [path]
</psml-file>

The status of this generator is set to ‘NOT_FOUND’.

Usage

Following is the code to include in the services:

<generator class="com.weborganic.bastille.psml.GetNavigation" ... />

Note that it is equivalent to:

<generator class="com.weborganic.bastille.psml.GetConfigFile" ... >
  <parameter name="path" value="navigation"/>
</generator>

Example: main navigation

The most common configuration is:

<generator class="com.weborganic.bastille.psml.GetNavigation" 
           name="navigation"
           target="navigation"/>
Created on , last edited on