www.dextsolution.com
DEXTUPLOAD
NJ
menu toggleReference > devpia > dextuploadnj > FileResponseContentDisposition

devpia.dextuploadnj
Enum FileResponseContentDisposition

Minimum version supported
2.7.0
Minimum support environment
JRE 1.6, Spring Framework
Description

Defines the methods of processing file content in browsers.

Enum constant Description
Inline File content will be displayed on the web page. The value of the Content-Disposition header is set to 'inline'.
Attachment File content must be downloaded as a file, not displayed on the web page. The value of the Content-Disposition header is set to 'attachement'.
AttachmentWithName File content will be downloading as a file with the specified name. The value of the Content-Disposition header is set to 'attachement; filename=something'.

The method for setting FileResponseContentDisposition is as follows.

# In Servlet

// Setting the content-disposition header by using an instance of the FileDownloadOption class.
FileDownloadOption option = new FileDownloadOption();
option.setContentDisposition(FileResponseContentDisposition.Inline);
...
FileDownload downloader = new FileDownload();
downloader.download(request, response, target, option);

# In Spring

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