Class AbstractPage
java.lang.Object
com.opensymphony.module.sitemesh.parser.AbstractPage
- All Implemented Interfaces:
Page
- Direct Known Subclasses:
AbstractHTMLPage
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.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProperty(String name, String value) Add a property to the properties list.getBody()Convenience method to return the contents of the<body>tag.booleangetBooleanProperty(String name) Get a property embedded into thePageas aboolean.intLength of thePage, in the format before it was parsed.intgetIntProperty(String name) Get a property embedded into thePageas anint.longgetLongProperty(String name) Get a property embedded into thePageas along.getPage()Convenience method to return the contents of thePagein its original format.Get aMaprepresenting all the properties in thePage.getProperty(String name) Get a property embedded into thePageas aString.String[]Get all available property keys for thePage.jakarta.servlet.http.HttpServletRequestReturn the request of the original page.getTitle()Return title of from "title" property.booleanisPropertySet(String name) Determine whether a property embedded into thePagehas been set.protected static StringReturn String as is, or "" if null.voidsetRequest(jakarta.servlet.http.HttpServletRequest request) Create snapshot of Request.abstract voidWrite data of html<body>tag.voidWrite the entire contents of thePage, in the format before it was parsed, to theWriter.
-
Field Details
-
pageData
protected char[] pageDataDate of page contents.
-
-
Constructor Details
-
AbstractPage
public AbstractPage()
-
-
Method Details
-
writePage
Description copied from interface:PageWrite the entire contents of thePage, in the format before it was parsed, to theWriter.- Specified by:
writePagein interfacePage- Parameters:
out- Writer to write to.- Throws:
IOException- Rethrown if cannot write to writer.
-
getPage
Description copied from interface:PageConvenience method to return the contents of thePagein its original format. -
writeBody
Write data of html<body>tag.Must be implemented. Data written should not actually contain the body tags, but all the data in between.
- Specified by:
writeBodyin interfacePage- Throws:
IOException
-
getBody
Description copied from interface:PageConvenience method to return the contents of the<body>tag. -
getTitle
Return title of from "title" property. Never returns null. -
getContentLength
public int getContentLength()Description copied from interface:PageLength of thePage, in the format before it was parsed.- Specified by:
getContentLengthin interfacePage- Returns:
- Length of page data (in number of bytes).
-
getProperty
Description copied from interface:PageGet a property embedded into thePageas aString.- Specified by:
getPropertyin interfacePage- Parameters:
name- Name of property- Returns:
- Property value
-
getIntProperty
Description copied from interface:PageGet a property embedded into thePageas anint. Returns 0 if property not specified or not valid number.- Specified by:
getIntPropertyin interfacePage- Parameters:
name- Name of property- Returns:
- Property value
-
getLongProperty
Description copied from interface:PageGet a property embedded into thePageas along. Returns 0L if property not specified or not valid number.- Specified by:
getLongPropertyin interfacePage- Parameters:
name- Name of property- Returns:
- Property value
-
getBooleanProperty
Description copied from interface:PageGet a property embedded into thePageas aboolean. Returns true if value starts with '1', 't' or 'y' (case-insensitive) - otherwise returns false.- Specified by:
getBooleanPropertyin interfacePage- Parameters:
name- Name of property- Returns:
- Property value
-
isPropertySet
Description copied from interface:PageDetermine whether a property embedded into thePagehas been set.- Specified by:
isPropertySetin interfacePage- Parameters:
name- Name of property- Returns:
- Whether it has been set
-
getPropertyKeys
Description copied from interface:PageGet all available property keys for thePage.- Specified by:
getPropertyKeysin interfacePage- Returns:
- Property keys
-
getProperties
Description copied from interface:PageGet aMaprepresenting all the properties in thePage.- Specified by:
getPropertiesin interfacePage- Returns:
- Properties map
-
getRequest
public jakarta.servlet.http.HttpServletRequest getRequest()Description copied from interface:PageReturn the request of the original page.- Specified by:
getRequestin interfacePage- See Also:
-
setRequest
public void setRequest(jakarta.servlet.http.HttpServletRequest request) Create snapshot of Request.- Specified by:
setRequestin interfacePage- See Also:
-
addProperty
Add a property to the properties list.- Specified by:
addPropertyin interfacePage- Parameters:
name- Name of propertyvalue- Value of property
-
noNull
Return String as is, or "" if null. (Prevents NullPointerExceptions)
-