ikrs.httpd.resource
Class DefaultDirectoryResource

java.lang.Object
  extended by ikrs.httpd.resource.AbstractResource
      extended by ikrs.httpd.resource.AbstractDirectoryResource
          extended by ikrs.httpd.resource.DefaultDirectoryResource
All Implemented Interfaces:
Resource, DirectoryResource

public class DefaultDirectoryResource
extends AbstractDirectoryResource


Constructor Summary
DefaultDirectoryResource(HTTPHandler handler, CustomLogger logger, HTTPFileFilter fileFilter, java.io.File dir, java.net.URI requestURI, java.util.UUID sid, java.lang.String format, boolean useFairLocks)
          Create a new DefaultDirectoryResource.
 
Method Summary
 void generateDirectoryListing(java.util.UUID sid, java.io.OutputStream out)
          This method is designated to build the data for the directory listing.
 MIMEType getDirectoryListingType()
          This method returns the Content-Type this class generates.
 
Methods inherited from class ikrs.httpd.resource.AbstractDirectoryResource
close, getDateFormat, getDirectoryFile, getFileFilter, getInputStream, getLength, getOutputStream, getRequestURI, isOpen, isReadOnly, open
 
Methods inherited from class ikrs.httpd.resource.AbstractResource
getHTTPHandler, getHypertextAccessFile, getLogger, getMetaData, getReadLock, getWriteLock, setHypertextAccessFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ikrs.httpd.Resource
getHypertextAccessFile, getMetaData, getReadLock, getWriteLock
 

Constructor Detail

DefaultDirectoryResource

public DefaultDirectoryResource(HTTPHandler handler,
                                CustomLogger logger,
                                HTTPFileFilter fileFilter,
                                java.io.File dir,
                                java.net.URI requestURI,
                                java.util.UUID sid,
                                java.lang.String format,
                                boolean useFairLocks)
                         throws java.lang.NullPointerException
Create a new DefaultDirectoryResource.

Parameters:
logger - A custom logger to write log messages to.
fileFilter - The file filter to use.
dir - The directory.
requestURI - The uri from the request (will be used to avoid printing the absolute file path).
format - The output format; currently "TXT" and "HTML" are supported (default is "TXT", if format is null).
useFairLocks - If set to true the created resource will use fair locks.
Throws:
java.lang.NullPointerException
Method Detail

generateDirectoryListing

public void generateDirectoryListing(java.util.UUID sid,
                                     java.io.OutputStream out)
                              throws java.io.IOException
This method is designated to build the data for the directory listing. Subclasses must implement this method and write the generated data into the given output stream.

Specified by:
generateDirectoryListing in interface DirectoryResource
Specified by:
generateDirectoryListing in class AbstractDirectoryResource
Parameters:
sid - The current session's ID.
out - The output stream to write the list data to.
Throws:
java.io.IOException - If any IO errors occur.

getDirectoryListingType

public MIMEType getDirectoryListingType()
This method returns the Content-Type this class generates. The returned MIME type must not be null.

Specified by:
getDirectoryListingType in interface DirectoryResource
Specified by:
getDirectoryListingType in class AbstractDirectoryResource
Returns:
The Content-Type this class generates.