org.weborganic.bastille.xml
Class GetFileInfo

java.lang.Object
  extended by org.weborganic.bastille.xml.GetFileInfo
All Implemented Interfaces:
Cacheable, ContentGenerator

public final class GetFileInfo
extends Object
implements ContentGenerator, Cacheable

Returns information about the file specified by the Berlioz path in the public folder.

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

Configuration

No configuration required for this generator.

Parameters

No parameter needed for this generator.

Returned XML

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

For a folder:

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

If the file does not exist,

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

File attributes

Since Version 0.6.1, this generator returns both the media-type and content-type attributes. Use media-type.

Since:
0.6.0

Constructor Summary
GetFileInfo()
           
 
Method Summary
 String getETag(ContentRequest req)
          Returns a weak Etag based on the file path, length and last modified date.
 void process(ContentRequest req, XMLWriter xml)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GetFileInfo

public GetFileInfo()
Method Detail

getETag

public String getETag(ContentRequest req)
Returns a weak Etag based on the file path, length and last modified date.

Specified by:
getETag in interface Cacheable

process

public void process(ContentRequest req,
                    XMLWriter xml)
             throws BerliozException,
                    IOException
Specified by:
process in interface ContentGenerator
Throws:
BerliozException
IOException