public class DefaultIdGenerator extends java.lang.Object implements FileDownloadHelper.IdGenerator
| Constructor and Description |
|---|
DefaultIdGenerator() |
| 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.
|
public int transOldId(int oldId,
java.lang.String url,
java.lang.String path,
boolean pathAsDirectory)
FileDownloadHelper.IdGeneratortransOldId in interface FileDownloadHelper.IdGeneratoroldId - 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)public int generateId(java.lang.String url,
java.lang.String path,
boolean pathAsDirectory)
FileDownloadHelper.IdGeneratorImportant 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
generateId in interface FileDownloadHelper.IdGeneratorurl - 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)