public abstract class AbstractPage extends java.lang.Object implements Page
Page
.
Contains base methods for storing and accessing page properties. *
Page
Modifier and Type | Field and Description |
---|---|
private java.util.Map |
properties
Map of all properties.
|
private javax.servlet.http.HttpServletRequest |
request
RequestURI of original Page.
|
private SitemeshBuffer |
sitemeshBuffer
Date of page contents.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractPage(SitemeshBuffer sitemeshBuffer) |
Modifier and Type | Method and Description |
---|---|
void |
addProperty(java.lang.String name,
java.lang.String value)
Add a property to the properties list.
|
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()
Return the request of the original page.
|
java.lang.String |
getTitle()
Return title of from "title" property.
|
boolean |
isPropertySet(java.lang.String name)
Determine whether a property embedded into the
Page has been set. |
protected static java.lang.String |
noNull(java.lang.String in)
Return String as is, or "" if null.
|
void |
setRequest(javax.servlet.http.HttpServletRequest request)
Create snapshot of Request.
|
abstract void |
writeBody(java.io.Writer out)
Write data of html
<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 . |
private final java.util.Map properties
private final SitemeshBuffer sitemeshBuffer
private javax.servlet.http.HttpServletRequest request
protected AbstractPage(SitemeshBuffer sitemeshBuffer)
public void writePage(java.io.Writer out) throws java.io.IOException
Page
Page
, in the format before
it was parsed, to the Writer
.public java.lang.String getPage()
Page
Page
in its original format.getPage
in interface Page
Page.writePage(java.io.Writer)
public abstract void writeBody(java.io.Writer out) throws java.io.IOException
<body>
tag.
Must be implemented. Data written should not actually contain the body tags, but all the data in between.
public java.lang.String getBody()
Page
<body>
tag.getBody
in interface Page
Page.writeBody(java.io.Writer)
public java.lang.String getTitle()
public java.lang.String getProperty(java.lang.String name)
Page
Page
as a String
.getProperty
in interface Page
name
- Name of propertypublic int getIntProperty(java.lang.String name)
Page
Page
as an int
.
Returns 0 if property not specified or not valid number.getIntProperty
in interface Page
name
- Name of propertypublic long getLongProperty(java.lang.String name)
Page
Page
as a long
.
Returns 0L if property not specified or not valid number.getLongProperty
in interface Page
name
- Name of propertypublic boolean getBooleanProperty(java.lang.String name)
Page
Page
as a boolean
.
Returns true if value starts with '1', 't' or 'y' (case-insensitive) -
otherwise returns false.getBooleanProperty
in interface Page
name
- Name of propertypublic boolean isPropertySet(java.lang.String name)
Page
Page
has been set.isPropertySet
in interface Page
name
- Name of propertypublic java.lang.String[] getPropertyKeys()
Page
Page
.getPropertyKeys
in interface Page
public java.util.Map getProperties()
Page
Map
representing all the properties in the Page
.getProperties
in interface Page
public javax.servlet.http.HttpServletRequest getRequest()
Page
getRequest
in interface Page
Page.getRequest()
public void setRequest(javax.servlet.http.HttpServletRequest request)
setRequest
in interface Page
Page.getRequest()
public void addProperty(java.lang.String name, java.lang.String value)
addProperty
in interface Page
name
- Name of propertyvalue
- Value of propertyprotected static java.lang.String noNull(java.lang.String in)