www.dextsolution.com
DEXTUPLOAD
JK
menu toggleリファレンス > dextuploadjk > engine > FileResponseContentDisposition

dextuploadjk.engine
Enum FileResponseContentDisposition

最小サポートバージョン
1.0.0
最小サポート環境
Java 17, Jakarta EE 9+
説明

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

定数 説明
Inline コンテンツはWebページ内またはWebページ自体で表されます。 応答ヘッダーのContent-Dispositionの値が 'inline' に設定されます。
Attachment コンテンツはダウンロードする必要があります。 応答ヘッダーのContent-Dispositionの値が 'attachement'に設定されます。
AttachmentWithName コンテンツがダウンロードされるときは、指定されたファイル名を使用する必要があります。 応答ヘッダーのContent-Disposition値が 'attachement; filename=ファイル名'形式に設定される。

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

# Servlet/JSP

// FileDownloadOptionクラスを使用してContent-Disposition値を設定します。
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);