com.opensymphony.module.sitemesh
Interface Page

All Known Subinterfaces:
HTMLPage
All Known Implementing Classes:
AbstractHTMLPage, AbstractPage, Content2HTMLPage, FastPage, TokenizedHTMLPage

public interface Page

The Page object wraps the contents of the original (undecorated) page.

The original data in its entirity can be written using the writePage() methods. It may also contain a set of properties - these vary among different PageParser implementations.

Typically a Page is no use to a Decorator as it needs specific details relevant to the content-type of that page (e.g. HTML pages). The appropriate PageParser is responsible for returning extended implementations of pages such as HTMLPage which are of more use to the Decorator. New media types (e.g. WML) could be added to the system by extending Page and implementing an appropriate PageParser.

Version:
$Revision: 1.4 $
Author:
Joe Walnes

Method Summary
 void addProperty(String name, String value)
          Manually add a property to page.
 String getBody()
          Convenience method to return the contents of the <body> tag.
 boolean getBooleanProperty(String name)
          Get a property embedded into the Page as a boolean.
 int getContentLength()
          Length of the Page, in the format before it was parsed.
 int getIntProperty(String name)
          Get a property embedded into the Page as an int.
 long getLongProperty(String name)
          Get a property embedded into the Page as a long.
 String getPage()
          Convenience method to return the contents of the Page in its original format.
 Map getProperties()
          Get a Map representing all the properties in the Page.
 String getProperty(String name)
          Get a property embedded into the Page as a String.
 String[] getPropertyKeys()
          Get all available property keys for the Page.
 HttpServletRequest getRequest()
          Return the request of the original page.
 String getTitle()
          Get the Title of the document
 boolean isPropertySet(String name)
          Determine whether a property embedded into the Page has been set.
 void setRequest(HttpServletRequest request)
          Create snapshot of Request.
 void writeBody(Writer out)
          Write the contents of the <body> tag.
 void writePage(Writer out)
          Write the entire contents of the Page, in the format before it was parsed, to the Writer.
 

Method Detail

writePage

void writePage(Writer out)
               throws IOException
Write the entire contents of the Page, in the format before it was parsed, to the Writer.

Parameters:
out - Writer to write to.
Throws:
IOException - Rethrown if cannot write to writer.

getPage

String getPage()
Convenience method to return the contents of the Page in its original format.

Since:
2.1.1
See Also:
writePage(java.io.Writer)

writeBody

void writeBody(Writer out)
               throws IOException
Write the contents of the <body> tag.

Throws:
IOException

getBody

String getBody()
Convenience method to return the contents of the <body> tag.

Since:
2.1.1
See Also:
writeBody(java.io.Writer)

getTitle

String getTitle()
Get the Title of the document


getContentLength

int getContentLength()
Length of the Page, in the format before it was parsed.

Returns:
Length of page data (in number of bytes).

getProperty

String getProperty(String name)
Get a property embedded into the Page as a String.

Parameters:
name - Name of property
Returns:
Property value

getIntProperty

int getIntProperty(String name)
Get a property embedded into the Page as an int. Returns 0 if property not specified or not valid number.

Parameters:
name - Name of property
Returns:
Property value

getLongProperty

long getLongProperty(String name)
Get a property embedded into the Page as a long. Returns 0L if property not specified or not valid number.

Parameters:
name - Name of property
Returns:
Property value

getBooleanProperty

boolean getBooleanProperty(String name)
Get a property embedded into the Page as a boolean. Returns true if value starts with '1', 't' or 'y' (case-insensitive) - otherwise returns false.

Parameters:
name - Name of property
Returns:
Property value

isPropertySet

boolean isPropertySet(String name)
Determine whether a property embedded into the Page has been set.

Parameters:
name - Name of property
Returns:
Whether it has been set

getPropertyKeys

String[] getPropertyKeys()
Get all available property keys for the Page.

Returns:
Property keys

getProperties

Map getProperties()
Get a Map representing all the properties in the Page.

Returns:
Properties map

getRequest

HttpServletRequest getRequest()
Return the request of the original page.


setRequest

void setRequest(HttpServletRequest request)
Create snapshot of Request. Subsequent modifications to the request by the servlet container will not be returned by getRequest()


addProperty

void addProperty(String name,
                 String value)
Manually add a property to page.


www.opensymphony.com/sitemesh/