public interface IPage extends IComponent
Pages are created dynamically from thier class names (part of the
IComponentSpecification
).
IPageSource
,
IPageLoader
Modifier and Type | Method and Description |
---|---|
void |
addPageAttachListener(PageAttachListener listener) |
void |
addPageBeginRenderListener(PageBeginRenderListener listener) |
void |
addPageDetachListener(PageDetachListener listener) |
void |
addPageEndRenderListener(PageEndRenderListener listener) |
void |
addPageRenderListener(PageRenderListener listener)
Deprecated.
To be removed in 4.1 Use
addPageBeginRenderListener(PageBeginRenderListener) or
addPageEndRenderListener(PageEndRenderListener) . |
void |
addPageValidateListener(PageValidateListener listener) |
void |
attach(IEngine engine,
IRequestCycle cycle)
Attaches the page to the
engine . |
void |
beginPageRender()
Invoked before a partial render of the page occurs (this happens when rewinding a
Form within the page). |
void |
beginResponse(IMarkupWriter writer,
IRequestCycle cycle)
Invoked just before rendering of the page is initiated.
|
void |
detach()
Invoked on a page when it is no longer needed by the engine, just before is is returned to
the pool.
|
void |
endPageRender()
Invoked after a partial render of the page occurs (this happens when rewinding a
Form within the page). |
void |
firePageAttached()
Used to explicitly fire
PageAttachListener s for this page. |
ChangeObserver |
getChangeObserver()
Returns the object (effectively, an
IPageRecorder ) that
is notified of any changes to persistant properties of the page. |
IEngine |
getEngine()
Returns the
IEngine that the page is currently attached to. |
java.lang.Object |
getGlobal()
Deprecated.
To be removed in 4.1. Inject an application state object instead. Do not
attempt to inject property global.
|
java.util.Locale |
getLocale()
Returns the
Locale of the page. |
IComponent |
getNestedComponent(java.lang.String path)
Returns a particular component from within the page.
|
java.lang.String |
getPageName()
Returns the fully qualified name of the page, including its namespace prefix, if any.
|
IRequestCycle |
getRequestCycle()
Returns the current
IRequestCycle . |
ContentType |
getResponseContentType()
Invoked to obtain the content type to be used for the response.
|
java.lang.Object |
getVisit()
Deprecated.
To be removed in 4.1. Inject an application state object instead. Do not
attempt to inject property visit.
|
void |
removePageAttachListener(PageAttachListener listener) |
void |
removePageBeginRenderListener(PageBeginRenderListener listener) |
void |
removePageDetachListener(PageDetachListener listener) |
void |
removePageEndRenderListener(PageEndRenderListener listener) |
void |
removePageRenderListener(PageRenderListener listener)
Deprecated.
To be removed in 4.1. Use
removePageBeginRenderListener(PageBeginRenderListener) or
removePageEndRenderListener(PageEndRenderListener) . |
void |
removePageValidateListener(PageValidateListener listener) |
void |
renderPage(IMarkupWriter writer,
IRequestCycle cycle)
Invoked to render the entire page.
|
void |
setChangeObserver(ChangeObserver value) |
void |
setLocale(java.util.Locale value)
Updates the page's locale.
|
void |
setPageName(java.lang.String pageName)
Sets the name of the page.
|
void |
validate(IRequestCycle cycle)
Method invoked by the page, action and direct services to validate that the user is allowed
to visit the page.
|
addAsset, addBody, addComponent, enterActiveState, finishLoad, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainedComponent, getContainer, getExtendedId, getId, getIdPath, getListeners, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, isRendering, renderBody, setBinding, setContainedComponent, setContainer, setId, setNamespace, setPage, setProperty
void detach()
Classes should also reset any properties to default values (as if the instance was freshly instantiated).
IPageSource.releasePage(IPage)
ChangeObserver getChangeObserver()
IPageRecorder
) that
is notified of any changes to persistant properties of the page.java.util.Locale getLocale()
Locale
of the page. The locale may be used to determine what
template is used by the page and the components contained by the page.void setLocale(java.util.Locale value)
ApplicationRuntimeException
.java.lang.String getPageName()
void setPageName(java.lang.String pageName)
pageName
- fully qualified page name (including namespace prefix, if any)IComponent getNestedComponent(java.lang.String path)
org.apache.hivemind.ApplicationRuntimeException
- runtime exception thrown if the path does not identify a component.void attach(IEngine engine, IRequestCycle cycle)
engine
. This method is used when a pooled page is
claimed for use with a particular engine; it will stay attached to the engine until the end
of the current request cycle, then be returned to the pool.
This method will notify any PageAttachListener
s.
This method is rarely overriden; to initialize page properties before a render, implement the
PageBeginRenderListener
interface.
void firePageAttached()
PageAttachListener
s for this page. This is used when a page
is first loaded; The page loader attaches the newly created page instance before
the rest of the page and components is loaded. In order to have meaningful event
notifications when a page is first loaded (rather than pulled from the pool), it is necessary
to fire page attach listeners at the end of the load.void renderPage(IMarkupWriter writer, IRequestCycle cycle)
IRequestCycle.renderPage(IMarkupWriter writer)
.
The page performs a render using the following steps:
PageBeginRenderListener.pageBeginRender(org.apache.tapestry.event.PageEvent)
beginResponse(IMarkupWriter, IRequestCycle)
IRequestCycle.commitPageChanges()
(if not rewinding)
IRender.render(IMarkupWriter, IRequestCycle)
PageEndRenderListener.pageEndRender(org.apache.tapestry.event.PageEvent)
(this occurs even if a previous step throws an exception).
void beginPageRender()
Form
within the page). The page is expected to fire
appopriate events.void endPageRender()
Form
within the page). The page is expected to fire
appropriate events.void setChangeObserver(ChangeObserver value)
void validate(IRequestCycle cycle)
Most web applications have a concept of 'logging in' and pages that an anonymous (not logged in) user should not be able to visit directly. This method acts as the first line of defense against a malicous user hacking URLs.
Pages that should be protected will typically throw a , to redirect the user to an appropriate part of the system (such as, a login page).
Since 3.0, it is easiest to not override this method, but to implement the
PageValidateListener
interface instead.
ContentType getResponseContentType()
void beginResponse(IMarkupWriter writer, IRequestCycle cycle)
The timing of this explicitly before
page recorder
changes are committed.
Rendering occurs after the recorders are committed, when it is too late to make
changes to dynamic page properties.
IRequestCycle getRequestCycle()
IRequestCycle
. This is set when the page is loaded (or obtained
from the pool) and attached to the engine
.java.lang.Object getVisit()
java.lang.Object getGlobal()
Returns the global object, if it exists, or null if not defined.
void addPageRenderListener(PageRenderListener listener)
addPageBeginRenderListener(PageBeginRenderListener)
or
addPageEndRenderListener(PageEndRenderListener)
.void removePageRenderListener(PageRenderListener listener)
removePageBeginRenderListener(PageBeginRenderListener)
or
removePageEndRenderListener(PageEndRenderListener)
.void addPageBeginRenderListener(PageBeginRenderListener listener)
void removePageBeginRenderListener(PageBeginRenderListener listener)
void addPageEndRenderListener(PageEndRenderListener listener)
void removePageEndRenderListener(PageEndRenderListener listener)
void addPageDetachListener(PageDetachListener listener)
void removePageDetachListener(PageDetachListener listener)
void addPageValidateListener(PageValidateListener listener)
void removePageValidateListener(PageValidateListener listener)
void addPageAttachListener(PageAttachListener listener)
void removePageAttachListener(PageAttachListener listener)