GH-9452: Expose ZipTransformer.setFileNameGenerator()
Fixes: #9452 Issue link: https://github.com/spring-projects/spring-integration/issues/9452 * Move the logic about `fileNameGenerator` configuration out of `AbstractZipTransformer` since this property is not used by `UnZipTransformer` implementation * Add more docs about `ZipTransformer` logic
This commit is contained in:
@@ -78,3 +78,9 @@ See xref:sftp/session-factory.adoc[SFTP Session Factory] for more information.
|
||||
Multiple instances of `MqttPahoMessageDrivenChannelAdapter` and `Mqttv5PahoMessageDrivenChannelAdapter` can now be added at runtime using corresponding `ClientManager` through `IntegrationFlowContext`
|
||||
Also a `MqttMessageNotDeliveredEvent` event has been introduced to emit when action callback reacts to the delivery failure.
|
||||
See xref:mqtt.adoc[MQTT Support] for more information.
|
||||
|
||||
[[x6.4-zip-support-changes]]
|
||||
=== Zip Support Changes
|
||||
|
||||
The `ZipTransformer` now exposes a `fileNameGenerator` property to customize a target zip file (and optional zip entry) name generation.
|
||||
See xref:zip.adoc[Zip Support] for more information.
|
||||
|
||||
@@ -69,6 +69,14 @@ The `ZipTransformer` can be customized by setting several properties:
|
||||
Default is `Deflater#DEFAULT_COMPRESSION`.
|
||||
|
||||
* `useFileAttributes` - specifies whether the name of the file shall be used for the zip entry.
|
||||
* `fileNameGenerator` - uses to generate an original file name based on the request message.
|
||||
Defaults to `DefaultFileNameGenerator`.
|
||||
The `.zip` extension is added into this name for the target zip file name.
|
||||
Unless it is already present as a result of this generator.
|
||||
|
||||
In addition, a `ZipHeaders.ZIP_ENTRY_FILE_NAME` and `ZipHeaders.ZIP_ENTRY_LAST_MODIFIED_DATE` can be supplied for the name of zip entry and its `lastmodified` attribute.
|
||||
If not provided, the entry name is exact result of the `fileNameGenerator` and `lastmodified` falls back to the current date and time.
|
||||
If the payload of request message is an `Iterable`, then this entry name is modified with an index starting `1`.
|
||||
|
||||
For example to zip a simple `test.txt` file into a `test.txt.zip`, only this configuration is enough:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user