org.apache.tools.ant.taskdefs
public class Get extends Task
Since: Ant 1.1
UNKNOWN: category="network"
Nested Class Summary | |
---|---|
protected static class | Get.Base64Converter
BASE 64 encoding of a String or an array of bytes.
|
interface | Get.DownloadProgress |
static class | Get.NullProgress
do nothing with progress info |
static class | Get.VerboseProgress
verbose progress system prints to some output stream |
Method Summary | |
---|---|
boolean | doGet(int logLevel, Get.DownloadProgress progress)
make a get request, with the supplied progress and logging info.
|
void | execute()
Does the work.
|
void | setDest(File dest)
Where to copy the source file.
|
void | setIgnoreErrors(boolean v)
If true, log errors but do not treat as fatal.
|
void | setPassword(String p)
password for the basic authentication.
|
void | setSrc(URL u)
Set the URL to get.
|
void | setUsername(String u)
Username for basic auth.
|
void | setUseTimestamp(boolean v)
If true, conditionally download a file based on the timestamp
of the local copy.
|
void | setVerbose(boolean v)
If true, show verbose progress information.
|
Parameters: logLevel level to log at, see {@link Project#log(String, int)} progress progress callback; null for no-callbacks
Returns: true for a successful download, false otherwise. The return value is only relevant when {@link #ignoreErrors} is true, as when false all failures raise BuildExceptions.
Throws: IOException for network trouble BuildException for argument errors, or other trouble when ignoreErrors is false.
Throws: BuildException Thrown in unrecoverable error.
Parameters: dest Path to file.
Parameters: v if "true" then don't report download errors up to ant
Parameters: p password for authentication
Parameters: u URL for the file.
Parameters: u username for authentication
In this situation, the if-modified-since header is set so that the file is only fetched if it is newer than the local file (or there is no local file) This flag is only valid on HTTP connections, it is ignored in other cases. When the flag is set, the local copy of the downloaded file will also have its timestamp set to the remote file time.
Note that remote files of date 1/1/1970 (GMT) are treated as 'no timestamp', and web servers often serve files with a timestamp in the future by replacing their timestamp with that of the current time. Also, inter-computer clock differences can cause no end of grief.
Parameters: v "true" to enable file time fetching
Parameters: v if "true" then be verbose