devpia.dextuploadnj.support.spring
Class DEXTUploadNJDirectoryToZipDownloadView
- Minimum version supported
- 1.3.0
- Minimum support environment
- JRE 1.6, Spring Framework
- Description
-
A view class enclosing the specified directory with one zip file and executing the download.
@RequestMapping(value = "mapping URL", method = RequestMethod.GET) public ModelAndView Method(...) { String targetDirPath = new File("/src/test/resources/compress/").getAbsolutePath(); DEXTUploadNJDirectoryToZipDownloadView view = new DEXTUploadNJDirectoryToZipDownloadView(); view.setTargetDirPath(targetDirPath); view.setIncludeTargetDirName(true); view.setCharsetName("UTF-8"); return new ModelAndView(view); }When using the DEXTUploadNJDirectoryToZipDownloadView, downloading is performed immediately after compressing the target directory.
When the download is completed, the compressed file(zip) is deleted directly internally, and the compressed download does not support the partial content download.
If you do not want to delete the compressed file(zip), you need to download it using the DEXTUploadNJFileDownloadView class after creating the compressed file directly using the CompressUtil class, not the DEXTUploadNJDirectoryToZipDownloadView view class.
@RequestMapping(value = "mapping URL", method = RequestMethod.GET) public ModelAndView Method(...) { // Generate the compressed file using CompressUtil. CompressUtil zipper = new CompressUtil(); File zipped = zipper.zip("/src/test/resources/compress/", true, "/tmp", "UTF-8", false, true); // Create a DEXTUploadNJFileDownloadView object to download the file. DEXTUploadNJFileDownloadView view = new DEXTUploadNJFileDownloadView(); view.setFile(zipped); view.setFilename("file name to be downloaded.zip"); view.setMime("application/x-zip-compressed"); view.setUseClientCache(false); view.setCharsetName("UTF-8"); // Starts downloading. return new ModelAndView(view); } - Constructor
-
DEXTUploadNJDirectoryToZipDownloadView
-
Generate an object of the DEXTUploadNJDirectoryToZipDownloadView class.
-
Signatures
public DEXTUploadNJDirectoryToZipDownloadView() public DEXTUploadNJDirectoryToZipDownloadView(String targetDirPath) public DEXTUploadNJDirectoryToZipDownloadView(String targetDirPath, String filename)
-
Parameters
Name Type Description targetDirPath java.lang.String the path that points to the directory to compress filename java.lang.String file name to download
-
- Methods
-
getTargetDirPath
-
Returns the path that points to the directory to compress.
-
Signatures
public String getTargetDirPath()
-
Returns
the path that points to the directory to compress
setTargetDirPath
-
Set a java.util.List object that points to the list of files to be compressed.
-
Signatures
public void setTargetDirPath(String targetDirPath)
-
Parameters
Name Type Description targetDirPath java.lang.String the path that points to the directory to compress
isIncludeTargetDirName
-
Returns whether or not to include the root directory when compressed.
-
Signatures
public boolean isIncludeTargetDirName()
-
Returns
true, false
setIncludeTargetDirName
-
Sets whether to include the root directory when compressed.
-
Signatures
public void setIncludeTargetDirName(boolean includeTargetDirName)
-
Parameters
Name Type Description includeTargetDirName boolean When the value of Parameters is true, the root directory will be compressed.
getTempZipRepositoryPath
-
Returns the path representing the temporary directory where the zip file will be created.
-
Signatures
public String getTempZipRepositoryPath()
-
Returns
the path indicating the temporary directory where the zip file will be created
setTempZipRepositoryPath
-
Sets the path representing the temporary directory where the zip file will be created.
-
Signatures
public void setTempZipRepositoryPath(String tempZipRepositoryPath)
-
Parameters
Name Type Description tempZipRepositoryPath java.lang.String the path indicating temporary directory
getZipCharsetName
-
Returns the character-set name used in the process of encoding the filename that uses the multilingual language.
-
Signatures
public String getZipCharsetName()
-
Returns
the character-set name used in the process of encoding filenames that use multiple languages
setZipCharsetName
-
Set the character-set name to be used in the process of encoding file name using multilingual.
-
Signatures
public void setZipCharsetName(String zipCharsetName)
-
Parameters
Name Type Description zipCharsetName java.lang.String the character-set name used in the process of encoding filenames that use multiple languages
isIncludeHiddenFile
-
When compressing, returns whether or not to compress hidden files.
-
Signatures
public boolean isIncludeHiddenFile()
-
Returns
true, false
setIncludeHiddenFile
-
When compressing, sets whether to compress hidden files.
-
Signatures
public void setIncludeHiddenFile(boolean includeHiddenFile)
-
Parameters
Name Type Description includeHiddenFile boolean If the value of this parameter is true, hidden files are also subject to compression.
See the getFile method of the DEXTuploadNJFileDownloadView class.
See the setFile method of the DEXTuploadNJFileDownloadView class.
See the isAllowingWeakRange method of the DEXTuploadNJFileDownloadView class.
See the setAllowingWeakRange method of the DEXTuploadNJFileDownloadView class.
See the isUseClientCache method of the DEXTuploadNJFileDownloadView class.
See the setUseClientCache method of the DEXTuploadNJFileDownloadView class.
See the isRemoveAfterDownloading method of the DEXTuploadNJFileDownloadView class.
See the setRemoveAfterDownloading method of the DEXTuploadNJFileDownloadView class.
See the getUseTomcatSendFile method of the DEXTuploadNJFileDownloadView class.
See the setUseTomcatSendFile method of the DEXTuploadNJFileDownloadView class.
See the doRenderImpl method of the DEXTUploadNJAbstractDownloadableView class.
See the getFilename method of the DEXTUploadNJAbstractDownloadableView class.
See the setFilename method of the DEXTUploadNJAbstractDownloadableView class.
See the getMime method of the DEXTUploadNJAbstractDownloadableView class.
See the setMime method of the DEXTUploadNJAbstractDownloadableView class.
See the isInline method of the DEXTUploadNJAbstractDownloadableView class.
See the setInline method of the DEXTUploadNJAbstractDownloadableView class.
See the getCharsetName method of the DEXTUploadNJAbstractDownloadableView class.
See the setCharsetName method of the DEXTUploadNJAbstractDownloadableView class.
See the getDownloadStreamBufferSize method of the DEXTUploadNJAbstractDownloadableView class.
See the setDownloadStreamBufferSize method of the DEXTUploadNJAbstractDownloadableView class.
See the getContentDisposition method of the DEXTUploadNJAbstractDownloadableView class.
See the setContentDisposition method of the DEXTUploadNJAbstractDownloadableView class
-