logger.warn("An Ajax request was detected, but no fragments were specified to be re-rendered. "
+ "Falling back to full page render.");
super.renderMergedOutputModel(model, request, response);
}
BasicTilesContainer container = (BasicTilesContainer) TilesAccess.getContainer(servletContext);
if (container == null) {
throw new ServletException("Tiles container is not initialized. "
+ "Have you added a TilesConfigurer to your web application context?");
}
exposeModelAsRequestAttributes(model, request);
JstlUtils.exposeLocalizationContext(new RequestContext(request, servletContext));
TilesRequestContext tilesRequestContext = container.getContextFactory().createRequestContext(
container.getApplicationContext(), new Object[] { request, response });
Definition compositeDefinition = container.getDefinitionsFactory().getDefinition(getUrl(),
tilesRequestContext);
Map flattenedAttributeMap = new HashMap();
flattenAttributeMap(container, tilesRequestContext, flattenedAttributeMap, compositeDefinition);
// initialize the session before rendering any fragments. Otherwise views that require the session which has
// not otherwise been initialized will fail to render
request.getSession();
response.flushBuffer();
for (int i = 0; i < attrNames.length; i++) {
Attribute attributeToRender = (Attribute) flattenedAttributeMap.get(attrNames[i]);
if (attributeToRender == null) {
throw new ServletException("No tiles attribute with a name of '" + attrNames[i]
+ "' could be found for the current view: " + this);
} else {
container.render(attributeToRender, response.getWriter(), new Object[] { request, response });
}
}
} else {
super.renderMergedOutputModel(model, request, response);
}