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

devpia.dextuploadnj
Class FileDownloadOption

Minimum version supported
2.7.0
Minimum support environment
JRE 1.6
Description

This is a class that sets options necessary for downloading files.

When downloading files by using the FileDownload.download overloaded methods, it is recommended to use FileDownloadOption rather than individually setting parameters. All options added after version 2.7.0 will be set only through FileDownloadOption.

// The old way
downloader.download(request, response, target, "sea.png", "image/png");

// Using FileDownloadOption
FileDownloadOption option = new FileDownloadOption();
option.setFilename("sea.png");
option.setMime("image/png");
downloader.download(request, response, target, option);
Constructor

FileDownloadOption

  • Creates an instance 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 file name to download
    mime java.lang.String The file's MIME-TYPE
    contentDisposition devpia.dextuploadnj.FileResponseContentDisposition The method of processing file content in browers
    useClientCache boolean Whether to use the caching policy
Methods

getFilename

  • Returns the file name to download.
  • Signatures

    public String getFilename()
  • Returns

    The file name to download

setFilename

  • Sets the file name to download.

  • Signatures

    public void setFilename(String filename)
  • Parameters

    Name Type Description
    filename java.lang.String The file name to download
  • How to use

    FileDownloadOption option = new FileDownloadOption();
    option.setFilename("sea.png");

getMime

  • Returns the file's MIME-TYPE.
  • Signatures

    public String getMime()
  • Returns

    The file's MIME-TYPE (default: application/octet-stream)

setMime

  • Sets the file's MIME-TYPE.

  • Signatures

    public void setMime(String mime)
  • Parameters

    Name Type Description
    mime java.lang.String The file's MIME-TYPE
  • How to use

    FileDownloadOption option = new FileDownloadOption();
    option.setMime("image/png");

getContentDisposition

  • Returns the method of processing file content in browsers.

  • Signatures

    public FileResponseContentDisposition getContentDisposition()
  • Returns

    FileResponseContentDisposition value (default: FileResponseContentDisposition.AttachmentWithName)

setContentDisposition

  • Sets the method fo processing file content in browsers

  • Signatures

    public void setContentDisposition(FileResponseContentDisposition contentDisposition)
  • Parameters

    Name Type Description
    contentDisposition devpia.dextuploadnj.FileResponseContentDisposition The method value of processing file content in browsers
  • How to use

    FileDownloadOption option = new FileDownloadOption();
    option.setContentDisposition(FileResponseContentDisposition.Inline);

isUseClientCache

  • Returns whether or not to use the caching policy.

  • Signatures

    public boolean isUseClientCache()
  • Returns

    true(default) or false

setUseClientCache

  • Sets whether or not to use the caching policy.

    Regardlees of whether or not to use setUseClientCache, the caching policy will not be able to use for downloading memory data.

  • Signatures

    public void setUseClientCache(boolean useClientCache
  • Parameters

    Name Type Description
    useClientCache boolean true or false
  • How to use

    FileDownloadOption option = new FileDownloadOption();
    option.setUseClientCache(false);