|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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
public abstract class AbstractJasperReportsSingleFormatView
Extends AbstractJasperReportsView
to provide basic rendering logic
for views that use a fixed format, e.g. always PDF or always HTML.
Subclasses need to implement two template methods: createExporter
to create a JasperReports exporter for a specific output format, and
useWriter
to determine whether to write text or binary content.
createExporter()
,
useWriter()
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 |
Constructor Summary | |
---|---|
AbstractJasperReportsSingleFormatView()
|
Method Summary | |
---|---|
protected abstract net.sf.jasperreports.engine.JRExporter |
createExporter()
Create a JasperReports exporter for a specific output format, which will be used to render the report to the HTTP response. |
protected boolean |
generatesDownloadContent()
Return whether this view generates download content (typically binary content like PDF or Excel files). |
protected Map |
mergeExporterParameters(Map model)
Merges the configured JRExporterParameters with any specified in the supplied model data. |
protected void |
renderReport(net.sf.jasperreports.engine.JasperPrint populatedReport,
Map model,
HttpServletResponse response)
Perform rendering for a single Jasper Reports exporter, that is, for a pre-defined output format. |
protected void |
renderReportUsingOutputStream(net.sf.jasperreports.engine.JRExporter exporter,
net.sf.jasperreports.engine.JasperPrint populatedReport,
HttpServletResponse response)
We need to write binary output to the response OutputStream. |
protected void |
renderReportUsingWriter(net.sf.jasperreports.engine.JRExporter exporter,
net.sf.jasperreports.engine.JasperPrint populatedReport,
HttpServletResponse response)
We need to write text to the response Writer. |
protected abstract boolean |
useWriter()
Return whether to use a java.io.Writer to write text content
to the HTTP response. |
Methods inherited from class org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView |
---|
convertExporterParameters, convertParameterValue, convertReportData, convertToExporterParameter, createReport, exposeLocalizationContext, fillReport, getConvertedExporterParameters, getExporterParameter, getExporterParameters, getJdbcDataSource, getReport, getReportCompiler, getReportData, getReportDataTypes, initApplicationContext, isUrlRequired, loadReport, loadReport, onInit, postProcessReport, renderMergedOutputModel, setExporterParameters, setHeaders, setJdbcDataSource, setReportCompiler, setReportDataKey, setSubReportDataKeys, setSubReportUrls |
Methods inherited from class org.springframework.web.servlet.view.AbstractUrlBasedView |
---|
afterPropertiesSet, getUrl, setUrl, toString |
Methods inherited from class org.springframework.web.servlet.view.AbstractView |
---|
addStaticAttribute, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getStaticAttributes, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setRequestContextAttribute, 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AbstractJasperReportsSingleFormatView()
Method Detail |
---|
protected boolean generatesDownloadContent()
AbstractView
The default implementation returns false
. Subclasses are
encouraged to return true
here if they know that they are
generating download content that requires temporary caching on the
client side, typically via the response OutputStream.
generatesDownloadContent
in class AbstractView
AbstractView.prepareResponse(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
,
ServletResponse.getOutputStream()
protected void renderReport(net.sf.jasperreports.engine.JasperPrint populatedReport, Map model, HttpServletResponse response) throws Exception
renderReport
in class AbstractJasperReportsView
populatedReport
- the populated JasperPrint
to rendermodel
- the map containing report parametersresponse
- the HTTP response the report should be rendered to
Exception
- if rendering failedAbstractView.getContentType()
,
ServletResponse.setContentType(java.lang.String)
,
ServletResponse.setCharacterEncoding(java.lang.String)
protected Map mergeExporterParameters(Map model)
AbstractJasperReportsView.setExporterParameters(java.util.Map)
protected void renderReportUsingWriter(net.sf.jasperreports.engine.JRExporter exporter, net.sf.jasperreports.engine.JasperPrint populatedReport, HttpServletResponse response) throws Exception
exporter
- the JasperReports exporter to usepopulatedReport
- the populated JasperPrint
to renderresponse
- the HTTP response the report should be rendered to
Exception
- if rendering failedprotected void renderReportUsingOutputStream(net.sf.jasperreports.engine.JRExporter exporter, net.sf.jasperreports.engine.JasperPrint populatedReport, HttpServletResponse response) throws Exception
exporter
- the JasperReports exporter to usepopulatedReport
- the populated JasperPrint
to renderresponse
- the HTTP response the report should be rendered to
Exception
- if rendering failedprotected abstract net.sf.jasperreports.engine.JRExporter createExporter()
The useWriter
method determines whether the
output will be written as text or as binary content.
useWriter()
protected abstract boolean useWriter()
java.io.Writer
to write text content
to the HTTP response. Else, a java.io.OutputStream
will be used,
to write binary content to the response.
ServletResponse.getWriter()
,
ServletResponse.getOutputStream()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |