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.
When accessing file from the content folder, it is often preferable to 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 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.
<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 exist
If the folder cannot be found, this generator returns the following:
<file name="[file name]" path="[base path]" status="not-found"/>
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="com.weborganic.bastille.psml.GetFolderInfo" ... > <parameter name="path" value="[path]"/> </generator>