tilesId = tilesId + tilesExtension;
}
ServletRequest request = (ServletRequest)externalContext.getRequest();
ServletContext servletContext = (ServletContext)externalContext.getContext();
ComponentDefinition definition = null;
try
{
definition = getDefinitionsFactory().getDefinition(tilesId, request, servletContext);
if (definition == null)
{
/**
* Check for the definition without the leading '/' character. Allows user to specify Tiles definitions without a
* leading '/' char.
*/
int slashIndex = tilesId.indexOf("/");
if (slashIndex == 0)
{
tilesId = tilesId.substring(1);
definition = getDefinitionsFactory().getDefinition(tilesId, request, servletContext);
}
}
if (definition != null)
{
// if tiles-definition could be found set ComponentContext & viewId
ComponentContext tileContext = ComponentContext.getContext(request);
if (tileContext == null)
{
tileContext = new ComponentContext(definition.getAttributes());
ComponentContext.setContext(tileContext, request);
}
else
{
tileContext.addMissing(definition.getAttributes());
}
viewId = definition.getPage();
// if a controller is defined for this tile, execute it
Controller tilesController = definition.getOrCreateController();
if (tilesController != null) {
ServletResponse response = (ServletResponse) externalContext.getResponse();
if (request instanceof HttpServletRequest && response instanceof HttpServletResponse) {
try {
tilesController.execute(tileContext, (HttpServletRequest) request,