dextuploadjk.support.spring
Class JKAbstractDownloadableView
- Minimum version
- 1.0.0
- Minimum environment
- Java 17, Spring Framework 6.0.14, Spring Boot 3.0.12
- Description
-
An abstract class that supports file-type responses in the Spring Framework environment. Typically, to implement file download functionality on MVC platforms using the Spring Framework, use org.springframework.web.servlet.view.BeanNameViewResolver. Instead of using BeanNameViewResolver to select the appropriate view, DEXTUploadJK uses the method of passing an object (view) of the Concrete class that inherits from JKAbstractDownloadableView.
- Constructor
-
JKAbstractDownloadableView
-
Create an object of class JKAbstractDownloadableView.
-
Signatures
public JKAbstractDownloadableView()
-
- Methods
-
doRenderImpl
-
To download a file, render the file information in the response object.
-
Signatures
protected abstract void doRenderImpl(FileDownloadable downloader, Map<String, Object> model, HttpServletRequest request, HttpServletResponse response)
-
Parameters
Name Type Description downloader dextuploadjk.FileDownloadable FileDownloadable object, which is responsible for the engine that renders the file information. model java.util.Map<String, Object> A Map object, which holds the data needed to render the view. request javax.servlet.http.HttpServletRequest The current HTTP request object response javax.servlet.http.HttpServletResponse The current HTTP response object
getFilename
-
Returns the filename to download.
-
Signatures
public String getFilename()
-
Return
File name to download
setFilename
-
Sets the file name to download.
-
Signatures
public void setFilename(String filename)
-
Parameters
Name Type Description filename java.lang.String File name to download
getMime
-
Returns the MIME type of the file to download.
-
Signatures
public String getMime()
-
Return
MIME type
setMime
-
Sets the MIME type of the file to download.
-
Signatures
public void setMime(String mime)
-
Parameters
Name Type Description mime java.lang.String MIME type
isInline
-
[RFC2183] For browser-readable files, returns whether to represent a multipart message that can automatically display the file directly in the web browser.
It is recommended to use the getContentDisposition method.
-
Signatures
public boolean isInline()
-
Return
If the return value is true, the file is not downloaded and may be opened directly in the browser.
setInline
-
[RFC2183] For browser-recognizable files, set whether to represent a multipart message that can automatically display the file directly in the web browser.
The use of the setContentDisposition method is recommended.
-
Signatures
public void setInline(boolean inline)
-
Parameters
Name Type Description inline boolean If true, the file may be opened directly in the browser instead of being downloaded.
getCharsetName
-
[RFC2183] Returns the name of the charset used to encode the filename in the Content-Disposition part.
-
Signatures
public String getCharsetName()
-
Return
Charset name
setCharsetName
-
[RFC2183] Sets the charset name used by the Content-Disposition part to encode filenames.
-
Signatures
public void setCharsetName(String charsetName)
-
Parameters
Name Type Description charsetName java.lang.String Charset name
getDownloadStreamBufferSize
-
Returns the size of the download buffer.
-
Signatures
public int getDownloadStreamBufferSize()
-
Return
Buffer size. Defaults to 32768 bytes.
setDownloadStreamBufferSize
-
Sets the size of the download buffer.
-
Signatures
public void setDownloadStreamBufferSize(int downloadStreamBufferSize)
-
Parameters
Name Type Description downloadStreamBufferSize int The size of the buffer. The size must be a value between 4 KB and 4 MB.
getContentDisposition
-
Returns how the file content is delivered to the browser.
-
Signatures
public FileResponseContentDisposition getContentDisposition()
-
Return
dextuploadjk.engine.FileResponseContentDisposition object (default FileResponseContentDisposition.AttachmentWithName)
setContentDisposition
-
Sets how the file content is delivered to the browser.
-
Signatures
public void setContentDisposition(FileResponseContentDisposition contentDisposition)
-
Parameters
Name Type Description contentDisposition dextuploadjk.engine.FileResponseContentDisposition How file content is delivered to the browser
-