Class ConfigurableJasperReportsView
- java.lang.Object
- org.springframework.context.support.ApplicationObjectSupport
- org.springframework.web.context.support.WebApplicationObjectSupport
- org.springframework.web.servlet.view.AbstractView
- org.springframework.web.servlet.view.AbstractUrlBasedView
- org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView
- org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsSingleFormatView
- org.springframework.web.servlet.view.jasperreports.ConfigurableJasperReportsView
- All Implemented Interfaces:
Aware
,BeanNameAware
,InitializingBean
,ApplicationContextAware
,ServletContextAware
,View
public class ConfigurableJasperReportsView extends AbstractJasperReportsSingleFormatView
Configurable JasperReports View, allowing to specify the JasperReports exporter to be specified through bean properties rather than through the view class name.This class is compatible with classic JasperReports releases back until 2.x. As a consequence, it keeps using the
JRExporter
API which got deprecated as of JasperReports 5.5.2 (early 2014).- Since:
- 2.0
- Author:
- Rob Harrop
- See Also:
JasperReportsCsvView
,JasperReportsHtmlView
,JasperReportsPdfView
,JasperReportsXlsView
Field Summary
Fields inherited from class org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView
CONTENT_DISPOSITION_INLINE, HEADER_CONTENT_DISPOSITION
Fields inherited from class org.springframework.web.servlet.view.AbstractView
DEFAULT_CONTENT_TYPE
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
Fields inherited from interface org.springframework.web.servlet.View
PATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE
Constructor Summary
Constructors Constructor Description ConfigurableJasperReportsView()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected net.sf.jasperreports.engine.JRExporter
createExporter()
Returns a new instance of the specifiedJRExporter
class.protected void
onInit()
Checks that theexporterClass
property is specified.void
setExporterClass(Class<? extends net.sf.jasperreports.engine.JRExporter> exporterClass)
Set theJRExporter
implementationClass
to use.void
setUseWriter(boolean useWriter)
Specifies whether or not theJRExporter
writes to thePrintWriter
of the associated with the request (true
) or whether it writes directly to theInputStream
of the request (false
).protected boolean
useWriter()
Indicates how theJRExporter
should render its data.Methods inherited from class org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsSingleFormatView
generatesDownloadContent, renderReport, renderReportUsingOutputStream, renderReportUsingWriter
Methods inherited from class org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView
convertExporterParameters, convertParameterValue, convertReportData, convertToExporterParameter, createReport, exposeLocalizationContext, fillReport, getConvertedExporterParameters, getExporterParameter, getExporterParameters, getJdbcDataSource, getReport, getReportData, getReportDataTypes, initApplicationContext, isUrlRequired, loadReport, loadReport, postProcessReport, renderMergedOutputModel, setConvertedExporterParameters, setExporterParameters, setHeaders, setJdbcDataSource, setReportDataKey, setSubReportDataKeys, setSubReportUrls
Methods inherited from class org.springframework.web.servlet.view.AbstractUrlBasedView
afterPropertiesSet, checkResource, getUrl, setUrl, toString
Methods inherited from class org.springframework.web.servlet.view.AbstractView
addStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, setResponseContentType, writeToResponse
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext
Constructor Detail
ConfigurableJasperReportsView
public ConfigurableJasperReportsView()
Method Detail
setExporterClass
public void setExporterClass(Class<? extends net.sf.jasperreports.engine.JRExporter> exporterClass)
Set theJRExporter
implementationClass
to use. ThrowsIllegalArgumentException
if theClass
doesn't implementJRExporter
. Required setting, as it does not have a default.
setUseWriter
public void setUseWriter(boolean useWriter)
Specifies whether or not theJRExporter
writes to thePrintWriter
of the associated with the request (true
) or whether it writes directly to theInputStream
of the request (false
). Default istrue
.
onInit
protected void onInit()
Checks that theexporterClass
property is specified.- Overrides:
onInit
in classAbstractJasperReportsView
- See Also:
AbstractJasperReportsView.initApplicationContext()
createExporter
protected net.sf.jasperreports.engine.JRExporter createExporter()
Returns a new instance of the specifiedJRExporter
class.- Specified by:
createExporter
in classAbstractJasperReportsSingleFormatView
- See Also:
setExporterClass(Class)
,BeanUtils.instantiateClass(Class)
useWriter
protected boolean useWriter()
Indicates how theJRExporter
should render its data.- Specified by:
useWriter
in classAbstractJasperReportsSingleFormatView
- See Also:
setUseWriter(boolean)