|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
de.undercouch.gradle.tasks.download.Download
public class Download
Downloads a file and displays progress. Example:
task downloadFile(type: Download) {
src 'http://www.example.com/file.ext'
dest buildDir
}
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.gradle.api.Task |
|---|
org.gradle.api.Task.Namer |
| Field Summary |
|---|
| Fields inherited from interface org.gradle.api.Task |
|---|
TASK_ACTION, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE |
| Constructor Summary | |
|---|---|
Download()
Default constructor |
|
| Method Summary | |
|---|---|
void |
acceptAnyCertificate(boolean accept)
Specifies if HTTPS certificate verification errors should be ignored and any certificate (even an invalid one) should be accepted. |
void |
authScheme(java.lang.Object authScheme)
Sets the authentication scheme to use. |
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 |
credentials(org.apache.http.auth.Credentials credentials)
Sets the credentials used for authentication. |
void |
dest(java.lang.Object dest)
Sets the download destination |
void |
download()
Starts downloading |
void |
downloadTaskDir(java.lang.Object dir)
Specifies the directory where gradle-download-task stores information that should persist between builds |
org.apache.http.auth.AuthScheme |
getAuthScheme()
|
java.io.File |
getCachedETagsFile()
|
org.apache.http.auth.Credentials |
getCredentials()
|
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.util.List<java.io.File> |
getOutputFiles()
|
java.lang.String |
getPassword()
|
org.apache.http.HttpRequestInterceptor |
getRequestInterceptor()
|
org.apache.http.HttpResponseInterceptor |
getResponseInterceptor()
|
java.lang.Object |
getSrc()
|
int |
getTimeout()
|
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 |
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 Basic or Digest
authentication |
void |
quiet(boolean quiet)
Sets the quiet flag |
void |
requestInterceptor(org.apache.http.HttpRequestInterceptor interceptor)
Specifies an interceptor that will be called when a request is about to be sent to the server. |
void |
responseInterceptor(org.apache.http.HttpResponseInterceptor interceptor)
Specifies an interceptor that will be called when a response has been received from the server. |
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 |
timeout(int milliseconds)
Specifies a timeout in milliseconds which is the maximum time to wait until a connection is established or until the server returns data. |
void |
useETag(java.lang.Object useETag)
Sets the useETag flag. |
void |
username(java.lang.String username)
Sets the username for Basic or Digest
authentication |
| Methods inherited from class org.gradle.api.internal.AbstractTask |
|---|
addValidator, appendParallelSafeAction, compareTo, configure, deleteAllActions, dependsOn, dependsOnTaskDidWork, doFirst, doFirst, doLast, doLast, execute, finalizedBy, getActions, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDidWork, getEnabled, getExecuter, getExtensions, getFinalizedBy, getGroup, getImpliesSubProjects, getInputs, getLogger, getLogging, getMustRunAfter, getName, getOnlyIf, getOutputs, getPath, getProject, getServices, getShouldRunAfter, getStandardOutputCapture, getState, getTaskActions, getTaskDependencies, getTemporaryDir, getTemporaryDirFactory, getValidators, hasProperty, injectIntoNewInstance, isEnabled, isHasCustomActions, leftShift, mustRunAfter, onlyIf, onlyIf, prependParallelSafeAction, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setExecuter, setFinalizedBy, setGroup, setImpliesSubProjects, setMustRunAfter, setName, setOnlyIf, setOnlyIf, setProject, setProperty, setShouldRunAfter, shouldRunAfter, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Download()
| Method Detail |
|---|
public void download()
throws java.io.IOException
java.io.IOException - if the file could not downloaded@OutputFiles public java.util.List<java.io.File> getOutputFiles()
public void src(java.lang.Object src)
throws java.net.MalformedURLException
DownloadSpec
src in interface DownloadSpecsrc - the URL
java.net.MalformedURLException - if the download source is not a URLpublic void dest(java.lang.Object dest)
DownloadSpec
dest in interface DownloadSpecdest - a file or directory where to store the retrieved filepublic void quiet(boolean quiet)
DownloadSpec
quiet in interface DownloadSpecquiet - true if download progress should not be loggedpublic void overwrite(boolean overwrite)
DownloadSpec
overwrite in interface DownloadSpecoverwrite - true if existing files should be overwritten, false otherwisepublic void onlyIfModified(boolean onlyIfModified)
DownloadSpec
onlyIfModified in interface DownloadSpeconlyIfModified - true if the file should only be downloaded if it
has been modified on the server since the last downloadpublic void onlyIfNewer(boolean onlyIfNewer)
DownloadSpecDownloadSpec.onlyIfModified(boolean).
onlyIfNewer in interface DownloadSpeconlyIfNewer - true if the file should only be downloaded if it
has been modified on the server since the last downloadpublic void compress(boolean compress)
DownloadSpec
compress in interface DownloadSpeccompress - true if compression should be enabledpublic void username(java.lang.String username)
DownloadSpecBasic or Digest
authentication
username in interface DownloadSpecusername - the usernamepublic void password(java.lang.String password)
DownloadSpecBasic or Digest
authentication
password in interface DownloadSpecpassword - the passwordpublic void authScheme(java.lang.Object authScheme)
DownloadSpecSets the authentication scheme to use. This method accepts
either a String (valid values are "Basic"
and "Digest") or an instance of AuthScheme.
If username and password are set this
method will only accept "Basic" or "Digest"
as valid values. The default value will be "Basic" in
this case.
authScheme in interface DownloadSpecauthScheme - the authentication schemepublic void credentials(org.apache.http.auth.Credentials credentials)
DownloadSpecDownloadSpec.username(String) and DownloadSpec.password(String).
Allows for setting credentials for authentication schemes other than
Basic or Digest.
credentials in interface DownloadSpeccredentials - the credentialspublic void headers(java.util.Map<java.lang.String,java.lang.String> headers)
DownloadSpec
headers in interface DownloadSpecheaders - a Map of header names to values
public void header(java.lang.String name,
java.lang.String value)
DownloadSpec
header in interface DownloadSpecname - name of the HTTP headervalue - value of the HTTP headerpublic void acceptAnyCertificate(boolean accept)
DownloadSpec
acceptAnyCertificate in interface DownloadSpecaccept - true if certificate errors should be ignored (default: false)public void timeout(int milliseconds)
DownloadSpec
timeout in interface DownloadSpecmilliseconds - the timeout in milliseconds (default: -1)public void downloadTaskDir(java.lang.Object dir)
DownloadSpec
downloadTaskDir in interface DownloadSpecdir - the directory (default: ${buildDir}/gradle-download-task)public void tempAndMove(boolean tempAndMove)
DownloadSpecDownloadSpec.downloadTaskDir(Object);
tempAndMove in interface DownloadSpectempAndMove - true if the file should be downloaded to a temporary
location and, upon successful execution, moved to the final location
(default: false)public void useETag(java.lang.Object useETag)
DownloadSpecSets 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 in interface DownloadSpecuseETag - the flag's new valuepublic void cachedETagsFile(java.lang.Object location)
DownloadSpec
cachedETagsFile in interface DownloadSpeclocation - the location (default: ${downloadTaskDir}/etags.json)public void requestInterceptor(org.apache.http.HttpRequestInterceptor interceptor)
DownloadSpec
requestInterceptor in interface DownloadSpecinterceptor - the interceptor to setpublic void responseInterceptor(org.apache.http.HttpResponseInterceptor interceptor)
DownloadSpec
responseInterceptor in interface DownloadSpecinterceptor - the interceptor to setpublic java.lang.Object getSrc()
getSrc in interface DownloadSpecpublic java.io.File getDest()
getDest in interface DownloadSpecpublic boolean isQuiet()
isQuiet in interface DownloadSpecpublic boolean isOverwrite()
isOverwrite in interface DownloadSpecpublic boolean isOnlyIfModified()
isOnlyIfModified in interface DownloadSpecpublic boolean isOnlyIfNewer()
DownloadSpeconlyIfNewer flag. This method is an alias for
DownloadSpec.isOnlyIfModified().
isOnlyIfNewer in interface DownloadSpecpublic boolean isCompress()
isCompress in interface DownloadSpecpublic java.lang.String getUsername()
getUsername in interface DownloadSpecBasic or Digest
authenticationpublic java.lang.String getPassword()
getPassword in interface DownloadSpecBasic or Digest
authenticationpublic org.apache.http.auth.AuthScheme getAuthScheme()
getAuthScheme in interface DownloadSpecnull if
no authentication is performed)public org.apache.http.auth.Credentials getCredentials()
getCredentials in interface DownloadSpecnull if
no authentication is performed)public java.util.Map<java.lang.String,java.lang.String> getHeaders()
getHeaders in interface DownloadSpecpublic java.lang.String getHeader(java.lang.String name)
getHeader in interface DownloadSpecname - name of the HTTP header
public boolean isAcceptAnyCertificate()
isAcceptAnyCertificate in interface DownloadSpecpublic int getTimeout()
getTimeout in interface DownloadSpecpublic org.apache.http.HttpRequestInterceptor getRequestInterceptor()
getRequestInterceptor in interface DownloadSpecnull if no interceptor is specified)public org.apache.http.HttpResponseInterceptor getResponseInterceptor()
getResponseInterceptor in interface DownloadSpecnull if no interceptor is specified)public java.io.File getDownloadTaskDir()
getDownloadTaskDir in interface DownloadSpecpublic boolean isTempAndMove()
isTempAndMove in interface DownloadSpecpublic java.lang.Object getUseETag()
getUseETag in interface DownloadSpecuseETag flagDownloadSpec.useETag(Object)public java.io.File getCachedETagsFile()
getCachedETagsFile in interface DownloadSpec
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||