public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
TilesContainer container = TilesAccess.getContainer(servletContext);
ComponentContext ctx = container.getComponentContext(request, response);
ComponentAttribute attr = new ComponentAttribute();
attr.setType(ComponentAttribute.TEMPLATE);
attr.setName(targetAttributeName);
attr.setValue(getTargetResource(request));
ctx.putAttribute(targetAttributeName, attr);
try {
container.render(request, response, definition);
} catch (TilesException e) {
throw new ServletException("Error wrapping jsp with tile definition.", e);