public interface 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.
Modifier and Type | Method and Description |
---|---|
void |
addProperty(java.lang.String name,
java.lang.String value)
Manually add a property to page.
|
java.lang.String |
getBody()
Convenience method to return the contents of the
<body> tag. |
boolean |
getBooleanProperty(java.lang.String name)
Get a property embedded into the
Page as a boolean . |
int |
getIntProperty(java.lang.String name)
Get a property embedded into the
Page as an int . |
long |
getLongProperty(java.lang.String name)
Get a property embedded into the
Page as a long . |
java.lang.String |
getPage()
Convenience method to return the contents of the
Page in its original format. |
java.util.Map |
getProperties()
Get a
Map representing all the properties in the Page . |
java.lang.String |
getProperty(java.lang.String name)
Get a property embedded into the
Page as a String . |
java.lang.String[] |
getPropertyKeys()
Get all available property keys for the
Page . |
javax.servlet.http.HttpServletRequest |
getRequest()
Deprecated.
Since Servlet 2.4 API, this is unnecessary - just use the stand HttpServletRequest instance.
|
java.lang.String |
getTitle()
Get the Title of the document
|
boolean |
isPropertySet(java.lang.String name)
Determine whether a property embedded into the
Page 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 the
Page , in the format before
it was parsed, to the Writer . |
void writePage(java.io.Writer out) throws java.io.IOException
Page
, in the format before
it was parsed, to the Writer
.out
- Writer to write to.java.io.IOException
- Rethrown if cannot write to writer.java.lang.String getPage()
Page
in its original format.writePage(java.io.Writer)
void writeBody(java.io.Writer out) throws java.io.IOException
<body>
tag.java.io.IOException
java.lang.String getBody()
<body>
tag.writeBody(java.io.Writer)
java.lang.String getTitle()
java.lang.String getProperty(java.lang.String name)
Page
as a String
.name
- Name of propertyint getIntProperty(java.lang.String name)
Page
as an int
.
Returns 0 if property not specified or not valid number.name
- Name of propertylong getLongProperty(java.lang.String name)
Page
as a long
.
Returns 0L if property not specified or not valid number.name
- Name of propertyboolean getBooleanProperty(java.lang.String name)
Page
as a boolean
.
Returns true if value starts with '1', 't' or 'y' (case-insensitive) -
otherwise returns false.name
- Name of propertyboolean isPropertySet(java.lang.String name)
Page
has been set.name
- Name of propertyjava.lang.String[] getPropertyKeys()
Page
.java.util.Map getProperties()
Map
representing all the properties in the Page
.javax.servlet.http.HttpServletRequest getRequest()
void setRequest(javax.servlet.http.HttpServletRequest request)
getRequest()
void addProperty(java.lang.String name, java.lang.String value)