|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.module.sitemesh.parser.AbstractPage
public abstract class 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 char[] |
pageData
Date of page contents. |
private Map |
properties
Map of all properties. |
private HttpServletRequest |
request
RequestURI of original Page. |
Constructor Summary | |
---|---|
AbstractPage()
|
Method Summary | |
---|---|
void |
addProperty(String name,
String value)
Add a property to the properties list. |
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()
Return title of from "title" property. |
boolean |
isPropertySet(String name)
Determine whether a property embedded into the Page has been set. |
protected static String |
noNull(String in)
Return String as is, or "" if null. |
void |
setRequest(HttpServletRequest request)
Create snapshot of Request. |
abstract void |
writeBody(Writer out)
Write data of html <body> tag. |
void |
writePage(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 |
---|
private final Map properties
protected char[] pageData
private HttpServletRequest request
Constructor Detail |
---|
public AbstractPage()
Method Detail |
---|
public void writePage(Writer out) throws IOException
Page
Page
, in the format before
it was parsed, to the Writer
.
writePage
in interface Page
out
- Writer to write to.
IOException
- Rethrown if cannot write to writer.public String getPage()
Page
Page
in its original format.
getPage
in interface Page
Page.writePage(java.io.Writer)
public abstract void writeBody(Writer out) throws IOException
<body>
tag.
Must be implemented. Data written should not actually contain the body tags, but all the data in between.
writeBody
in interface Page
IOException
public String getBody()
Page
<body>
tag.
getBody
in interface Page
Page.writeBody(java.io.Writer)
public String getTitle()
getTitle
in interface Page
public int getContentLength()
Page
Page
, in the format before
it was parsed.
getContentLength
in interface Page
public String getProperty(String name)
Page
Page
as a String
.
getProperty
in interface Page
name
- Name of property
public int getIntProperty(String name)
Page
Page
as an int
.
Returns 0 if property not specified or not valid number.
getIntProperty
in interface Page
name
- Name of property
public long getLongProperty(String name)
Page
Page
as a long
.
Returns 0L if property not specified or not valid number.
getLongProperty
in interface Page
name
- Name of property
public boolean getBooleanProperty(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 property
public boolean isPropertySet(String name)
Page
Page
has been set.
isPropertySet
in interface Page
name
- Name of property
public String[] getPropertyKeys()
Page
Page
.
getPropertyKeys
in interface Page
public Map getProperties()
Page
Map
representing all the properties in the Page
.
getProperties
in interface Page
public HttpServletRequest getRequest()
Page
getRequest
in interface Page
Page.getRequest()
public void setRequest(HttpServletRequest request)
setRequest
in interface Page
Page.getRequest()
public void addProperty(String name, String value)
addProperty
in interface Page
name
- Name of propertyvalue
- Value of propertyprotected static String noNull(String in)
|
www.opensymphony.com/sitemesh/ | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |