Skip to main content

 Advanced

Advanced topics

Generator: GetXMLFileInfo

Class name:org.weborganic.bastille.xml.GetXMLFileInfo
Version:0.6.5 - 23 May 2010
Library:Bastille
Cacheable:Yes
Generated:2012-12-21

Description

Returns information about a file in the WEB-INF/xml based on the specified path info.

If the file is a directory, lists the files corresponding to the specified directory.

Configuration

The root XML folder can be configured globally using the Berlioz configuration:

For example:

<node name="bastille">
  <map/>
  <node name="xml">
    <map>
      <entry key="folder"   value="xml/content"/>
    </map>
  </node>
</node>

Parameters

The path to the resource can be specified using the path parameter; if the path parameter is not specified, the path uses the path info.

Returned XML

XML for a file:

<file name="[filename]"
      path="[path_to_folder]"
      type="file"
      media-type="[media_type]"
      length="[file_size]"
      modified="[ISO8601_datetime]">
 

XML for a folder:

<file name="[filename]" path="[path_from_root]" type="folder">
  <!-- for each file... -->
  <file name="" ... />
  </file>
 

XML if the file doesn’t exist:

<file name="[filename]" path="[path_to_folder]" status="not-found">

File attributes

  • name – the name of the file (including extension).
  • path – the path from the root of the website.
  • type – is either ‘file’ or ‘folder’.
  • length – the full length of the file.
  • modified – the last modified date and time of the file using ISO8601.
  • media-type – the media type of the file based on the file extension as specified in Berlioz; if the file extension does not map to any media type, returns “application/octet-stream”.
  • content-type – same as media type (deprecated).
  • status – equals ‘not-found’.
Created on , last edited on