nl.pbemengine.engine.ng.base.webserver
Class PrintContent

java.lang.Object
  extended by nl.pbemengine.engine.ng.base.webserver.PrintContent
All Implemented Interfaces:
Content
Direct Known Subclasses:
ShutdownContent

public class PrintContent
extends java.lang.Object
implements Content

A simple general-purpose implementation of the Content class, useful for displaying text-files such as HTML, XML or CSS files

Author:
Jeroen Steenbeeke

Constructor Summary
PrintContent(java.lang.String mime)
          Creates a new PrintContent
 
Method Summary
 java.util.Map<java.lang.String,java.lang.String> getCookies()
          Returns any cookies that should be set
 java.lang.String getMIMEType()
          Returns the MIME type for this content
 java.lang.String getPage()
          Returns the Page that this Content encapsulates
 byte[] getRawContent()
          Returns a RAW version of the content
 java.lang.String getReRouteAddr()
          Returns the page name this Content should re-route to, if any
 boolean isReadAble()
          Determines whether or not this type of content is readable
 void printAll(java.util.Collection<java.lang.String> data)
          Adds a collection of strings to the current content
 void printAll(java.lang.StringBuffer data)
           
 void println(java.lang.String text)
          Adds a line of text to the current content
 void setCookies(java.util.Map<java.lang.String,java.lang.String> cookies)
          Sets the cookies for this PrintContent object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrintContent

public PrintContent(java.lang.String mime)
Creates a new PrintContent

Parameters:
mime - The MIME-type for this page
Method Detail

isReadAble

public boolean isReadAble()
Determines whether or not this type of content is readable

Returns:
true if this content is readable, false if it should re-route to another page

getReRouteAddr

public java.lang.String getReRouteAddr()
Returns the page name this Content should re-route to, if any

Returns:
A String containing the address to re-route to, or null if none

getPage

public java.lang.String getPage()
Returns the Page that this Content encapsulates

Specified by:
getPage in interface Content
Returns:
A String containing this page, or null if this page should re-route

println

public void println(java.lang.String text)
Adds a line of text to the current content

Parameters:
text - The line to add

printAll

public void printAll(java.util.Collection<java.lang.String> data)
Adds a collection of strings to the current content

Parameters:
data - The Collection to add

printAll

public void printAll(java.lang.StringBuffer data)

getMIMEType

public java.lang.String getMIMEType()
Returns the MIME type for this content

Specified by:
getMIMEType in interface Content
Returns:
The MIME type for this content

getCookies

public java.util.Map<java.lang.String,java.lang.String> getCookies()
Returns any cookies that should be set

Specified by:
getCookies in interface Content
Returns:
A Map of Cookies (String key/value pairs)

setCookies

public void setCookies(java.util.Map<java.lang.String,java.lang.String> cookies)
Sets the cookies for this PrintContent object

Parameters:
cookies - The map of cookies

getRawContent

public byte[] getRawContent()
Description copied from interface: Content
Returns a RAW version of the content

Specified by:
getRawContent in interface Content
Returns:
An array of bytes with the content


Copyright © 2008. All Rights Reserved.