|
|||||||||
| Home >> All >> org >> apache >> tapestry >> [ engine overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.tapestry.engine
Class AbstractEngine

java.lang.Objectorg.apache.tapestry.engine.AbstractEngine
- All Implemented Interfaces:
- java.util.EventListener, java.io.Externalizable, javax.servlet.http.HttpSessionBindingListener, org.apache.tapestry.IEngine, IEngineServiceView, java.io.Serializable
- Direct Known Subclasses:
- BaseEngine
- public abstract class AbstractEngine
- extends java.lang.Object
- implements org.apache.tapestry.IEngine, IEngineServiceView, java.io.Externalizable, javax.servlet.http.HttpSessionBindingListener
- extends java.lang.Object
Basis for building real Tapestry applications. Immediate subclasses provide different strategies for managing page state and other resources between request cycles.
Note: much of this description is in transition as part of Tapestry 3.1. All ad-hoc singletons and such are being replaced with HiveMind services.
Uses a shared instance of ITemplateSource,ISpecificationSource, IScriptSourceand IComponentMessagesSourcestored as attributes of the javax.servlet.ServletContext(they will be shared by all sessions).
An engine is designed to be very lightweight. Particularily, it should never hold references to any org.apache.tapestry.IPageor org.apache.tapestry.IComponentobjects. The entire system is based upon being able to quickly rebuild the state of any page(s).
Where possible, instance variables should be transient. They can be restored inside
setupForRequest(RequestContext) 55 .
In practice, a subclass (usually BaseEngine) is used without subclassing. Instead, a
visit object is specified. To facilitate this, the application specification may include a
property, org.apache.tapestry.visit-class which is the class name to instantiate
when a visit object is first needed. See createVisit(IRequestCycle) 55 for more details.
Some of the classes' behavior is controlled by JVM system properties (typically only used during development):
| Property | Description |
|---|---|
| org.apache.tapestry.enable-reset-service | If true, enabled an additional service, reset, that allow page, specification and template
caches to be cleared on demand. See isResetServiceEnabled() 55 . |
| org.apache.tapestry.disable-caching | If true, then the page, specification, template and script caches will be cleared after each request. This slows things down, but ensures that the latest versions of such files are used. Care should be taken that the source directories for the files preceeds any versions of the files available in JARs or WARs. |
| Field Summary | |
static com.cortexeb.tools.clover.d |
__CLOVER_71_0
|
private java.lang.String |
_clientAddress
|
private java.lang.String |
_contextPath
|
private boolean |
_dirty
Set to true when there is a (potential) change to the internal state of the engine, set to false when the engine is stored into the javax.servlet.http.HttpSession. |
private static boolean |
_disableCaching
If true (set from the JVM system parameter org.apache.tapestry.disable-caching)
then the cache of pages, specifications and template will be cleared after each request. |
private java.lang.Object |
_global
The globally shared application object. |
private org.apache.tapestry.services.Infrastructure |
_infrastructure
The link to the world of HiveMind services. |
private org.apache.tapestry.listener.ListenerMap |
_listeners
|
private java.util.Locale |
_locale
The curent locale for the engine, which may be changed at any time. |
private boolean |
_localeChanged
Set by setLocale(Locale) 55 when the locale is changed; this allows the locale cookie
to be updated. |
private IMonitorFactory |
_monitorFactory
The instance of IMonitorFactoryused to create a monitor. |
private static boolean |
_resetServiceEnabled
If true (set from JVM system parameter org.apache.tapestry.enable-reset-service)
then the reset service will be enabled, allowing the cache of pages, specifications and
template to be cleared on demand. |
private java.lang.String |
_servletPath
|
private java.lang.String |
_sessionId
|
private boolean |
_stateful
|
private java.lang.Object |
_visit
An object used to contain application-specific server side state. |
static java.lang.String |
DEFAULT_OUTPUT_ENCODING
The default encoding that will be used when generating the output. |
static java.lang.String |
GLOBAL_NAME
The base name for the servlet context key used to store the application-defined Global object, if any. |
private static org.apache.commons.logging.Log |
LOG
|
static java.lang.String |
OUTPUT_ENCODING_PROPERTY_NAME
The name of the application property that will be used to determine the encoding to use when generating the output |
private static long |
serialVersionUID
|
static java.lang.String |
VISIT_CLASS_PROPERTY_NAME
The name of the application specification property used to specify the class of the visit object. |
| Fields inherited from interface org.apache.tapestry.IEngine |
EXCEPTION_PAGE, HOME_PAGE, STALE_LINK_PAGE, STALE_SESSION_PAGE |
| Constructor Summary | |
AbstractEngine()
|
|
| Method Summary | |
protected void |
activateExceptionPage(org.apache.tapestry.IRequestCycle cycle,
org.apache.tapestry.request.ResponseOutputStream output,
java.lang.Throwable cause)
Sets the Exception page's exception property, then renders the Exception page. |
protected abstract void |
cleanupAfterRequest(org.apache.tapestry.IRequestCycle cycle)
Invoked at the end of the request cycle to release any resources specific to the request cycle. |
void |
clearCachedData()
Discards all cached pages, component specifications and templates. |
protected java.lang.Object |
createGlobal(org.apache.tapestry.request.RequestContext context)
Creates the shared Global object. |
protected org.apache.tapestry.IRequestCycle |
createRequestCycle(org.apache.tapestry.request.RequestContext context,
IEngineService service,
IMonitor monitor)
Invoked from service(RequestContext) 55 to create an instance of org.apache.tapestry.IRequestCycle
for the current request. |
protected java.lang.Object |
createVisit(org.apache.tapestry.IRequestCycle cycle)
Invoked to lazily create a new visit object when it is first referenced (by getVisit(IRequestCycle) 55 ). |
protected void |
extendDescription(org.apache.commons.lang.builder.ToStringBuilder builder)
Extends the description of the class generated by toString() 55 . |
protected java.lang.String |
extractServiceName(org.apache.tapestry.request.RequestContext context)
Invoked from service(RequestContext) 55 to extract, from the URL, the name of the
service. |
abstract java.util.Collection |
getActivePageNames()
Implemented by subclasses to return the names of the active pages (pages for which recorders exist). |
org.apache.hivemind.ClassResolver |
getClassResolver()
Returns an object that can resolve resources and classes. |
IComponentClassEnhancer |
getComponentClassEnhancer()
Returns an object that can create enhanced versions of component classes. |
org.apache.tapestry.services.ComponentMessagesSource |
getComponentMessagesSource()
Returns a shared object that allows components to find their set of localized strings. |
java.lang.String |
getContextPath()
Returns the context path, the prefix to apply to any URLs so that they are recognized as belonging to the Servlet 2.2 context. |
org.apache.tapestry.services.DataSqueezer |
getDataSqueezer()
Returns a shared instance of org.apache.tapestry.util.io.DataSqueezerImpl. |
protected java.lang.String |
getDefaultOutputEncoding()
The encoding to be used if none has been defined using the output encoding property. |
protected java.lang.String |
getExceptionPageName()
|
java.lang.Object |
getGlobal()
Returns the global object for the application. |
boolean |
getHasVisit()
|
org.apache.tapestry.listener.ListenerMap |
getListeners()
Allows subclasses to include listener methods easily. |
java.util.Locale |
getLocale()
Returns the locale for the engine. |
IMonitor |
getMonitor(org.apache.tapestry.request.RequestContext context)
Overriden in subclasses that support monitoring. |
java.lang.String |
getOutputEncoding()
Returns the encoding to be used to generate the servlet responses and accept the servlet requests. |
IPageSource |
getPageSource()
Returns the object used to load a page from its specification. |
org.apache.tapestry.services.ObjectPool |
getPool()
Returns a org.apache.tapestry.util.pool.Pool that is used to store all manner of objects that are needed throughout the system. |
IPropertySource |
getPropertySource()
Returns a IPropertySource that should be used to obtain configuration data. |
IScriptSource |
getScriptSource()
Returns a source for parsed org.apache.tapestry.IScripts. |
IEngineService |
getService(java.lang.String name)
Returns a service with the given name. |
java.lang.String |
getServletPath()
Returns the URL path that corresponds to the servlet for the application. |
org.apache.tapestry.spec.IApplicationSpecification |
getSpecification()
Returns the application specification that defines the application and its pages. |
ISpecificationSource |
getSpecificationSource()
Returns the source of all component specifications for the application. |
protected java.lang.String |
getStaleLinkPageName()
|
protected java.lang.String |
getStaleSessionPageName()
|
org.apache.tapestry.services.TemplateSource |
getTemplateSource()
Returns the source for HTML templates. |
java.lang.Object |
getVisit()
Gets the visit object, if it has been created already. |
java.lang.Object |
getVisit(org.apache.tapestry.IRequestCycle cycle)
Gets the visit object, invoking createVisit(IRequestCycle) 55 to create it lazily if
needed. |
protected void |
handlePageRedirectException(org.apache.tapestry.PageRedirectException ex,
org.apache.tapestry.IRequestCycle cycle,
org.apache.tapestry.request.ResponseOutputStream output)
Handles org.apache.tapestry.PageRedirectExceptionwhich involves executing IPage.validate(IRequestCycle)> IPage.validate(IRequestCycle) 55 on the target page (of the exception), until either a
loop is found, or a page succesfully validates and can be activated. |
protected void |
handleRedirectException(org.apache.tapestry.IRequestCycle cycle,
org.apache.tapestry.RedirectException ex)
Invoked when a org.apache.tapestry.RedirectExceptionis thrown during the processing of a request. |
protected void |
handleStaleLinkException(org.apache.tapestry.StaleLinkException ex,
org.apache.tapestry.IRequestCycle cycle,
org.apache.tapestry.request.ResponseOutputStream output)
Invoked by service(RequestContext) 55 if a org.apache.tapestry.StaleLinkExceptionis thrown by the
service. |
protected void |
handleStaleSessionException(org.apache.tapestry.StaleSessionException ex,
org.apache.tapestry.IRequestCycle cycle,
org.apache.tapestry.request.ResponseOutputStream output)
Invoked by service(RequestContext) 55 if a org.apache.tapestry.StaleSessionExceptionis thrown by
the service. |
boolean |
isDirty()
Returns true if the engine has (potentially) changed state since the last time it was stored into the javax.servlet.http.HttpSession. |
boolean |
isResetServiceEnabled()
Returns true if the reset service is curently enabled. |
boolean |
isStateful()
Returns true if the engine has state and, therefore, should be stored in the HttpSession. |
protected void |
markDirty()
Invoked to set the dirty flag, indicating that the engine should be stored into the javax.servlet.http.HttpSession. |
void |
readExternal(java.io.ObjectInput in)
Reads the state serialized by writeExternal(ObjectOutput) 55 . |
protected void |
redirect(java.lang.String pageName,
org.apache.tapestry.IRequestCycle cycle,
org.apache.tapestry.request.ResponseOutputStream out,
org.apache.hivemind.ApplicationRuntimeException exception)
Invoked, typically, when an exception occurs while servicing the request. |
void |
renderResponse(org.apache.tapestry.IRequestCycle cycle,
org.apache.tapestry.request.ResponseOutputStream output)
Invoked by a service to force the page selected by the org.apache.tapestry.IRequestCycle to be renderred. |
void |
reportException(java.lang.String reportTitle,
java.lang.Throwable ex)
Writes a detailed report of the exception to System.err. |
void |
restart(org.apache.tapestry.IRequestCycle cycle)
Invalidates the session, then redirects the client web browser to the servlet's prefix, starting a new visit. |
boolean |
service(org.apache.tapestry.request.RequestContext context)
Delegate method for the servlet. |
void |
setLocale(java.util.Locale value)
Changes the locale for the engine. |
protected void |
setStateful()
Invoked by subclasses to indicate that some state must now be stored in the engine (and that the engine should now be stored in the HttpSession). |
protected void |
setupForRequest(org.apache.tapestry.request.RequestContext context)
Invoked from service(RequestContext) 55 to ensure that the engine's instance variables
are setup. |
void |
setVisit(java.lang.Object value)
Updates the visit object and sets the dirty flag 55 . |
java.lang.String |
toString()
Generates a description of the instance. |
void |
valueBound(javax.servlet.http.HttpSessionBindingEvent arg0)
Clears the dirty flag when a engine is stored into the javax.servlet.http.HttpSession. |
void |
valueUnbound(javax.servlet.http.HttpSessionBindingEvent arg0)
Does nothing. |
void |
writeExternal(java.io.ObjectOutput out)
Writes the following properties: locale name (Locale.toString()> Locale.toString() 55 )
visit
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.tapestry.IEngine |
createPageRecorder, forgetPage, getPageRecorder |
| Field Detail |
__CLOVER_71_0
public static com.cortexeb.tools.clover.d __CLOVER_71_0
LOG
private static final org.apache.commons.logging.Log LOG
serialVersionUID
private static final long serialVersionUID
- Since:
- 2.0.4
- See Also:
- Constant Field Values
_infrastructure
private transient org.apache.tapestry.services.Infrastructure _infrastructure
- The link to the world of HiveMind services.
- Since:
- 3.1
_contextPath
private transient java.lang.String _contextPath
_servletPath
private transient java.lang.String _servletPath
_clientAddress
private transient java.lang.String _clientAddress
_sessionId
private transient java.lang.String _sessionId
_stateful
private transient boolean _stateful
_listeners
private transient org.apache.tapestry.listener.ListenerMap _listeners
_visit
private java.lang.Object _visit
- An object used to contain application-specific server side state.
_global
private transient java.lang.Object _global
- The globally shared application object. Typically, this is created when first needed, shared
between sessions and engines, and stored in the javax.servlet.ServletContext.
- Since:
- 2.3
GLOBAL_NAME
public static final java.lang.String GLOBAL_NAME
- The base name for the servlet context key used to store the application-defined Global
object, if any.
- Since:
- 2.3
- See Also:
- Constant Field Values
OUTPUT_ENCODING_PROPERTY_NAME
public static final java.lang.String OUTPUT_ENCODING_PROPERTY_NAME
- The name of the application property that will be used to determine the encoding to use when
generating the output
- Since:
- 3.0
- See Also:
- Constant Field Values
DEFAULT_OUTPUT_ENCODING
public static final java.lang.String DEFAULT_OUTPUT_ENCODING
- The default encoding that will be used when generating the output. It is used if no output
encoding property has been specified.
- Since:
- 3.0
- See Also:
- Constant Field Values
_locale
private java.util.Locale _locale
- The curent locale for the engine, which may be changed at any time.
_localeChanged
private boolean _localeChanged
- Set by
setLocale(Locale)55 when the locale is changed; this allows the locale cookie to be updated.
VISIT_CLASS_PROPERTY_NAME
public static final java.lang.String VISIT_CLASS_PROPERTY_NAME
- The name of the application specification property used to specify the class of the visit
object.
- See Also:
- Constant Field Values
_resetServiceEnabled
private static final boolean _resetServiceEnabled
- If true (set from JVM system parameter
org.apache.tapestry.enable-reset-service) then the reset service will be enabled, allowing the cache of pages, specifications and template to be cleared on demand.
_disableCaching
private static final boolean _disableCaching
- If true (set from the JVM system parameter
org.apache.tapestry.disable-caching) then the cache of pages, specifications and template will be cleared after each request.
_dirty
private transient boolean _dirty
- Set to true when there is a (potential) change to the internal state of the engine, set to
false when the engine is stored into the javax.servlet.http.HttpSession.
- Since:
- 3.0
_monitorFactory
private transient IMonitorFactory _monitorFactory
- The instance of IMonitorFactoryused to create a monitor.
- Since:
- 3.0
| Constructor Detail |
AbstractEngine
public AbstractEngine()
| Method Detail |
activateExceptionPage
protected void activateExceptionPage(org.apache.tapestry.IRequestCycle cycle, org.apache.tapestry.request.ResponseOutputStream output, java.lang.Throwable cause) throws javax.servlet.ServletException
- Sets the Exception page's exception property, then renders the Exception page.
If the render throws an exception, then copious output is sent to
System.errand a javax.servlet.ServletExceptionis thrown.
reportException
public void reportException(java.lang.String reportTitle, java.lang.Throwable ex)
- Writes a detailed report of the exception to
System.err.- Specified by:
reportExceptionin interfaceIEngineServiceView
cleanupAfterRequest
protected abstract void cleanupAfterRequest(org.apache.tapestry.IRequestCycle cycle)
- Invoked at the end of the request cycle to release any resources specific to the request
cycle.
extendDescription
protected void extendDescription(org.apache.commons.lang.builder.ToStringBuilder builder)
- Extends the description of the class generated by
toString()55 . If a subclass adds additional instance variables that should be described in the instance description, it may overide this method. This implementation does nothing.
getLocale
public java.util.Locale getLocale()
- Returns the locale for the engine. This is initially set by the org.apache.tapestry.ApplicationServlet
but may be updated by the application.
- Specified by:
getLocalein interfaceorg.apache.tapestry.IEngine
getMonitor
public IMonitor getMonitor(org.apache.tapestry.request.RequestContext context)
- Overriden in subclasses that support monitoring. Should create and return an instance of
IMonitorthat is appropriate for the request cycle described by the
org.apache.tapestry.request.RequestContext.
The monitor is used to create a RequestCycle.
This implementation uses a IMonitorFactoryto create the monitor instance. The factory is provided as an application extension. If the application extension does not exist, DefaultMonitorFactoryis used.
As of release 3.0, this method should not return null.
getPageSource
public IPageSource getPageSource()
- Description copied from interface:
org.apache.tapestry.IEngine - Returns the object used to load a page from its specification.
- Specified by:
getPageSourcein interfaceorg.apache.tapestry.IEngine
getService
public IEngineService getService(java.lang.String name)
- Returns a service with the given name.
- Specified by:
getServicein interfaceorg.apache.tapestry.IEngine
getServletPath
public java.lang.String getServletPath()
- Description copied from interface:
org.apache.tapestry.IEngine - Returns the URL path that corresponds to the servlet for the application.
This is required by instances of IEngineService that need
to construct URLs for the application. This value will include
the context path.
- Specified by:
getServletPathin interfaceorg.apache.tapestry.IEngine
getContextPath
public java.lang.String getContextPath()
- Returns the context path, the prefix to apply to any URLs so that they are recognized as
belonging to the Servlet 2.2 context.
- Specified by:
getContextPathin interfaceorg.apache.tapestry.IEngine
getSpecification
public org.apache.tapestry.spec.IApplicationSpecification getSpecification()
- Description copied from interface:
org.apache.tapestry.IEngine - Returns the application specification that defines the application
and its pages.
- Specified by:
getSpecificationin interfaceorg.apache.tapestry.IEngine
getSpecificationSource
public ISpecificationSource getSpecificationSource()
- Description copied from interface:
org.apache.tapestry.IEngine - Returns the source of all component specifications for the application.
The source is shared between sessions.
- Specified by:
getSpecificationSourcein interfaceorg.apache.tapestry.IEngine
getTemplateSource
public org.apache.tapestry.services.TemplateSource getTemplateSource()
- Description copied from interface:
org.apache.tapestry.IEngine - Returns the source for HTML templates.
- Specified by:
getTemplateSourcein interfaceorg.apache.tapestry.IEngine
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
- Reads the state serialized by
writeExternal(ObjectOutput)55 .This always set the stateful flag. By default, a deserialized session is stateful (else, it would not have been serialized).
- Specified by:
readExternalin interfacejava.io.Externalizable
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
- Writes the following properties:
- locale name (Locale.toString()>
Locale.toString()55 ) - visit
- Specified by:
writeExternalin interfacejava.io.Externalizable
- locale name (Locale.toString()>
redirect
protected void redirect(java.lang.String pageName, org.apache.tapestry.IRequestCycle cycle, org.apache.tapestry.request.ResponseOutputStream out, org.apache.hivemind.ApplicationRuntimeException exception) throws java.io.IOException, javax.servlet.ServletException
- Invoked, typically, when an exception occurs while servicing the request. This method resets
the output, sets the new page and renders it.
renderResponse
public void renderResponse(org.apache.tapestry.IRequestCycle cycle, org.apache.tapestry.request.ResponseOutputStream output) throws javax.servlet.ServletException, java.io.IOException
- Description copied from interface:
IEngineServiceView - Invoked by a service to force the page selected by the org.apache.tapestry.IRequestCycle
to be renderred. This takes care of a number of bookkeeping issues, such
as committing changes in page recorders.
- Specified by:
renderResponsein interfaceIEngineServiceView
restart
public void restart(org.apache.tapestry.IRequestCycle cycle) throws java.io.IOException
- Invalidates the session, then redirects the client web browser to the servlet's prefix,
starting a new visit.
Subclasses should perform their own restart (if necessary, which is rarely) before invoking this implementation.
- Specified by:
restartin interfaceIEngineServiceView
service
public boolean service(org.apache.tapestry.request.RequestContext context) throws javax.servlet.ServletException, java.io.IOException
- Delegate method for the servlet. Services the request.
- Specified by:
servicein interfaceorg.apache.tapestry.IEngine
handlePageRedirectException
protected void handlePageRedirectException(org.apache.tapestry.PageRedirectException ex, org.apache.tapestry.IRequestCycle cycle, org.apache.tapestry.request.ResponseOutputStream output) throws java.io.IOException, javax.servlet.ServletException
- Handles org.apache.tapestry.PageRedirectExceptionwhich involves executing
IPage.validate(IRequestCycle)>
IPage.validate(IRequestCycle)55 on the target page (of the exception), until either a loop is found, or a page succesfully validates and can be activated.This should generally not be overriden in subclasses.
- Since:
- 3.0
createRequestCycle
protected org.apache.tapestry.IRequestCycle createRequestCycle(org.apache.tapestry.request.RequestContext context, IEngineService service, IMonitor monitor)
- Invoked from
service(RequestContext)55 to create an instance of org.apache.tapestry.IRequestCycle for the current request. This implementation creates an returns an instance of RequestCycle.- Since:
- 3.0
handleStaleLinkException
protected void handleStaleLinkException(org.apache.tapestry.StaleLinkException ex, org.apache.tapestry.IRequestCycle cycle, org.apache.tapestry.request.ResponseOutputStream output) throws java.io.IOException, javax.servlet.ServletException
- Invoked by
service(RequestContext)55 if a org.apache.tapestry.StaleLinkExceptionis thrown by the service. This implementation sets the message property of the StaleLink page to the message provided in the exception, then invokesredirect(String, IRequestCycle, ResponseOutputStream, ApplicationRuntimeException)55 to render the StaleLink page.Subclasses may overide this method (without invoking this implementation). A common practice is to present an error message on the application's Home page.
Alternately, the application may provide its own version of the StaleLink page, overriding the framework's implementation (probably a good idea, because the default page hints at "application errors" and isn't localized). The overriding StaleLink implementation must implement a message property of type String.
- Since:
- 0.2.10
handleStaleSessionException
protected void handleStaleSessionException(org.apache.tapestry.StaleSessionException ex, org.apache.tapestry.IRequestCycle cycle, org.apache.tapestry.request.ResponseOutputStream output) throws java.io.IOException, javax.servlet.ServletException
- Invoked by
service(RequestContext)55 if a org.apache.tapestry.StaleSessionExceptionis thrown by the service. This implementation invokesredirect(String, IRequestCycle, ResponseOutputStream, ApplicationRuntimeException)55 to render the StaleSession page.Subclasses may overide this method (without invoking this implementation). A common practice is to present an eror message on the application's Home page.
- Since:
- 0.2.10
clearCachedData
public void clearCachedData()
- Discards all cached pages, component specifications and templates. Subclasses who override
this method should invoke this implementation as well.
- Specified by:
clearCachedDatain interfaceIEngineServiceView
- Since:
- 1.0.1
setLocale
public void setLocale(java.util.Locale value)
- Changes the locale for the engine.
- Specified by:
setLocalein interfaceorg.apache.tapestry.IEngine
setupForRequest
protected void setupForRequest(org.apache.tapestry.request.RequestContext context)
- Invoked from
service(RequestContext)55 to ensure that the engine's instance variables are setup. This allows the application a chance to restore transient variables that will not have survived deserialization. Determines the servlet prefix: this is the base URL used by servicesto build URLs. It consists of two parts: the context path and the servlet path.The servlet path is retrieved from HttpServletRequest.getServletPath()>
HttpServletRequest.getServletPath()55 .The context path is retrieved from HttpServletRequest.getContextPath()>
HttpServletRequest.getContextPath()55 .The global object is retrieved from IEngine.getGlobal()>
IEngine.getGlobal()55 method.The final path is available via the
getServletPath()55 method.In addition, this method locates and/or creates the:
- IComponentClassEnhancer
- com.sun.jndi.ldap.pool.Pool
- ITemplateSource
- ISpecificationSource
- IPageSource
- IEngineServicejava.util.Map
IScriptSource - IComponentMessagesSource
- IPropertySource
This order is important, because some of the later shared objects depend on some of the earlier shared objects already having been located or created (especially pool 55 ).
Subclasses should invoke this implementation first, then perform their own setup.
getClassResolver
public org.apache.hivemind.ClassResolver getClassResolver()
- Description copied from interface:
org.apache.tapestry.IEngine - Returns an object that can resolve resources and classes.
- Specified by:
getClassResolverin interfaceorg.apache.tapestry.IEngine
toString
public java.lang.String toString()
- Generates a description of the instance. Invokes
extendDescription(ToStringBuilder)55 to fill in details about the instance.
isResetServiceEnabled
public boolean isResetServiceEnabled()
- Returns true if the reset service is curently enabled.
- Specified by:
isResetServiceEnabledin interfaceorg.apache.tapestry.IEngine
getActivePageNames
public abstract java.util.Collection getActivePageNames()
- Implemented by subclasses to return the names of the active pages (pages for which recorders
exist). May return the empty list, but should not return null.
getVisit
public java.lang.Object getVisit()
- Gets the visit object, if it has been created already.
If the visit is non-null then the
isDirty()55 flag is set (because the engine can't tell what the caller will do with the visit).- Specified by:
getVisitin interfaceorg.apache.tapestry.IEngine
getVisit
public java.lang.Object getVisit(org.apache.tapestry.IRequestCycle cycle)
- Gets the visit object, invoking
createVisit(IRequestCycle)55 to create it lazily if needed. If cycle is null, the visit will not be lazily created.After creating the visit, but before returning, the javax.servlet.http.HttpSessionwill be created, and
setStateful()55 will be invoked.Sets the
isDirty()55 flag, if the return value is not null.- Specified by:
getVisitin interfaceorg.apache.tapestry.IEngine
setVisit
public void setVisit(java.lang.Object value)
- Updates the visit object and sets the dirty flag 55 .
- Specified by:
setVisitin interfaceorg.apache.tapestry.IEngine
getHasVisit
public boolean getHasVisit()
createVisit
protected java.lang.Object createVisit(org.apache.tapestry.IRequestCycle cycle)
- Invoked to lazily create a new visit object when it is first referenced (by
getVisit(IRequestCycle)55 ). This implementation works by looking up the name of the class to instantiate in the configuration 55 .Subclasses may want to overide this method if some other means of instantiating a visit object is required.
getGlobal
public java.lang.Object getGlobal()
- Returns the global object for the application. The global object is created at the start of
the request (
setupForRequest(RequestContext)55 invokescreateGlobal(RequestContext)55 if needed), and is stored into the javax.servlet.ServletContext. All instances of the engine for the application share the global object; however, the global object is explicitly not replicated to other servers within a cluster.- Specified by:
getGlobalin interfaceorg.apache.tapestry.IEngine
- Since:
- 2.3
getScriptSource
public IScriptSource getScriptSource()
- Description copied from interface:
org.apache.tapestry.IEngine - Returns a source for parsed
org.apache.tapestry.IScripts. The source is
shared between all sessions.
- Specified by:
getScriptSourcein interfaceorg.apache.tapestry.IEngine
isStateful
public boolean isStateful()
- Description copied from interface:
org.apache.tapestry.IEngine - Returns true if the engine has state and, therefore, should be stored
in the HttpSession. This starts as false, but becomes true when
the engine requires state (such as when a visit object is created,
or when a peristent page property is set).
- Specified by:
isStatefulin interfaceorg.apache.tapestry.IEngine
setStateful
protected void setStateful()
- Invoked by subclasses to indicate that some state must now be stored in the engine (and that
the engine should now be stored in the HttpSession). The caller is responsible for actually
creating the HttpSession (it will have access to the org.apache.tapestry.request.RequestContext).
- Since:
- 1.0.2
getListeners
public org.apache.tapestry.listener.ListenerMap getListeners()
- Allows subclasses to include listener methods easily.
- Since:
- 1.0.2
handleRedirectException
protected void handleRedirectException(org.apache.tapestry.IRequestCycle cycle, org.apache.tapestry.RedirectException ex)
- Invoked when a org.apache.tapestry.RedirectExceptionis thrown during the processing of a request.
- Since:
- 2.2
getComponentMessagesSource
public org.apache.tapestry.services.ComponentMessagesSource getComponentMessagesSource()
- Description copied from interface:
org.apache.tapestry.IEngine - Returns a shared object that allows components to find
their set of localized strings.
- Specified by:
getComponentMessagesSourcein interfaceorg.apache.tapestry.IEngine
- Since:
- 2.0.4
getDataSqueezer
public org.apache.tapestry.services.DataSqueezer getDataSqueezer()
- Description copied from interface:
org.apache.tapestry.IEngine - Returns a shared instance of org.apache.tapestry.util.io.DataSqueezerImpl.
- Specified by:
getDataSqueezerin interfaceorg.apache.tapestry.IEngine
extractServiceName
protected java.lang.String extractServiceName(org.apache.tapestry.request.RequestContext context)
- Invoked from
service(RequestContext)55 to extract, from the URL, the name of the service. The current implementation expects the first pathInfo element to be the service name. At some point in the future, the method of constructing and parsing URLs may be abstracted into a developer-selected class.Subclasses may override this method if the application defines specific services with unusual URL encoding rules.
This implementation simply extracts the value for query parameter Tapestry.SERVICE_QUERY_PARAMETER_NAME>
Tapestry.SERVICE_QUERY_PARAMETER_NAME55 and extracts the service name from that.For supporting the JSP tags, this method first checks for attribute Tapestry.TAG_SUPPORT_SERVICE_ATTRIBUTE>
Tapestry.TAG_SUPPORT_SERVICE_ATTRIBUTE55 . If non-null, then Tapestry.TAGSUPPORT_SERVICE>Tapestry.TAGSUPPORT_SERVICE55 is returned.- Since:
- 2.2
getPropertySource
public IPropertySource getPropertySource()
- Description copied from interface:
org.apache.tapestry.IEngine - Returns a IPropertySource that should be
used to obtain configuration data. The returned source represents
a search path that includes (at a minimum):
- Properties of the org.apache.tapestry.spec.ApplicationSpecification
- Initial Parameters of servlet (configured in the
web.xmldeployment descriptor) - Initial Parameter of the servlet context (also configured in
web.xml) - System properties (defined with the
-DJVM command line parameter) - Hard-coded "factory defaults" (for some properties)
- Specified by:
getPropertySourcein interfaceorg.apache.tapestry.IEngine
- Since:
- 2.3
getExceptionPageName
protected java.lang.String getExceptionPageName()
- Since:
- 3.0
getStaleLinkPageName
protected java.lang.String getStaleLinkPageName()
- Since:
- 3.0
getStaleSessionPageName
protected java.lang.String getStaleSessionPageName()
- Since:
- 3.0
createGlobal
protected java.lang.Object createGlobal(org.apache.tapestry.request.RequestContext context)
- Creates the shared Global object. This implementation looks for an configuration property,
org.apache.tapestry.global-class, and instantiates that class using a no-arguments constructor. If the property is not defined, a synchronized java.util.HashMapis created.- Since:
- 2.3
getPool
public org.apache.tapestry.services.ObjectPool getPool()
- Description copied from interface:
org.apache.tapestry.IEngine - Returns a org.apache.tapestry.util.pool.Pool that is used
to store all manner of objects that are needed throughout the system.
This is the best way to deal with objects that are both expensive to
create and not threadsafe. The reset service
will clear out this Pool.
- Specified by:
getPoolin interfaceorg.apache.tapestry.IEngine
getComponentClassEnhancer
public IComponentClassEnhancer getComponentClassEnhancer()
- Description copied from interface:
org.apache.tapestry.IEngine - Returns an object that can create enhanced versions of component classes.
- Specified by:
getComponentClassEnhancerin interfaceorg.apache.tapestry.IEngine
isDirty
public boolean isDirty()
- Returns true if the engine has (potentially) changed state since the last time it was stored
into the javax.servlet.http.HttpSession. Various events set this property to true.
- Since:
- 3.0
markDirty
protected void markDirty()
- Invoked to set the dirty flag, indicating that the engine should be stored into the
javax.servlet.http.HttpSession.
- Since:
- 3.0
valueBound
public void valueBound(javax.servlet.http.HttpSessionBindingEvent arg0)
- Clears the dirty flag when a engine is stored into the javax.servlet.http.HttpSession.
- Specified by:
valueBoundin interfacejavax.servlet.http.HttpSessionBindingListener
- Since:
- 3.0
valueUnbound
public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent arg0)
- Does nothing.
- Specified by:
valueUnboundin interfacejavax.servlet.http.HttpSessionBindingListener
- Since:
- 3.0
getDefaultOutputEncoding
protected java.lang.String getDefaultOutputEncoding()
- The encoding to be used if none has been defined using the output encoding property. Override
this method to change the default.
- Since:
- 3.0
getOutputEncoding
public java.lang.String getOutputEncoding()
- Returns the encoding to be used to generate the servlet responses and accept the servlet
requests. The encoding is defined using the org.apache.tapestry.output-encoding and is UTF-8
by default
- Specified by:
getOutputEncodingin interfaceorg.apache.tapestry.IEngine
- Since:
- 3.0
|
|||||||||
| Home >> All >> org >> apache >> tapestry >> [ engine overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.tapestry.engine.AbstractEngine