org.zkoss.zkmax.zul
Interface FiledownloadListener


public interface FiledownloadListener

The listener used with Filedownload.saveResumable(java.io.File, java.lang.String, java.lang.String) to reject a download if the user tried to resume it in unacceptable situation.

Available in ZK EE

For example, you might allow the user to reuse the download for, say, 24 hours, then you can pass a special key to denote it in the data argument when calling Filedownload.saveResumable(java.io.File, java.lang.String, java.lang.String). Then, you can check the data argument when onDownload(org.zkoss.util.media.Media, java.lang.Object, java.lang.String) is called back.

Since:
3.5.0
Author:
tomyeh
See Also:
Filedownload

Method Summary
 Media onDownload(Media media, java.lang.Object source, java.lang.String data)
          Notifies that the user is requesting the media to download.
 

Method Detail

onDownload

Media onDownload(Media media,
                 java.lang.Object source,
                 java.lang.String data)
Notifies that the user is requesting the media to download. It is used with Filedownload.saveResumable(java.io.File, java.lang.String, java.lang.String) to authenticate or filter the download.

Parameters:
media - the media that will be downloaded to the client.
source - the source of the download. It is the file argument of Filedownload.saveResumable(File, String, String), the url argument of Filedownload.saveResumable(URL, String, String), and the path argument of Filedownload.saveResumable(String, String, String).
data - the data argument passed to Filedownload.saveResumable(java.io.File, java.lang.String, java.lang.String).
Returns:
the media to be downloaded to the client. If you allow the download, you can return the value of the media argument. If you deny the download, just return null. If you want to alter the content, you can create a new instance and return it.


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo