Package com.opensymphony.module.sitemesh
Interface Page
-
- All Known Subinterfaces:
HTMLPage
- All Known Implementing Classes:
AbstractHTMLPage
,AbstractPage
,FastPage
,UnParsedPage
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 appropriatePageParser
is responsible for returning extended implementations of pages such asHTMLPage
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.2 $
- Author:
- Joe Walnes
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addProperty(java.lang.String name, java.lang.String value)
Manually add a property to page.boolean
getBooleanProperty(java.lang.String name)
Get a property embedded into thePage
as aboolean
.int
getContentLength()
Length of thePage
, in the format before it was parsed.int
getIntProperty(java.lang.String name)
Get a property embedded into thePage
as anint
.long
getLongProperty(java.lang.String name)
Get a property embedded into thePage
as along
.java.util.Map
getProperties()
Get aMap
representing all the properties in thePage
.java.lang.String
getProperty(java.lang.String name)
Get a property embedded into thePage
as aString
.java.lang.String[]
getPropertyKeys()
Get all available property keys for thePage
.javax.servlet.http.HttpServletRequest
getRequest()
Return the request of the original page.java.lang.String
getTitle()
Get the Title of the documentboolean
isPropertySet(java.lang.String name)
Determine whether a property embedded into thePage
has been set.void
setRequest(javax.servlet.http.HttpServletRequest request)
Create snapshot of Request.void
writeBody(java.io.Writer out)
Write the contents of the<body>
tag.void
writePage(java.io.Writer out)
Write the entire contents of thePage
, in the format before it was parsed, to theWriter
.
-
-
-
Method Detail
-
writePage
void writePage(java.io.Writer out) throws java.io.IOException
Write the entire contents of thePage
, in the format before it was parsed, to theWriter
.- Parameters:
out
- Writer to write to.- Throws:
java.io.IOException
- Rethrown if cannot write to writer.
-
writeBody
void writeBody(java.io.Writer out) throws java.io.IOException
Write the contents of the<body>
tag.- Throws:
java.io.IOException
-
getTitle
java.lang.String getTitle()
Get the Title of the document
-
getContentLength
int getContentLength()
Length of thePage
, in the format before it was parsed.- Returns:
- Length of page data (in number of bytes).
-
getProperty
java.lang.String getProperty(java.lang.String name)
Get a property embedded into thePage
as aString
.- Parameters:
name
- Name of property- Returns:
- Property value
-
getIntProperty
int getIntProperty(java.lang.String name)
Get a property embedded into thePage
as anint
. Returns 0 if property not specified or not valid number.- Parameters:
name
- Name of property- Returns:
- Property value
-
getLongProperty
long getLongProperty(java.lang.String name)
Get a property embedded into thePage
as along
. Returns 0L if property not specified or not valid number.- Parameters:
name
- Name of property- Returns:
- Property value
-
getBooleanProperty
boolean getBooleanProperty(java.lang.String name)
Get a property embedded into thePage
as aboolean
. 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(java.lang.String name)
Determine whether a property embedded into thePage
has been set.- Parameters:
name
- Name of property- Returns:
- Whether it has been set
-
getPropertyKeys
java.lang.String[] getPropertyKeys()
Get all available property keys for thePage
.- Returns:
- Property keys
-
getProperties
java.util.Map getProperties()
Get aMap
representing all the properties in thePage
.- Returns:
- Properties map
-
getRequest
javax.servlet.http.HttpServletRequest getRequest()
Return the request of the original page.
-
setRequest
void setRequest(javax.servlet.http.HttpServletRequest request)
Create snapshot of Request. Subsequent modifications to the request by the servlet container will not be returned bygetRequest()
-
addProperty
void addProperty(java.lang.String name, java.lang.String value)
Manually add a property to page.
-
-