devpia.dextuploadnj.support.spring
Class DEXTUploadNJFilesToZipDownloadView
- Minimum version supported
- 1.3.0
- Minimum support environment
- JRE 1.6, Spring Framework
- Description
-
A view class enclosing the specified files with one zip file and executing the download.
@RequestMapping(value = "mapping URL", method = RequestMethod.GET) public ModelAndView Method(...) { List<File> files = new ArrayList<File>(); files.add(new File("/src/test/resources/compress/....txt")); files.add(new File("/src/test/resources/compress/....pdf")); files.add(new File("/src/test/resources/compress/subA/subB/....txt")); files.add(new File("/src/test/resources/compress/....jpg")); files.add(new File("/src/test/resources/compress/....docx")); DEXTUploadNJFilesToZipDownloadView view = new DEXTUploadNJFilesToZipDownloadView(); view.setEntries(files); view.setCharsetName("UTF-8"); return new ModelAndView(view); }When using the DEXTUploadNJFilesToZipDownloadView, downloading is performed immediately after compressing files.
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 use 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(...) { List<File> files = new ArrayList<File>(); files.add(new File("/src/test/resources/compress/....txt")); files.add(new File("/src/test/resources/compress/....pdf")); files.add(new File("/src/test/resources/compress/subA/subB/....txt")); files.add(new File("/src/test/resources/compress/....jpg")); files.add(new File("/src/test/resources/compress/....docx")); // Generate the compressed file using CompressUtil. CompressUtil zipper = new CompressUtil(); File zipped = zipper.zip(entries, "/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 download.zip"); view.setMime("application/x-zip-compressed"); view.setUseClientCache(false); view.setCharsetName("UTF-8"); // Start downloading. return new ModelAndView(view); } - Constructor
-
DEXTUploadNJFilesToZipDownloadView
-
Create an object of the DEXTUploadNJFilesToZipDownloadView class.
-
Signatures
public DEXTUploadNJFilesToZipDownloadView() public DEXTUploadNJFilesToZipDownloadView(List<File> entries) public DEXTUploadNJFilesToZipDownloadView(List<File> entries, String filename) public DEXTUploadNJFilesToZipDownloadView(List<File> entries, List<String> entryNames, String filename)
-
Parameters
Name Type Description entries java.util.List<java.io.File> a list that has files to compress filename java.lang.String file name to download entryNames java.util.List<java.lang.String> (Supported since version 2.4.0)
A list of names of files to be compressed, the size of the 'entryNames' parameter is equal to the size of the 'entries' parameter.
-
- Methods
-
getEntries
-
Returns a java.util.List object that has files to compress.
-
Signatures
public List<File> getEntries()
-
Returns
a java.util.List object that has files to compress
setEntries
-
Set a java.util.List object that points to the list of files to be compressed.
-
Signatures
public void setEntries(List<File> entries)
-
Parameters
Name Type Description entries java.util.List<java.io.File> a list that has files to compress.
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.
getEntryNames (supported since version 2.4.0)
-
Returns a list of names of file to be compressed.
-
Signatures
public List<String> getEntryNames()
-
Returns
A list of names of files to be compressed
setEntryNames (supported since version 2.4.0)
-
Sets a list of names of files to be compressed.
-
Signatures
public void setEntryNames(List<String> entryNames)
-
Parameters
Name Type Description entryNames List<String> A list of names of files to be compressed
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 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
-