Package com.opensymphony.module.sitemesh
Interface Page
- All Known Subinterfaces:
HTMLPage
- All Known Implementing Classes:
AbstractHTMLPage,AbstractPage,Content2HTMLPage,FastPage,PartialPageParserHtmlPage,PartialPageParserPage,TokenizedHTMLPage
public interface Page
The Page object wraps the contents of the original (undecorated) 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.
- Author:
- Joe Walnes
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddProperty(String name, String value) Manually add a property to page.getBody()Convenience method to return the contents of the<body>tag.booleangetBooleanProperty(String name) Get a property embedded into thePageas aboolean.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.javax.servlet.http.HttpServletRequestDeprecated.Since Servlet 2.4 API, this is unnecessary - just use the stand HttpServletRequest instance.getTitle()Get the Title of the document.booleanisPropertySet(String name) Determine whether a property embedded into thePagehas been set.voidsetRequest(javax.servlet.http.HttpServletRequest request) Create snapshot of Request.voidWrite the contents of the<body>tag.voidWrite the entire contents of thePage, in the format before it was parsed, to theWriter.
-
Method Details
-
writePage
Write the entire contents of thePage, in the format before it was parsed, to theWriter.- Parameters:
out- Writer to write to.- Throws:
IOException- Signals that an I/O exception has occurred.
-
getPage
String getPage()Convenience method to return the contents of thePagein its original format.- Returns:
- the page
- Since:
- 2.1.1
- See Also:
-
writeBody
Write the contents of the<body>tag.- Parameters:
out- the out- Throws:
IOException- Signals that an I/O exception has occurred.
-
getBody
String getBody()Convenience method to return the contents of the<body>tag.- Returns:
- the body
- Since:
- 2.1.1
- See Also:
-
getTitle
String getTitle()Get the Title of the document.- Returns:
- the title
-
getProperty
Get a property embedded into thePageas aString.- Parameters:
name- Name of property- Returns:
- Property value
-
getIntProperty
Get a property embedded into thePageas anint. Returns 0 if property not specified or not valid number.- Parameters:
name- Name of property- Returns:
- Property value
-
getLongProperty
Get a property embedded into thePageas along. Returns 0L if property not specified or not valid number.- Parameters:
name- Name of property- Returns:
- Property value
-
getBooleanProperty
Get a property embedded into thePageas aboolean. Returns true if value starts with '1', 't' or 'y' (case-insensitive) - otherwise returns false.- Parameters:
name- Name of property- Returns:
- Property value
-
isPropertySet
Determine whether a property embedded into thePagehas been set.- Parameters:
name- Name of property- Returns:
- Whether it has been set
-
getPropertyKeys
String[] getPropertyKeys()Get all available property keys for thePage.- Returns:
- Property keys
-
getProperties
Get aMaprepresenting all the properties in thePage.- Returns:
- Properties map
-
getRequest
Deprecated.Since Servlet 2.4 API, this is unnecessary - just use the stand HttpServletRequest instance.Return the request of the original page.- Returns:
- the request
-
setRequest
void setRequest(javax.servlet.http.HttpServletRequest request) Create snapshot of Request. Subsequent modifications to the request by the servlet container will not be returned bygetRequest()- Parameters:
request- the new request
-
addProperty
Manually add a property to page.- Parameters:
name- the namevalue- the value
-