@Override
protected String prepareForRendering(HttpServletRequest request, HttpServletResponse response)
throws Exception {
// get component definition
ComponentDefinition definition = getComponentDefinition(this.definitionsFactory, request);
if (definition == null) {
throw new ServletException("No Tiles definition found for name '" + getUrl() + "'");
}
// get current component context
ComponentContext context = getComponentContext(definition, request);
// execute component controller associated with definition, if any
Controller controller = getController(definition, request);
if (controller != null) {
if (logger.isDebugEnabled()) {
logger.debug("Executing Tiles controller [" + controller + "]");
}
executeController(controller, context, request, response);
}
// determine the path of the definition
String path = getDispatcherPath(definition, request);
if (path == null) {
throw new ServletException(
"Could not determine a path for Tiles definition '" + definition.getName() + "'");
}
return path;
}