public abstract class

AbstractJasperReportsSingleFormatView

extends AbstractJasperReportsView
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
Known Direct Subclasses

Class Overview

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.

Summary

[Expand]
Inherited Constants
From class org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView
From class org.springframework.web.servlet.view.AbstractView
[Expand]
Inherited Fields
From class org.springframework.context.support.ApplicationObjectSupport
From interface org.springframework.web.servlet.View
Public Constructors
AbstractJasperReportsSingleFormatView()
Protected Methods
abstract JRExporter createExporter()
Create a JasperReports exporter for a specific output format, which will be used to render the report to the HTTP response.
boolean generatesDownloadContent()
Return whether this view generates download content (typically binary content like PDF or Excel files).
void renderReport(JasperPrint populatedReport, Map<StringObject> model, HttpServletResponse response)
Perform rendering for a single Jasper Reports exporter, that is, for a pre-defined output format.
void renderReportUsingOutputStream(JRExporter exporter, JasperPrint populatedReport, HttpServletResponse response)
We need to write binary output to the response OutputStream.
void renderReportUsingWriter(JRExporter exporter, JasperPrint populatedReport, HttpServletResponse response)
We need to write text to the response Writer.
abstract boolean useWriter()
Return whether to use a java.io.Writer to write text content to the HTTP response.
[Expand]
Inherited Methods
From class org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView
From class org.springframework.web.servlet.view.AbstractUrlBasedView
From class org.springframework.web.servlet.view.AbstractView
From class org.springframework.web.context.support.WebApplicationObjectSupport
From class org.springframework.context.support.ApplicationObjectSupport
From class java.lang.Object
From interface org.springframework.beans.factory.BeanNameAware
From interface org.springframework.beans.factory.InitializingBean
From interface org.springframework.context.ApplicationContextAware
From interface org.springframework.web.context.ServletContextAware
From interface org.springframework.web.servlet.View

Public Constructors

public AbstractJasperReportsSingleFormatView ()

Protected Methods

protected abstract JRExporter createExporter ()

Create a JasperReports exporter for a specific output format, which will be used to render the report to the HTTP response.

The useWriter method determines whether the output will be written as text or as binary content.

See Also

protected boolean generatesDownloadContent ()

Return whether this view generates download content (typically binary content like PDF or Excel files).

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.

protected void renderReport (JasperPrint populatedReport, Map<StringObject> model, HttpServletResponse response)

Perform rendering for a single Jasper Reports exporter, that is, for a pre-defined output format.

Parameters
populatedReport the populated JasperPrint to render
model the map containing report parameters
response the HTTP response the report should be rendered to
Throws
Exception

protected void renderReportUsingOutputStream (JRExporter exporter, JasperPrint populatedReport, HttpServletResponse response)

We need to write binary output to the response OutputStream.

Parameters
exporter the JasperReports exporter to use
populatedReport the populated JasperPrint to render
response the HTTP response the report should be rendered to
Throws
Exception if rendering failed

protected void renderReportUsingWriter (JRExporter exporter, JasperPrint populatedReport, HttpServletResponse response)

We need to write text to the response Writer.

Parameters
exporter the JasperReports exporter to use
populatedReport the populated JasperPrint to render
response the HTTP response the report should be rendered to
Throws
Exception if rendering failed

protected abstract boolean useWriter ()

Return whether to use a 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.