final Template template = Template.class.cast(result);
populateRequestParameters( template, request );
final TemplateHelper helper = new TemplateHelperExtractor(name).extract(request, response, matcher);
if (template.isHtml()) {
response.setContentType(TEXT_HTML);
helper.renderHtml(template.getTemplate(), template.getUserParams());
} else {
helper.renderPlain(template.getTemplate(), template.getUserParams());
}
} else if (result != null) {
response.getWriter().write(result.toString());