org.apache.tiles.core.startup

## Class AbstractTilesInitializer

- java.lang.Object
- - org.apache.tiles.core.startup.AbstractTilesInitializer

- All Implemented Interfaces:
    TilesInitializer
  Direct Known Subclasses:
    StrutsTilesInitializer

      public abstract class AbstractTilesInitializer
      extends Object
      implements TilesInitializer

  Default Tiles initialization delegate implementation under a servlet environment. It uses init parameters to create the `ApplicationContext` and the `TilesContainer`.
  Since:
    2.2.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractTilesInitializer()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected TilesContainer` | `createContainer(ApplicationContext context)` Creates a Tiles container.
    `protected abstract AbstractTilesContainerFactory` | `createContainerFactory(ApplicationContext context)` Creates a Tiles container factory.
    `protected ApplicationContext` | `createTilesApplicationContext(ApplicationContext preliminaryContext)` Creates the Tiles application context, to be used across all the Tiles-based application.
    `void` | `destroy()` Destroys the Tiles container.
    `protected String` | `getContainerKey(ApplicationContext applicationContext)` Returns the container key under which the container will be stored.
    `void` | `initialize(ApplicationContext applicationContext)` Initializes Tiles.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractTilesInitializer

          public AbstractTilesInitializer()

  - ### Method Detail

    - #### initialize

          public void initialize(ApplicationContext applicationContext)

      Initializes Tiles.
      Specified by:
        `initialize` in interface `TilesInitializer`
      Parameters:
        `applicationContext` - The preliminary application context to use. It will be overwritten with the real instance later. Use a context usable under your current environment, like ServletTilesApplicationContext or PortletTilesApplicationContext.

    - #### destroy

          public void destroy()

      Destroys the Tiles container.
      Specified by:
        `destroy` in interface `TilesInitializer`

    - #### createTilesApplicationContext

          protected ApplicationContext createTilesApplicationContext(ApplicationContext preliminaryContext)

      Creates the Tiles application context, to be used across all the Tiles-based application. If you override this class, please override this method.
      This implementation returns the preliminary context passed as a parameter
      Parameters:
        `preliminaryContext` - The preliminary application context to use.
      Returns:
        The Tiles application context.
      Since:
        2.2.0

    - #### getContainerKey

          protected String getContainerKey(ApplicationContext applicationContext)

      Returns the container key under which the container will be stored. This implementation returns `null` so that the container will be the default one.
      Parameters:
        `applicationContext` - The Tiles application context to use.
      Returns:
        The container key.
      Since:
        2.2.0

    - #### createContainer

          protected TilesContainer createContainer(ApplicationContext context)

      Creates a Tiles container. If you override this class, please override this method or `createContainerFactory(ApplicationContext)`.
      Parameters:
        `context` - The servlet context to use.
      Returns:
        The created container.
      Since:
        2.2.0

    - #### createContainerFactory

          protected abstract AbstractTilesContainerFactory createContainerFactory(ApplicationContext context)

      Creates a Tiles container factory. If you override this class, please override this method or `createContainer(ApplicationContext)`.
      Parameters:
        `context` - The servlet context to use.
      Returns:
        The created container factory.
      Since:
        2.2.0

Copyright © 2000–2025 Apache Software Foundation. All rights reserved.