001/* 002 * Copyright 2002-2014 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.web.servlet.view.jasperreports; 018 019import net.sf.jasperreports.engine.export.JRCsvExporter; 020 021/** 022 * Implementation of {@code AbstractJasperReportsSingleFormatView} 023 * that renders report results in CSV format. 024 * 025 * <p><b>This class is compatible with classic JasperReports releases back until 2.x.</b> 026 * As a consequence, it keeps using the {@link net.sf.jasperreports.engine.JRExporter} 027 * API which got deprecated as of JasperReports 5.5.2 (early 2014). 028 * 029 * @author Rob Harrop 030 * @author Juergen Hoeller 031 * @since 1.1.3 032 */ 033@SuppressWarnings({"deprecation", "rawtypes"}) 034public class JasperReportsCsvView extends AbstractJasperReportsSingleFormatView { 035 036 public JasperReportsCsvView() { 037 setContentType("text/csv"); 038 } 039 040 @Override 041 protected net.sf.jasperreports.engine.JRExporter createExporter() { 042 return new JRCsvExporter(); 043 } 044 045 @Override 046 protected boolean useWriter() { 047 return true; 048 } 049 050}