Package org.springframework.extensions.webscripts

Examples of org.springframework.extensions.webscripts.TemplateProcessor


        return templateName;
    }

    protected void processTemplate(final AnnotationWebScriptRequest request, final Map<String, Object> model, final int status,
                                   final WebScriptResponse response, ResolutionParameters params) throws IOException {
        final TemplateProcessor templateProcessor = getTemplateProcessor(request);
        final String format = request.getFormat();
        String templateName = getTemplate();
        if (StringUtils.hasText(templateName) == false) {
            templateName = generateTemplateName(templateProcessor, format, status, params);
        }
        if (templateProcessor.hasTemplate(templateName)) {
            response.setContentType(Format.valueOf(format.toUpperCase()).mimetype());
            response.setContentEncoding("utf-8");
            addCacheControlHeaders(response, params);
            templateProcessor.process(templateName, model, response.getWriter());
        } else {
            response.setStatus(HttpServletResponse.SC_NOT_FOUND);
            response.getWriter().write(String.format("Could not find template: %s", templateName));
        }
    }
View Full Code Here

TOP

Related Classes of org.springframework.extensions.webscripts.TemplateProcessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.