public interface DownloadSpec
| Modifier and Type | Method and Description |
|---|---|
void |
acceptAnyCertificate(boolean accept)
Specifies if HTTPS certificate verification errors should be ignored
and any certificate (even an invalid one) should be accepted.
|
void |
cachedETagsFile(java.lang.Object location)
Sets the location of the file that keeps entity tags (ETags) received
from the server
|
void |
compress(boolean compress)
Specifies if compression should be used during download
|
void |
connectTimeout(int milliseconds)
Specifies the maximum time to wait in milliseconds until a connection is
established.
|
void |
dest(java.lang.Object dest)
Sets the download destination
|
void |
downloadTaskDir(java.lang.Object dir)
Specifies the directory where gradle-download-task stores information
that should persist between builds
|
void |
eachFile(org.gradle.api.Action<? super DownloadDetails> action)
If multiple download sources are specified, this method adds an action
to be applied to each source URL before it is downloaded.
|
java.io.File |
getCachedETagsFile() |
int |
getConnectTimeout() |
java.io.File |
getDest() |
java.io.File |
getDownloadTaskDir() |
java.lang.String |
getHeader(java.lang.String name) |
java.util.Map<java.lang.String,java.lang.String> |
getHeaders() |
java.lang.String |
getPassword() |
int |
getReadTimeout() |
int |
getRetries() |
java.lang.Object |
getSrc() |
java.lang.Object |
getUseETag() |
java.lang.String |
getUsername() |
void |
header(java.lang.String name,
java.lang.String value)
Sets an HTTP request header to use when downloading
|
void |
headers(java.util.Map<java.lang.String,java.lang.String> headers)
Sets the HTTP request headers to use when downloading
|
boolean |
isAcceptAnyCertificate() |
boolean |
isCompress() |
boolean |
isOnlyIfModified() |
boolean |
isOnlyIfNewer()
Get the
onlyIfNewer flag. |
boolean |
isOverwrite() |
boolean |
isPreemptiveAuth() |
boolean |
isQuiet() |
boolean |
isTempAndMove() |
void |
onlyIfModified(boolean onlyIfModified)
Sets the onlyIfModified flag
|
void |
onlyIfNewer(boolean onlyIfNewer)
Sets the onlyIfNewer flag.
|
void |
overwrite(boolean overwrite)
Sets the overwrite flag
|
void |
password(java.lang.String password)
Sets the password for authentication
|
void |
preemptiveAuth(boolean preemptiveAuth)
Specifies if preemptive Basic authentication should be enabled.
|
void |
quiet(boolean quiet)
Sets the quiet flag
|
void |
readTimeout(int milliseconds)
Specifies the maximum time in milliseconds to wait for data from the
server.
|
void |
retries(int retries)
Specifies the maximum number of retry attempts if a request has failed.
|
void |
src(java.lang.Object src)
Sets the download source URL
|
void |
tempAndMove(boolean tempAndMove)
Specifies whether the file should be downloaded to a temporary location
and, upon successful execution, moved to the final location.
|
void |
useETag(java.lang.Object useETag)
Sets the
useETag flag. |
void |
username(java.lang.String username)
Sets the username for authentication
|
void src(java.lang.Object src) throws java.net.MalformedURLException
src - the URLjava.net.MalformedURLException - if the download source is not a URLvoid dest(java.lang.Object dest)
dest - a file or directory where to store the retrieved filevoid quiet(boolean quiet)
quiet - true if download progress should not be loggedvoid overwrite(boolean overwrite)
overwrite - true if existing files should be overwritten, false otherwisevoid onlyIfModified(boolean onlyIfModified)
onlyIfModified - true if the file should only be downloaded if it
has been modified on the server since the last downloadvoid onlyIfNewer(boolean onlyIfNewer)
onlyIfModified(boolean).onlyIfNewer - true if the file should only be downloaded if it
has been modified on the server since the last downloadvoid compress(boolean compress)
compress - true if compression should be enabledvoid username(java.lang.String username)
username - the usernamevoid password(java.lang.String password)
password - the passwordvoid headers(java.util.Map<java.lang.String,java.lang.String> headers)
headers - a Map of header names to valuesvoid header(java.lang.String name,
java.lang.String value)
name - name of the HTTP headervalue - value of the HTTP headervoid preemptiveAuth(boolean preemptiveAuth)
Specifies if preemptive Basic authentication should be enabled. By default,
gradle-download-task automatically detects the required authentication
scheme by sending two requests: one without credentials to determine
the scheme based on the WWW-Authenticate header in the server's
response and the actual request with credentials. This will fail if the
server does not send a WWW-Authenticate header. In this case,
set preemptiveAuth to true to use Basic authentication
and to always send credentials in the first request.
Note: Sending credentials in clear text in the first request without checking if the server actually needs them might pose a security risk.
preemptiveAuth - true if preemptive Basic authentication
should be enabledvoid acceptAnyCertificate(boolean accept)
accept - true if certificate errors should be ignored (default: false)void connectTimeout(int milliseconds)
milliseconds - the timeout in milliseconds (default: -1)void readTimeout(int milliseconds)
milliseconds - the timeout in milliseconds (default: -1)void retries(int retries)
retries - the maximum number of retries (default: 0)void downloadTaskDir(java.lang.Object dir)
dir - the directory (default: ${buildDir}/gradle-download-task)void tempAndMove(boolean tempAndMove)
downloadTaskDir(Object);tempAndMove - true if the file should be downloaded to a temporary
location and, upon successful execution, moved to the final location
(default: false)void useETag(java.lang.Object useETag)
Sets the useETag flag. Possible values are:
true: check if the entity tag (ETag) of a downloaded
file has changed and issue a warning if a weak ETag was encounteredfalse: Do not use entity tags (ETags) at all"all": Use all ETags but do not issue a warning for weak ones"strongOnly": Use only strong ETagsNote that this flag is only effective if onlyIfModified is
true.
useETag - the flag's new valuevoid cachedETagsFile(java.lang.Object location)
location - the location (default: ${downloadTaskDir}/etags.json)void eachFile(org.gradle.api.Action<? super DownloadDetails> action)
dest(Object) (for example, the file's name). If
only one download source has been given, adding an action will lead to
an IllegalArgumentException.action - the action to addjava.lang.Object getSrc()
java.io.File getDest()
boolean isQuiet()
boolean isOverwrite()
boolean isOnlyIfModified()
boolean isOnlyIfNewer()
onlyIfNewer flag. This method is an alias for
isOnlyIfModified().boolean isCompress()
java.lang.String getUsername()
java.lang.String getPassword()
boolean isPreemptiveAuth()
preemptiveAuth(boolean)java.util.Map<java.lang.String,java.lang.String> getHeaders()
java.lang.String getHeader(java.lang.String name)
name - name of the HTTP headerboolean isAcceptAnyCertificate()
int getConnectTimeout()
int getReadTimeout()
int getRetries()
java.io.File getDownloadTaskDir()
boolean isTempAndMove()
java.lang.Object getUseETag()
useETag flaguseETag(Object)java.io.File getCachedETagsFile()