at.ac.tuwien.infosys.rnue.helpers.http
Class FileDocument

java.lang.Object
  |
  +--at.ac.tuwien.infosys.rnue.helpers.http.FileDocument
All Implemented Interfaces:
IDocument

public class FileDocument
extends java.lang.Object
implements IDocument

An object of the FileDocument class represents the file which is to be returned to the HTTP client.


Constructor Summary
FileDocument(java.io.File f)
          Constructs a FileDocument object.
 
Method Summary
 java.lang.String getCachingInfo()
          Return the document's cache information
 java.io.InputStream getContent()
          Return the document.
 long getContentLength()
          Return the document's content length.
 java.lang.String getContentType()
          Return the document's content type.
 java.util.Date getLastModified()
          Return when the document has been last modified.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileDocument

public FileDocument(java.io.File f)
             throws ShareMeException
Constructs a FileDocument object.

Parameters:
f - java.io.File indication the file on the local file system.
Throws:
ShareMeException - If no file object passed to FileDocument.
Method Detail

getLastModified

public java.util.Date getLastModified()
Return when the document has been last modified.

Specified by:
getLastModified in interface IDocument
Returns:
modification date

getContentType

public java.lang.String getContentType()
Return the document's content type.

Specified by:
getContentType in interface IDocument
Returns:
conten type depending in the filename extension ("text/html" for "html" | "htm"; "text/plain" for "txt"; "application/msword" for "doc"; "image/gif" for "image/gif"; "image/jpeg" for "jpg"; "image/png" for "png"; "application/pdf for "pdf"; "application/zip" for "zip") for any other extension is returned "application/octet-stream"

getContentLength

public long getContentLength()
Return the document's content length. Return 0 if the document's content length cannot be computed easily.

Specified by:
getContentLength in interface IDocument
Returns:
length of the content

getCachingInfo

public java.lang.String getCachingInfo()
Return the document's cache information

Specified by:
getCachingInfo in interface IDocument
Returns:
null (this kind of documents is always cachable)

getContent

public java.io.InputStream getContent()
Return the document.

Specified by:
getContent in interface IDocument
Returns:
the content of the document as java.io.InputStream