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

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

public class SimpleDocument
extends java.lang.Object
implements IDocument

A class that describing simple documents. I.e., documents represented by a string. An object of the SimpleDocument class can be used as container for an HTML page available as string.


Constructor Summary
SimpleDocument(java.lang.String content, boolean cacheable)
          Constructs a SimpleDocument.
 
Method Summary
 java.lang.String getCachingInfo()
          Returns a java.lang.String representing the caching info of the document.
 java.io.InputStream getContent()
          Returns a java.io.InputStream representing the content of the document.
 long getContentLength()
          Returns the length of the content as integer.
 java.lang.String getContentType()
          Returns the content type of the document.
 java.util.Date getLastModified()
          Returns the last modification date.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDocument

public SimpleDocument(java.lang.String content,
                      boolean cacheable)
Constructs a SimpleDocument. An object of the SimpleDocument class can be used as container for an HTML page available as string.

Parameters:
content - java.lang.String representing the content of the HTML page.
cacheable - boolean indicating whether this document can be cached.
Method Detail

getLastModified

public java.util.Date getLastModified()
Returns the last modification date. (The current date)

Specified by:
getLastModified in interface IDocument
Returns:
jave.util.Date modification date

getContentType

public java.lang.String getContentType()
Returns the content type of the document. (fixed value: "text/html")

Specified by:
getContentType in interface IDocument
Returns:
content type

getContentLength

public long getContentLength()
Returns the length of the content as integer.

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

getContent

public java.io.InputStream getContent()
Returns a java.io.InputStream representing the content of the document.

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

getCachingInfo

public java.lang.String getCachingInfo()
Returns a java.lang.String representing the caching info of the document. The output depends on the value set in the constructor.

Specified by:
getCachingInfo in interface IDocument
Returns:
When the cacheable value is set to true this method returns null. When the cacheable value is set to false the following string is returned: "Cache-Control: no-cache\r\n"+"Expires: " + RFC1123DateFormatter.format(new Date()) + "\r\n"