List of usage examples for org.springframework.web.util WebUtils CONTENT_TYPE_CHARSET_PREFIX
String CONTENT_TYPE_CHARSET_PREFIX
To view the source code for org.springframework.web.util WebUtils CONTENT_TYPE_CHARSET_PREFIX.
Click Source Link
From source file:ua.com.manometer.jasperreports.AbstractJasperReportsSingleFormatView.java
/** * We need to write text to the response Writer. * @param exporter the JasperReports exporter to use * @param populatedReport the populated <code>JasperPrint</code> to render * @param response the HTTP response the report should be rendered to * @throws Exception if rendering failed *///from w w w.j a v a 2 s . c o m protected void renderReportUsingWriter(JRExporter exporter, JasperPrint populatedReport, HttpServletResponse response) throws Exception { // Copy the encoding configured for the report into the response. String contentType = getContentType(); String encoding = (String) exporter.getParameter(JRExporterParameter.CHARACTER_ENCODING); if (encoding != null) { // Only apply encoding if content type is specified but does not contain charset clause already. if (contentType != null && !contentType.toLowerCase().contains(WebUtils.CONTENT_TYPE_CHARSET_PREFIX)) { contentType = contentType + WebUtils.CONTENT_TYPE_CHARSET_PREFIX + encoding; } } response.setContentType(contentType); // Render report into HttpServletResponse's Writer. JasperReportsUtils.render(exporter, populatedReport, response.getWriter()); }