www.dextsolution.com
DEXTUPLOAD
NJ
menu toggleリファレンス > devpia > dextuploadnj > FileResponseContentDisposition

devpia.dextuploadnj
Enum FileResponseContentDisposition

サポートされる最小バージョン
2.7.0
最小サポート環境
JRE 1.6
説明

ブラウザでファイルコンテンツを処理する方法を定義します。

Enum constant 説明
Inline ファイルの内容がWebページに表示されます。 Content-Dispositionヘッダーの値は「インライン」に設定されます。
Attachment ファイルの内容は、Webページに表示するのではなく、ファイルとしてダウンロードする必要があります。 Content-Dispositionヘッダーの値は「attachement」に設定されます。
AttachmentWithName ファイルの内容は、指定された名前のファイルとしてダウンロードされます。 Content-Dispositionヘッダーの値は「attachement; filename=something」。

FileResponseContentDispositionを設定する方法は次のとおりである。

# Servlet

// FileDownloadOptionクラスのインスタンスを使用してcontent-dispositionヘッダーを設定します。
FileDownloadOption option = new FileDownloadOption();
option.setContentDisposition(FileResponseContentDisposition.Inline);
...
FileDownload downloader = new FileDownload();
downloader.download(request, response, target, option);

# Spring

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