createZip
Creates a variable with a new ZIP archive File as its value.
Child commands
addZipItem
Required. At least one item has to be added into the new archive. While there is no specific maximum amount of these child commands, the file size of the archive may not exceed 256 megabytes.
Attributes
var | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | No |
Defines the name of the variable that will hold the ZIP archive File value. |
fileName | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines the name of the created File. If undefined, the File's name will be the value of |
title | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines a title for the created File. If undefined, the File's title will be the value of |
compression | ||
---|---|---|
Required | Value type | EL-evaluated |
No | Integer | Yes |
Defines the level of the archive's compression. The value can be any number from 0 to 9, 0 being no compression and 9 being the highest level of compression. Providing any other value will produce an error. Note that higher compression levels cause the creation of the archive to take longer, which may or may not be notable as this command is being evaluated. If left undefined, a default compression level intended to be a good compromise between speed and compression is used. |
keepContextItems | ||
---|---|---|
Required | Value type | EL-evaluated |
No | Boolean | Yes |
Defines if the Files added to the archive through Note that this removal only affects Files that have their own variables in the context - Files stored in Collections, for example, will not be affected. If undefined, value of |
Examples
The createZip
command with its addZipItem
children can come useful if your logic's output consists of several files, as putting them into a single ZIP file lessens the amount of files to upload, or for users to download, from however many into just one. Packing up a Collection of PDF files into a ZIP could work as follows:
<createZip var="docs"><forEach value="${resultPDFs}" var="resultPDF"><addZipItem value="${resultPDF}">