|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sitemesh.parser.AbstractPage
Abstract implementation of Page
.
Contains base methods for storing and accessing page properties.
Also stores pageData
as byte[] and implements write???()
methods.
Concrete implementations need only set the pageData
and
call addProperty(java.lang.String,java.lang.String)
to
add all the required information.
Page
Field Summary | |
protected byte[] |
pageData
Date of page contents. |
javax.servlet.http.HttpServletRequest |
request
RequestURI of original Page. |
Constructor Summary | |
AbstractPage()
|
Method Summary | |
protected void |
addProperty(java.lang.String name,
java.lang.String value)
Add a property to the properties list. |
boolean |
getBooleanProperty(java.lang.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(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[] |
getProperties(java.lang.String name)
Get properties embedded into the Page as a String[] . |
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 . |
int |
getPropertySize(java.lang.String name)
Determine the number of properties embedded into the Page with
a given name. |
javax.servlet.http.HttpServletRequest |
getRequest()
Return the request of the original page. |
boolean |
isPropertySet(java.lang.String name)
Determine whether a property embedded into the Page has been set. |
protected 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. |
boolean |
shouldCache()
Returns false. |
void |
writePage(java.io.OutputStream out)
Write the entire contents of the Page , in the format before
it was parsed, to the OutputStream . |
void |
writePage(java.io.Writer out)
Write the entire contents of the Page , in the format before
it was parsed, to the Writer . |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected byte[] pageData
public javax.servlet.http.HttpServletRequest request
Constructor Detail |
public AbstractPage()
Method Detail |
public void writePage(java.io.OutputStream out) throws java.io.IOException
Page
, in the format before
it was parsed, to the OutputStream
.out
- OutputStream to write to.Page.writePage(java.io.Writer)
public 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.Page.writePage(java.io.OutputStream)
public int getContentLength()
Page
, in the format before
it was parsed.public java.lang.String getProperty(java.lang.String name)
Page
as a String
.name
- Name of propertypublic int getIntProperty(java.lang.String name)
Page
as an int
.
Returns 0 if property not specified or not valid number.name
- Name of propertypublic long getLongProperty(java.lang.String name)
Page
as a long
.
Returns 0L if property not specified or not valid number.name
- Name of propertypublic boolean 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 propertypublic java.lang.String[] getProperties(java.lang.String name)
Page
as a String[]
.
Returns zero length array if no properties set.name
- Name of propertypublic boolean isPropertySet(java.lang.String name)
Page
has been set.name
- Name of propertypublic int getPropertySize(java.lang.String name)
Page
with
a given name.name
- Name of propertypublic java.lang.String[] getPropertyKeys()
Page
.public boolean shouldCache()
Page.shouldCache()
public javax.servlet.http.HttpServletRequest getRequest()
Page.getRequest()
public void setRequest(javax.servlet.http.HttpServletRequest request)
Page.getRequest()
protected void addProperty(java.lang.String name, java.lang.String value)
Duplicate keys are allowed... property will be given multiple values. Sub-classes should use this for adding properties to the page.
name
- Name of propertyvalue
- Value of propertyprotected java.lang.String noNull(java.lang.String in)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |