}
/** {@inheritDoc} */
// TODO Add a MutableContainer so that this can be done?
public int doEndTag() {
TilesContainer container =
TilesAccess.getContainer(pageContext.getServletContext(), containerKey);
if (container != null) {
LOG.warn("TilesContainer already instantiated for this context under key '"
+ containerKey + "'. Ignoring request to define.");
return SKIP_BODY;
}
RuntimeConfiguredContext context =
new RuntimeConfiguredContext(pageContext.getServletContext());
if (containerFactory != null) {
context.setInitParameter(
AbstractTilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM,
containerFactory);
}
// This is to provide compatibility with Tiles 2.0.x
context.setInitParameter(
TilesContainerFactory.CONTAINER_FACTORY_MUTABLE_INIT_PARAM,
"true");
for (Map.Entry<String, String> entry : initParameters.entrySet()) {
context.setInitParameter(entry.getKey(), entry.getValue());
}
TilesApplicationContext applicationContext = new ServletTilesApplicationContext(
context);
AbstractTilesApplicationContextFactory acFactory = AbstractTilesApplicationContextFactory
.createFactory(applicationContext);
applicationContext = acFactory.createApplicationContext(context);
TilesContainer mutableContainer = AbstractTilesContainerFactory
.getTilesContainerFactory(applicationContext).createContainer(
applicationContext);
TilesAccess.setContainer(context, mutableContainer, containerKey);
return EVAL_PAGE;