public static interface FileDownloadHelper.IdGenerator
| Modifier and Type | Method and Description |
|---|---|
int |
generateId(java.lang.String url,
java.lang.String path,
boolean pathAsDirectory)
Invoke this method when there is a new task from very beginning.
|
int |
transOldId(int oldId,
java.lang.String url,
java.lang.String path,
boolean pathAsDirectory)
Invoke this method when the data is restoring from the database.
|
int transOldId(int oldId,
java.lang.String url,
java.lang.String path,
boolean pathAsDirectory)
oldId - the old download id which is generated through the different.url - the url path.path - the download path.pathAsDirectory - true: if the path is absolute directory to store
the downloading file, and the filename will be found in
contentDisposition from the response as default, if can't find
contentDisposition,the filename will be generated by
FileDownloadUtils.generateFileName(String) with
url.
false: if the path = (absolute directory/filename)int generateId(java.lang.String url,
java.lang.String path,
boolean pathAsDirectory)
Important Ting: this method would be used on the FileDownloadService and the upper-layer, so as default FileDownloadService is running on the `:filedownloader` process, and upper-layer is on the user process, in this case, if you want to cache something on this instance, it would be two different caches on two processes.
Tips: if you want the FileDownloadService runs on the upper-layer process too, just
config process.non-separate=true on the filedownloader.properties, more detail
please move to FileDownloadProperties
url - the download url.path - the download path.pathAsDirectory - true: if the path is absolute directory to store
the downloading file, and the filename will be found in
contentDisposition from the response as default, if can't find
contentDisposition,the filename will be generated by
FileDownloadUtils.generateFileName(String) with
url.
false: if the path = (absolute directory/filename)