public class PageSource extends java.lang.Object implements IPageSource
PageSource, storing it into the ServletContextusing a
unique key (usually built from the application name).
The PageSource acts as a pool for IPageinstances. Pages are retrieved
from the pool using getPage(IRequestCycle, String, IMonitor)and are later returned to
the pool using releasePage(IPage).
TBD: Pooled pages stay forever. Need a strategy for cleaning up the pool, tracking which pages have been in the pool the longest, etc.
| Constructor and Description |
|---|
PageSource() |
| Modifier and Type | Method and Description |
|---|---|
protected MultiKey |
buildKey(IEngine engine,
java.lang.String pageName)
Builds a key for a named page in the application's current locale.
|
protected MultiKey |
buildKey(IPage page)
Builds a key from an existing page, using the page's name and locale.
|
org.apache.hivemind.ClassResolver |
getClassResolver() |
IPage |
getPage(IRequestCycle cycle,
java.lang.String pageName,
IMonitor monitor)
Gets the page from a pool, or otherwise loads the page.
|
void |
releasePage(IPage page)
Returns the page to the appropriate pool.
|
void |
setClassResolver(org.apache.hivemind.ClassResolver resolver) |
void |
setLoader(IPageLoader loader) |
void |
setPageSpecificationResolver(PageSpecificationResolver resolver) |
void |
setPool(ObjectPool pool) |
public PageSource()
public org.apache.hivemind.ClassResolver getClassResolver()
getClassResolver in interface IPageSourceprotected MultiKey buildKey(IEngine engine, java.lang.String pageName)
protected MultiKey buildKey(IPage page)
public IPage getPage(IRequestCycle cycle, java.lang.String pageName, IMonitor monitor)
getPage in interface IPageSourcecycle - the current request cyclepageName - the name of the page. May be qualified with a library id prefix, which may even be
nested. Unqualified names are searched for extensively in the application
namespace, and then in the framework namespace.monitor - informed of any page loading activityPageSpecificationResolver.resolve(IRequestCycle, String)public void releasePage(IPage page)
IPage.detach().releasePage in interface IPageSourcepublic void setPool(ObjectPool pool)
public void setClassResolver(org.apache.hivemind.ClassResolver resolver)
public void setPageSpecificationResolver(PageSpecificationResolver resolver)
public void setLoader(IPageLoader loader)