Resumable Downloading |
New in V3*This feature is not available in JFileSE. |
JFile Enterprise Edition (JFileEE) includes resumable downloading and resumable uploading. In a resumable download, if the download fails, JFile will display a pop-up dialog containing an error message, a "Resume" button, and a "Cancel" button. If the user clicks "Resume," JFile will try to download the file again.
To enable resumable downloading, set the parameter ManuallyResumable to 1. This parameter is set to 0 (disabled) by default.
The following is a simple resumable download script:
<APPLET codebase="/JFileScripts" code="softartisans.filetransfer.UploadClient.class"
height="0" width="0" mayscript archive="filetransfer.jar" name="fileupload">
<!-- Microsoft JVMs will load the applet from the CAB and Sun JVMs will load -->
<!-- from the JAR. This CABBASE paramater is necessary for Microsoft JVMs. -->
<PARAM name="cabbase" value="filetransfer.cab">
<!-- The file at URL1 will be downloaded and saved to the path set by FileName1. -->
<!-- To download more than one file, use URL2/FileName2, URL3/FileName3, etc. -->
<PARAM name="URL1" value="http://localhost/images/jfile.gif">
<PARAM name="Filename1" value="C:\jfile.gif">
<!-- Set ManuallyResumable to 1 to be prompted to retry a download if it fails. -->
<PARAM name="ManuallyResumable" value="1">
<!-- This param is used for this sample only. It is here to force a failure -->
<!-- in order to demonstrate resumability. Remove the CloseDownloadAfterByte param -->
<!-- from your JFile application or else it will fail -->
<PARAM name="CloseDownloadAfterByte" value="500">
</APPLET>
To demonstrate a resumable download, this script uses the parameter CloseDownloadAfterByte to force a download failure. In a resumable download, this parameter takes effect only for the first download request. It will not affect subsequent resume download requests. Do not include this parameter in a real-world resumable download application.
Copyright © 2000-2003 SoftArtisans, Inc. All rights reserved.