|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.zkoss.zul.Filedownload org.zkoss.zkmax.zul.Filedownload
public class Filedownload
More filedownload utilities, such as resumable filedownload.
Available in ZK EE
Resumable Download
By resumable we mean the user can bookmark the URL and download
it later (and even resume the download in the middle).
On the other hand, the download URL of Filedownload
becomes obsolete as soon as the desktop (or session) is gone.
Since the resumable download can be used in any session or without any session, or with a different client (such flashget), you might want to limit the download under certain condition.
First, there are two library properties that can control the number of allowed resumable downloads.
Second, you can have more control by implementing FiledownloadListener
and specify
it as a library property called org.zkoss.zkmax.zul.FiledownloadListener.class.
For example, you can specify the following in zk.xml:
<library-property>
<name>org.zkoss.zkmax.zul.FiledownloadListener.class</name>
<value>com.foo.MyDownloadListener</value>
</library-property>
FiledownloadListener
,
Library.setProperty(java.lang.String, java.lang.String)
Constructor Summary | |
---|---|
Filedownload()
|
Method Summary | |
---|---|
static void |
saveResumable(java.io.File file,
java.lang.String contentType,
java.lang.String data)
Open a download dialog to save the specified file at the client. |
static void |
saveResumable(java.lang.String path,
java.lang.String contentType,
java.lang.String data)
Open a download dialog to save the resource of the specified path at the client. |
static void |
saveResumable(java.net.URL url,
java.lang.String contentType,
java.lang.String data)
Open a download dialog to save the resource of the specified URL at the client. |
Methods inherited from class org.zkoss.zul.Filedownload |
---|
save, save, save, save, save, save, save, save, save |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Filedownload()
Method Detail |
---|
public static void saveResumable(java.io.File file, java.lang.String contentType, java.lang.String data)
Filedownload.save(File,String)
,
the download URL is resumable.
file
- the file to download to the clientcontentType
- the content type, e.g., application/pdf.
Unlike other save methods, it is optional. If null, the file name's
extension is used to determine the content type.data
- the application-specific data to be passed to
FiledownloadListener.onDownload(org.zkoss.util.media.Media, java.lang.Object, java.lang.String)
.public static void saveResumable(java.net.URL url, java.lang.String contentType, java.lang.String data)
Filedownload.save(File,String)
,
the download URL is resumable.
url
- the URL to get the resourcecontentType
- the content type, e.g., application/pdf.
Unlike other save methods, it is optional. If null, the file name's
extension is used to determine the content type.data
- the application-specific data to be passed to
FiledownloadListener.onDownload(org.zkoss.util.media.Media, java.lang.Object, java.lang.String)
.public static void saveResumable(java.lang.String path, java.lang.String contentType, java.lang.String data)
Filedownload.save(File,String)
,
the download URL is resumable.
path
- the path of the resource.
It must be retrievable by use of WebApp.getResource(java.lang.String)
.contentType
- the content type, e.g., application/pdf.
Unlike other save methods, it is optional. If null, the file name's
extension is used to determine the content type.data
- the application-specific data to be passed to
FiledownloadListener.onDownload(org.zkoss.util.media.Media, java.lang.Object, java.lang.String)
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |