| org.apache.tools.ant.Task org.apache.tools.ant.taskdefs.Get
Get | public class Get extends Task (Code) | | Gets a particular file from a URL source.
Options include verbose reporting, timestamp based fetches and controlling
actions on failures. NB: access through a firewall only works if the whole
Java runtime is correctly configured.
since: Ant 1.1 |
Inner Class :public interface DownloadProgress | |
Inner Class :public static class NullProgress implements DownloadProgress | |
Inner Class :public static class VerboseProgress implements DownloadProgress | |
Method Summary | |
public boolean | doGet(int logLevel, DownloadProgress progress) make a get request, with the supplied progress and logging info. | public void | execute() Does the work. | public void | setDest(File dest) Where to copy the source file. | public void | setIgnoreErrors(boolean v) If true, log errors but do not treat as fatal. | public void | setPassword(String p) password for the basic authentication. | public void | setSrc(URL u) Set the URL to get. | public void | setUseTimestamp(boolean v) If true, conditionally download a file based on the timestamp
of the local copy.
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. | public void | setUsername(String u) Username for basic auth. | public void | setVerbose(boolean v) If true, show verbose progress information. |
doGet | public boolean doGet(int logLevel, DownloadProgress progress) throws IOException(Code) | | make a get request, with the supplied progress and logging info.
All the other config parameters are set at the task level,
source, dest, ignoreErrors, etc.
Parameters: logLevel - level to log at, see Project.log(Stringint) Parameters: progress - progress callback; null for no-callbacks true for a successful download, false otherwise.The return value is only relevant when Get.ignoreErrors is true, aswhen false all failures raise BuildExceptions. throws: IOException - for network trouble throws: BuildException - for argument errors, or other trouble when ignoreErrorsis false. |
setDest | public void setDest(File dest)(Code) | | Where to copy the source file.
Parameters: dest - Path to file. |
setIgnoreErrors | public void setIgnoreErrors(boolean v)(Code) | | If true, log errors but do not treat as fatal.
Parameters: v - if "true" then don't report download errors up to ant |
setPassword | public void setPassword(String p)(Code) | | password for the basic authentication.
Parameters: p - password for authentication |
setSrc | public void setSrc(URL u)(Code) | | Set the URL to get.
Parameters: u - URL for the file. |
setUseTimestamp | public void setUseTimestamp(boolean v)(Code) | | If true, conditionally download a file based on the timestamp
of the local copy.
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 |
setUsername | public void setUsername(String u)(Code) | | Username for basic auth.
Parameters: u - username for authentication |
setVerbose | public void setVerbose(boolean v)(Code) | | If true, show verbose progress information.
Parameters: v - if "true" then be verbose |
|
|