public class ZipResourceStream extends AbstractResourceStream
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
| Constructor and Description |
|---|
ZipResourceStream(File dir)
Construct.
|
ZipResourceStream(File dir,
boolean recursive)
Construct.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the resource.
|
String |
getContentType()
Gets the mime type of this resource
|
InputStream |
getInputStream()
Gets the resource stream.
|
Time |
lastModifiedTime()
Gets the last time this modifiable thing changed.
|
Bytes |
length()
Gets the size of this resource
|
getLocale, getStyle, getVariation, setLocale, setStyle, setVariationpublic ZipResourceStream(File dir, boolean recursive)
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 wellpublic ZipResourceStream(File dir)
dir - The directory where to look for files. The directory itself will not be included
in the ZIP.public void close()
throws IOException
IResourceStreamIOExceptionIResourceStream.close()public String getContentType()
IResourceStreamgetContentType in interface IResourceStreamgetContentType in class AbstractResourceStreamIResourceStream.getContentType()public InputStream getInputStream() throws ResourceStreamNotFoundException
IResourceStreamResourceStreamNotFoundExceptionIResourceStream.getInputStream()public Bytes length()
IResourceStreamlength in interface IResourceStreamlength in class AbstractResourceStreamnull if unknownAbstractResourceStream.length()public Time lastModifiedTime()
IModifiablelastModifiedTime in interface IModifiablelastModifiedTime in class AbstractResourceStreamTime or
null if that information is not availableAbstractResourceStream.lastModifiedTime()Copyright © 2006–2015 Apache Software Foundation. All rights reserved.