This project has retired. For details please refer to its Attic page.
Apache Tiles - Framework - Tiles Extension Points

Tiles Extension Points

Tiles can be extended in different aspects, depending on the task of each aspect.

Tiles Container

The Tiles container is the object responsible of loading and rendering all Tiles artifacts. It is not created directly, but through a TilesContainerFactory. The default implementation is BasicTilesContainer.

It is unlikely that you need to customize your Tiles container (and container factory) and we suggest to use the default container factory.

As an exception, you can use KeyedDefinitionsFactoryTilesContainerFactory that allows to create multiple definitions factory for different "keys".

Tiles Application Context Factory

The TilesApplicationContext interface is used to abstract the Tiles context from the particular technology. The same instance will be used in the whole application. It is used to:

  • obtain application-scoped attributes;
  • obtain initialization parameters;
  • load resources.

The AbstractTilesApplicationContextFactory abstract factory is used to create instances of the class above.

The default implementation, ChainedTilesApplicationContextFactory, links together different implementations. The default configuration tries to instantiate an implementation for Servlet and, if it fails, for Portlet technology. If you need to support a new technology, we suggest to configure AbstractTilesApplicationContextFactory (and not using the configuration of ChainedTilesApplicationContextFactory).

Tiles Request Context Factory

The TilesRequestContext interface is used to abstract the Tiles context from the particular technology. The TilesRequestContextFactory interface is used to create instances of the class above.

The default implementation, ChainedTilesRequestContextFactory, links together different implementations. The default configuration links together the implementation for Servlet, Portlet and JSP technologies. If you need to support a new technology, we suggest to configure ChainedTilesRequestContextFactory and create a new instance of TilesRequestContextFactory.

Tiles Definitions Factory

The DefinitionsFactory interfaces is used to create and retrieve definitions. The returned definition will be used to be rendered by the Tiles container.

The default implementation, UrlDefinitionsFactory can be configured, or can be used as a basis for an extended factory.

You can provide your implementation of UrlDefinitionsFactory if you need to return definitions in a non standard way (for example, getting a definition depending on a value of a bean in request scope).

Preparer Factory

The PreparerFactory is responsible of creating instances of ViewPreparer.

The default implementation, BasicPreparerFactory takes the preparer name as a class name, instantiates an object per each class name and returns it.

You can change this behaviour by implementing PreparerFactory. For example, the Struts 1 plugin contains an implementation that takes an URL or an action mapping as a preparer name, and creates an instance accordingly.

Attribute rendering

Attribute rendering is the process that renders attributes, depending on configured renderers. This behaviour can be customized to render different types of attributes and to provide integration with other frameworks. See the Attribute rendering customization tutorial.