Announcement Announcement Module
No announcement yet.
ZIP file support? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • ZIP file support?

    I know this is more of an application design question which I should probably figure for myself and not related to the framework per se, but I will throw it out anyway.

    Our application has a functionality to allow the download of catalogs in ZIP format. These catalogs will have items that the user selected while browsing and added to their shopping cart. Now, what is common in these catalogs is the images, css etc that make up the 'chrome' and look & feel of the catalog.

    What I want to do is use Spring to create the common ZIP file with all common stuff on server start-up and then clone this zip file for each user who wants to add items to their cloned ZIP for download. This will avoid everytime reading the files from the filesystem and creating the zip for every user that wants to download one or more items.

    Does anyone see any issue using the bean factory to do this? How would you approach it?

    Anyway, again I know it is not framework related so no need to respond. I'll delete the post if no response. Thank you.

  • #2
    You can create a FactoryBean: ZipFactory. The first call to ZipFactory.getObject() will create the common ZIP file. I can see here two scenarios:
    1. ZipFactory.getObject() returns the ZIP file path: ZipFactory.isSingleton() returns true
    2. ZipFactory.getObject() returns a clone of the common ZIP file: ZipFactory.isSingleton() returns false.
    I think using FactoryBean is a good choice as you can rely on Spring DI to inject parameters to your ZipFactory (temporary path, ...).


    • #3
      Thanks Omar for summing it up. I really wanted to use the DI portion of the framework for this since I think it will be much cleaner and easier to maintain the contents of the ZIP file.