public void doExecute(String location,
ActionInvocation invocation) throws Exception {
this.location = location;
this.invocation = invocation;
HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse();
ServletContext servletContext = ServletActionContext.getServletContext();
this.definitionsFactory =
(DefinitionsFactory) servletContext.getAttribute(TilesUtilImpl.DEFINITIONS_FACTORY);
// get component definition
ComponentDefinition definition = getComponentDefinition(this.definitionsFactory, request);
if (definition == null) {
throw new ServletException("No Tiles definition found for name '" + location + "'");
}
// get current component context
ComponentContext context = getComponentContext(definition, request);
ComponentContext.setContext(context, request);
// execute component controller associated with definition, if any
Controller controller = getController(definition, request);
if (controller != null) {
if (log.isDebugEnabled()) {
log.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() + "'");
}
super.doExecute(path, invocation);
}
Dispatches to the given location. Does its forward via a RequestDispatcher. If the
dispatch fails a 404 error will be sent back in the http response. |