|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.util.resource.AbstractResourceStream
org.apache.wicket.util.resource.ZipResourceStream
public class ZipResourceStream
An IResourceStream that ZIPs a directory's contents on the fly
NOTE 1. Nested directories are not supported yet, and a FileNotFoundException
will be thrown in that case.
NOTE 2. 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 3. 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 Summary | |
---|---|
ZipResourceStream(File dir)
Construct. |
Method Summary | |
---|---|
void |
close()
Closes the resource. |
java.lang.String |
getContentType()
Gets the mime type of this resource |
java.io.InputStream |
getInputStream()
Gets the resource stream. |
Time |
lastModifiedTime()
Gets the last time this modifiable thing changed. |
long |
length()
Gets the size of this resource in bytes TODO 1.5: rename to lengthInBytes() or let it return some sort of size object |
Methods inherited from class org.apache.wicket.util.resource.AbstractResourceStream |
---|
asString, getCharset, getLocale, setCharset, setLocale |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ZipResourceStream(File dir)
dir
- The directory where to look for files. The directory itself will not be included
in the ZIP.Method Detail |
---|
public void close() throws java.io.IOException
IResourceStream
java.io.IOException
public java.lang.String getContentType()
IResourceStream
getContentType
in interface IResourceStream
getContentType
in class AbstractResourceStream
ResourceStreamRequestTarget
handle the Content-Type automaticallyIResourceStream.getContentType()
public java.io.InputStream getInputStream() throws ResourceStreamNotFoundException
IResourceStream
ResourceStreamNotFoundException
IResourceStream.close()
public long length()
IResourceStream
length
in interface IResourceStream
length
in class AbstractResourceStream
IResourceStream.length()
public Time lastModifiedTime()
IModifiable
lastModifiedTime
in interface IModifiable
lastModifiedTime
in class AbstractResourceStream
Time
IModifiable.lastModifiedTime()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |