Advanced

Advanced topics

 

Generator: GetFolderInfo

Class name:org.weborganic.bastille.psml.GetFolderInfo
Version:
Library:Bastille
Cacheable:Yes
Generated:2012-12-21

Description

Returns information about a folder from the PSML folder using the specified path parameter.

This generator is useful to provide a tree of all the files within a folder.

Note

When accessing file from the content folder, it is often preferable to simply use the GetContentFolderInfo or GetContentFolderInfoAuto generators.

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 application.

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.

Note

If the path resolves to a location outside the PSML folder, this generator will not 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.

<file name="[folder name]" path="[folder path]" type="folder">
  <!-- for each sub folder ... -->
  <file name="[file name]" path="[file path]" type="folder">
    <!-- more files and subfolders  -->
  </file>
  <!-- for each file ... -->
  <file name="[file name]"
        path="[file path]"
        type="file"
  media-type="application/vnd.pageseeder.psml+xml"
     length="[file size in bytes]"
   modified="[last modified date]"/>
</file>

Error handling

Folder does not exists

If the folder cannot be found this generator will return the following:

<file name="[file name]" path="[base path]" status="not-found"/>

Missing path parameter

If the path parameter is not specified, this generator will set the status to BAD_REQUEST and return the following:

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

Usage

<generator class="com.weborganic.bastille.psml.GetFolderInfo" ... >
  <parameter name="path" value="[path]"/>
</generator>

Created on , last edited on