Class ZipResourceStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Serializable, java.lang.AutoCloseable, IClusterable, IResourceStream, IModifiable

    public class ZipResourceStream
    extends AbstractResourceStream
    An IResourceStream that ZIPs a directory's contents on the fly

    NOTE 1. As a future improvement, cache a map of generated ZIP files for every directory and use a Watcher to detect modifications in this directory. Using ehcache would be good for that, but it's not in Wicket dependencies yet. No caching of the generated ZIP files is done yet.

    NOTE 2. As a future improvement, implement getLastModified() and request ResourceStreamRequestTarget to generate Last-Modified and Expires HTTP headers. No HTTP cache headers are provided yet. See WICKET-385

    Author:
    Jean-Baptiste Quenot
    See Also:
    Serialized Form
    • Constructor Detail

      • ZipResourceStream

        public ZipResourceStream​(File dir,
                                 boolean recursive)
        Construct.
        Parameters:
        dir - The directory where to look for files. The directory itself will not be included in the ZIP.
        recursive - If true, all subdirs will be zipped as well
      • ZipResourceStream

        public ZipResourceStream​(File dir)
        Construct. Until Wicket 1.4-RC3 recursive zip was not supported. In order not to change the behavior, using this constructor will default to recursive == false.
        Parameters:
        dir - The directory where to look for files. The directory itself will not be included in the ZIP.