public abstract class AbstractXlsView extends AbstractView
For working with the workbook in the subclass, see Apache's POI site
DEFAULT_CONTENT_TYPEloggerPATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE| Constructor and Description |
|---|
AbstractXlsView()
Default Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
buildExcelDocument(Map<String,Object> model,
org.apache.poi.ss.usermodel.Workbook workbook,
HttpServletRequest request,
HttpServletResponse response)
Application-provided subclasses must implement this method to populate
the Excel workbook document, given the model.
|
protected org.apache.poi.ss.usermodel.Workbook |
createWorkbook(Map<String,Object> model,
HttpServletRequest request)
Template method for creating the POI
Workbook instance. |
protected boolean |
generatesDownloadContent()
Return whether this view generates download content
(typically binary content like PDF or Excel files).
|
protected void |
renderMergedOutputModel(Map<String,Object> model,
HttpServletRequest request,
HttpServletResponse response)
Renders the Excel view, given the specified model.
|
protected void |
renderWorkbook(org.apache.poi.ss.usermodel.Workbook workbook,
HttpServletResponse response)
The actual render step: taking the POI
Workbook and rendering
it to the given response. |
addStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, setResponseContentType, toString, writeToResponsegetServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContextgetApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContextpublic AbstractXlsView()
protected boolean generatesDownloadContent()
AbstractViewThe 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 final void renderMergedOutputModel(Map<String,Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception
renderMergedOutputModel in class AbstractViewmodel - combined output Map (never null),
with dynamic values taking precedence over static attributesrequest - current HTTP requestresponse - current HTTP responseException - if rendering failedprotected org.apache.poi.ss.usermodel.Workbook createWorkbook(Map<String,Object> model, HttpServletRequest request)
Workbook instance.
The default implementation creates a traditional HSSFWorkbook.
Spring-provided subclasses are overriding this for the OOXML-based variants;
custom subclasses may override this for reading a workbook from a file.
model - the model Maprequest - current HTTP request (for taking the URL or headers into account)Workbook instanceprotected void renderWorkbook(org.apache.poi.ss.usermodel.Workbook workbook,
HttpServletResponse response)
throws IOException
Workbook and rendering
it to the given response.workbook - the POI Workbook to renderresponse - current HTTP responseIOException - when thrown by I/O methods that we're delegating toprotected abstract void buildExcelDocument(Map<String,Object> model, org.apache.poi.ss.usermodel.Workbook workbook, HttpServletRequest request, HttpServletResponse response) throws Exception
model - the model Mapworkbook - the Excel workbook to populaterequest - in case we need locale etc. Shouldn't look at attributes.response - in case we need to set cookies. Shouldn't write to it.Exception