Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.web.servlet.view.jasperreports
Class AbstractJasperReportsSingleFormatView

    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

All Implemented Interfaces:
  BeanNameAware, InitializingBean, ApplicationContextAware, ServletContextAware, View

Direct Known Subclasses:
  ConfigurableJasperReportsView, JasperReportsCsvView, JasperReportsHtmlView, JasperReportsPdfView, JasperReportsXlsView

    public abstract class AbstractJasperReportsSingleFormatView

extends AbstractJasperReportsView

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.

Since:
  1.1.5
Author:
  Rob Harrop, Juergen Hoeller
See Also:
  `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, 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, exposeModelAsRequestAttributes, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getStaticAttributes, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setRequestContextAttribute`

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

### AbstractJasperReportsSingleFormatView

    public AbstractJasperReportsSingleFormatView()

Method Detail

### generatesDownloadContent

    protected boolean generatesDownloadContent()

  Description copied from class: `AbstractView`
  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.

  Overrides:
    `generatesDownloadContent` in class `AbstractView`
  See Also:
    `AbstractView.prepareResponse(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)`, `ServletResponse.getOutputStream()`

### renderReport

    protected void renderReport(net.sf.jasperreports.engine.JasperPrint populatedReport,
                                Map model,
                                HttpServletResponse response)
                         throws Exception

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

  Specified by:
    `renderReport` in class `AbstractJasperReportsView`
  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` - if rendering failed
  See Also:
    `AbstractView.getContentType()`, `ServletResponse.setContentType(java.lang.String)`, `ServletResponse.setCharacterEncoding(java.lang.String)`

### mergeExporterParameters

    protected Map mergeExporterParameters(Map model)

  Merges the configured JRExporterParameters with any specified in the supplied model data. JRExporterParameters in the model override those specified in the configuration.

  See Also:
    `AbstractJasperReportsView.setExporterParameters(java.util.Map)`

### renderReportUsingWriter

    protected void renderReportUsingWriter(net.sf.jasperreports.engine.JRExporter exporter,
                                           net.sf.jasperreports.engine.JasperPrint populatedReport,
                                           HttpServletResponse response)
                                    throws Exception

  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

### renderReportUsingOutputStream

    protected void renderReportUsingOutputStream(net.sf.jasperreports.engine.JRExporter exporter,
                                                 net.sf.jasperreports.engine.JasperPrint populatedReport,
                                                 HttpServletResponse response)
                                          throws Exception

  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

### createExporter

    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.

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

  See Also:
    `useWriter()`

### useWriter

    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.

  See Also:
    `ServletResponse.getWriter()`, `ServletResponse.getOutputStream()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2008 The Spring Framework.