Tapestry is designed for flexibility; this extends beyond simply configuring the framework, and encompasses actually replacing or augmenting the implementation of the framework. If Tapestry doesn't do what you want it to, there are multiple paths for extending, changing and overriding its normal behavior. In some cases, it is necessary to subclass framework classes in order to alter behavior, but in many cases, it is possible to use an application extension.
Application extensions are JavaBeans declared in the application specification using
the <extension>
element. Each extension consists of a name, a Java class
to instantiate, and an optional configuration (that is, properties of the
bean may be set). The framework has a finite number of extension points. If an extension
bean with the correct name exists, it will be used at that extension point.
Your application may have its own set of extensions not related to Tapestry framework extension points. For example, you might have an application extension referenced from multiple pages to perform common operations such as JNDI lookups.
You may access application extensions via the engine's specification property. For example:
IEngine
engine = getEngine();IApplicationSpecification
specification = engine.getSpecification(); myExtension myExtension = (MyExtension) specification.getExtension("myExtension");
Each application extension used with an framework extension point must implement an interface particular to the extension point.
Application Extension Points
org.apache.tapestry.property-source
(IPropertySource
)This extension is fit into the configuration property search path, after the servlet context, but before JVM system properties. A typical use would be to access some set of configuration properties stored in a database.
org.apache.tapestry.request-decoder
(IRequestDecoder
)
A request decoder is used
to identify the actual server name, server port, scheme and request URI for the
request. In some configurations, a firewall may invalidate the values provided by
the actual HttpServletRequest
(the values reflect the internal server forwarded
to by the firewall, not the actual values used by the external client). A
request decoder knows how to determine the actual values.
org.apache.tapestry.monitor-factory
(IMonitorFactory
)An object that is used to create IMonitor
instances. Monitors
are informed about key application events (such as loading a page)
during the processing of a request.
The factory may create a new instance for the request, or may simply provide access to a shared instance.
If not specified, a default implementation is used (DefaultMonitorFactory
).
org.apache.tapestry.specification-resolver-delegate
(ISpecificationResolverDelegate
)An object which is used to find page and component specifications that are not located using the default search rules. The use of this is open-ended, but is generally useful in very advanced scenarios where specifications are stored externally (perhaps in a database), or constructed on the fly.
org.apache.tapestry.template-source-delegate
(ITemplateSourceDelegate
)An object which is used to find page or component templates that are not located using the default search rules. The use of this is open-ended, but is generally useful in very advanced scenarios where templates are stored externally (perhaps in a database), or constructed on the fly.
org.apache.tapestry.multipart-decoder
(IMultipartDecoder
)
Allows an alternate object to be responsible for decoding multipart requests (context
type multipart/form-data, used for file uploads). Generally, this is used to
configure an instance of DefaultMultipartDecoder
with non-default values for
the maximum upload size, threshold size (number of bytes before a temporary file is created
to store the) and repository directory (where temporary files are stored).
org.apache.tapestry.ognl-type-converter
Specifies an implementation of ognl.TypeConverter to be used for expression bindings. See OGNL's Type Converter documentation for further information on implementing a custom type converter.