public class FileDownloadView
extends java.lang.Object
implements org.springframework.web.servlet.View
Constructor and Description |
---|
FileDownloadView()
This view will render a simple HTTP file download
|
FileDownloadView(java.lang.String fileName,
java.lang.String suffix)
This view will render a simple HTTP file download with default
settings for content type (application/octet-stream) and encoding (no encoding).
|
FileDownloadView(java.lang.String contentType,
java.lang.String fileName,
java.lang.String suffix,
java.lang.String encoding)
This view will render a simple HTTP file download.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getContentType() |
java.lang.String |
getEncoding() |
java.lang.String |
getFileName() |
java.lang.String |
getSuffix() |
protected boolean |
isBinaryData() |
void |
render(java.util.Map<java.lang.String,?> model,
javax.servlet.http.HttpServletRequest arg1,
javax.servlet.http.HttpServletResponse response) |
void |
setContentType(java.lang.String contentType) |
void |
setEncoding(java.lang.String encoding) |
void |
setFileName(java.lang.String fileName) |
void |
setSuffix(java.lang.String suffix) |
public FileDownloadView()
Please make sure you set contentType, fileName, suffix and encoding via setter-methods. Otherwise you'll run into an exception.
public FileDownloadView(java.lang.String fileName, java.lang.String suffix)
fileName
- specifiy the name of the file you want to savesuffix
- file ending like "txt" or "pdf"public FileDownloadView(java.lang.String contentType, java.lang.String fileName, java.lang.String suffix, java.lang.String encoding)
contentType
- like "text/csv" or "application/pdf"fileName
- specifiy the name of the file you want to savesuffix
- file ending like "txt" or "pdf"encoding
- charset like "utf-8"public void render(java.util.Map<java.lang.String,?> model, javax.servlet.http.HttpServletRequest arg1, javax.servlet.http.HttpServletResponse response) throws java.lang.Exception
render
in interface org.springframework.web.servlet.View
java.lang.Exception
public java.lang.String getContentType()
getContentType
in interface org.springframework.web.servlet.View
public void setContentType(java.lang.String contentType)
public java.lang.String getFileName()
public void setFileName(java.lang.String fileName)
public java.lang.String getSuffix()
public void setSuffix(java.lang.String suffix)
public java.lang.String getEncoding()
public void setEncoding(java.lang.String encoding)
protected boolean isBinaryData()
Copyright © 2007-2020 EDIT. All Rights Reserved.