www.dextsolution.com
DEXTUPLOAD
JK
menu toggleReference > dextuploadjk > engine > FileResponseContentDisposition

dextuploadjk.engine
Enum FileResponseContentDisposition

Minimum version
1.0.0
Minimum environment
Java 17, Jakarta EE 9+
Description

This is an enumeration that represents how the file response content is delivered to the browser.

Constant Description
Inline Content is expressed within a web page or on the web page itself. The Content-Disposition value of the response header is set to 'inline'.
Attachment Content must be downloaded. The Content-Disposition value of the response header is set to 'attachement'.
AttachmentWithName When content is downloaded, the given file name must be used. The Content-Disposition value of the response header is 'attachement; It is set in the format ‘filename=file name’.

How to set FileResponseContentDisposition is as follows.

# Servlet/JSP

// Set the Content-Disposition value using the FileDownloadOption class.
FileDownloadOption option = new FileDownloadOption();
option.setContentDisposition(FileResponseContentDisposition.Inline);
...
FileDownload downloader = new FileDownload();
downloader.download(request, response, target, option);

# Spring

JKFileDownloadView downloadView = new JKFileDownloadView();
downloadView.setFile(target);
downloadView.setContentDisposition(FileResponseContentDisposition.Inline);
...
return ModelAndView(downloadView);