use of org.apache.tiles.request.servlet.ServletApplicationContext in project struts-examples by apache.
the class TilesUnknownHandler method handleUnknownResult.
public Result handleUnknownResult(ActionContext actionContext, String actionName, ActionConfig actionConfig, String resultCode) throws StrutsException {
ServletContext servletContext = ServletActionContext.getServletContext();
HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse();
ServletApplicationContext context = new ServletApplicationContext(servletContext);
TilesContainer container = TilesAccess.getContainer(context);
String namespace = ServletActionContext.getActionMapping().getNamespace();
Set<String> definitions = buildDefinitionNames(namespace, actionName, resultCode);
for (String definition : definitions) {
LOG.debug("Looking for tiles definition: {}", definition);
if (container.isValidDefinition(definition, new ServletRequest(context, request, response))) {
return new TilesResult(definition);
}
}
LOG.warn("Couldn't find tiles definition for namespace {}, action name {} and result code {}", namespace, actionName, resultCode);
return null;
}
Aggregations