dextuploadjk.engine
Class FileDownloadOption
- Minimum version
- 1.0.0
- Minimum environment
- Java 17, Jakarta EE 9+
- Description
-
This is a class that sets the options needed when downloading a file. Used in the download method of the FileDownload class.
// Use FileDownloadOption FileDownloadOption option = new FileDownloadOption(); option.setFilename("sea.png"); option.setMime("image/png"); downloader.download(request, response, target, option); - Constructor
-
FileDownloadOption
- Creates an object of the FileDownloadOption class.
-
Signatures
public FileDownloadOption() public FileDownloadOption(String filename, String mime, FileResponseContentDisposition contentDisposition, boolean useClientCache)
-
Parameters
Name Type Description filename java.lang.String The download name of the file mime java.lang.String MIME-TYPE of the file contentDisposition dextuploadjk.engine.FileResponseContentDisposition How file content is delivered to the browser useClientCache boolean Whether to use cache policy
- Methods
-
getFilename
- Returns the download name of the file.
-
Signatures
public String getFilename()
-
Return
File name
setFilename
-
Set the download name of the file.
-
Signatures
public void setFilename(String filename)
-
Parameters
Name Type Description filename java.lang.String File name -
Uses
FileDownloadOption option = new FileDownloadOption(); option.setFilename("sea.png");
getMime
- Returns the MIME-TYPE of the file.
-
Signatures
public String getMime()
-
Return
MIME-TYPE of the file, default is application/octet-stream.
setMime
-
Set the MIME-TYPE of the file.
-
Signatures
public void setMime(String mime)
-
Parameters
Name Type Description mime java.lang.String MIME-TYPE of the file -
Uses
FileDownloadOption option = new FileDownloadOption(); option.setMime("image/png");
getContentDisposition
-
Returns how the file content is delivered to the browser.
-
Signatures
public FileResponseContentDisposition getContentDisposition()
-
Return
FileResponseContentDisposition object, default is FileResponseContentDisposition.AttachmentWithName.
setContentDisposition
-
Sets how 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 -
Uses
FileDownloadOption option = new FileDownloadOption(); option.setContentDisposition(FileResponseContentDisposition.Inline);
isUseClientCache
-
Returns whether the cache policy is used.
-
Signatures
public boolean isUseClientCache()
-
Return
true (default) or false
setUseClientCache
-
Set whether to use cache policy.
The download function using a stream object does not use a cache policy regardless of the setUseClientCache setting.
-
Signatures
public void setUseClientCache(boolean useClientCache)
-
Parameters
Name Type Description useClientCache boolean true or false -
Uses
FileDownloadOption option = new FileDownloadOption(); option.setUseClientCache(false);