org.apache.maven.util
Class HttpUtils

java.lang.Object
  extended byorg.apache.maven.util.HttpUtils

public class HttpUtils
extends java.lang.Object

Http utils for retrieving files.

Author:
costin@dnt.ro, gg@grtmail.com (Added Java 1.1 style HTTP basic auth), Jason van Zyl

Constructor Summary
HttpUtils()
           
 
Method Summary
static void getFile(java.lang.String url, java.io.File destinationFile, boolean ignoreErrors, boolean useTimestamp, java.lang.String proxyHost, java.lang.String proxyPort, java.lang.String proxyUserName, java.lang.String proxyPassword)
          Retrieve a remote file.
static void getFile(java.lang.String url, java.io.File destinationFile, boolean ignoreErrors, boolean useTimestamp, java.lang.String proxyHost, java.lang.String proxyPort, java.lang.String proxyUserName, java.lang.String proxyPassword, boolean useChecksum)
          Retrieve a remote file.
static void getFile(java.lang.String url, java.io.File destinationFile, boolean ignoreErrors, boolean useTimestamp, java.lang.String proxyHost, java.lang.String proxyPort, java.lang.String proxyUserName, java.lang.String proxyPassword, java.lang.String loginHost, java.lang.String loginDomain, boolean useChecksum)
          Retrieve a remote file.
static void getFile(java.lang.String url, java.io.File destinationFile, boolean ignoreErrors, boolean useTimestamp, java.lang.String proxyHost, java.lang.String proxyPort, java.lang.String proxyUserName, java.lang.String proxyPassword, java.lang.String loginHost, java.lang.String loginDomain, DownloadMeter downloadMeter)
          Retrieve a remote file.
static void getFile(java.lang.String url, java.io.File destinationFile, long timestamp, java.lang.String proxyHost, java.lang.String proxyPort, java.lang.String proxyUserName, java.lang.String proxyPassword, java.lang.String loginHost, java.lang.String loginDomain, DownloadMeter downloadMeter)
          Retrieve a remote file.
static void setMeterType(java.lang.String type)
           
static void useProxyUser(java.lang.String proxyHost, java.lang.String proxyPort, java.lang.String proxyUserName, java.lang.String proxyPassword)
          Use a proxy to bypass the firewall with or without authentication
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpUtils

public HttpUtils()
Method Detail

useProxyUser

public static void useProxyUser(java.lang.String proxyHost,
                                java.lang.String proxyPort,
                                java.lang.String proxyUserName,
                                java.lang.String proxyPassword)
Use a proxy to bypass the firewall with or without authentication

Parameters:
proxyHost - Proxy Host (if proxy is required), or null
proxyPort - Proxy Port (if proxy is required), or null
proxyUserName - Proxy Username (if authentification is required), or null
proxyPassword - Proxy Password (if authentification is required), or null
Throws:
java.lang.SecurityException - if an operation is not authorized by the SecurityManager

getFile

public static void getFile(java.lang.String url,
                           java.io.File destinationFile,
                           boolean ignoreErrors,
                           boolean useTimestamp,
                           java.lang.String proxyHost,
                           java.lang.String proxyPort,
                           java.lang.String proxyUserName,
                           java.lang.String proxyPassword,
                           boolean useChecksum)
                    throws java.io.IOException
Retrieve a remote file. Throws an Exception on errors unless the ifnoreErrors flag is set to True

Parameters:
url - the of the file to retrieve
destinationFile - where to store it
ignoreErrors - whether to ignore errors during I/O or throw an exception when they happen
useTimestamp - whether to check the modified timestamp on the destinationFile against the remote source
proxyHost - Proxy Host (if proxy is required), or null
proxyPort - Proxy Port (if proxy is required), or null
proxyUserName - Proxy Username (if authentification is required), or null.
proxyPassword - Proxy Password (if authentification is required), or null.
useChecksum - Flag to indicate the use of the checksum for the retrieved artifact if it is available.
Throws:
java.io.IOException

getFile

public static void getFile(java.lang.String url,
                           java.io.File destinationFile,
                           boolean ignoreErrors,
                           boolean useTimestamp,
                           java.lang.String proxyHost,
                           java.lang.String proxyPort,
                           java.lang.String proxyUserName,
                           java.lang.String proxyPassword,
                           java.lang.String loginHost,
                           java.lang.String loginDomain,
                           boolean useChecksum)
                    throws java.io.IOException
Retrieve a remote file. Throws an Exception on errors unless the ifnoreErrors flag is set to True

Parameters:
url - the of the file to retrieve
destinationFile - where to store it
ignoreErrors - whether to ignore errors during I/O or throw an exception when they happen
useTimestamp - whether to check the modified timestamp on the destinationFile against the remote source
proxyHost - Proxy Host (if proxy is required), or null
proxyPort - Proxy Port (if proxy is required), or null
proxyUserName - Proxy Username (if authentification is required), or null.
proxyPassword - Proxy Password (if authentification is required), or null.
useChecksum - Flag to indicate the use of the checksum for the retrieved artifact if it is available.
loginHost - The host the authentication request is originating from. Essentially, the computer name for this machine.
loginDomain - the domain to authenticate within.
Throws:
java.io.IOException

getFile

public static void getFile(java.lang.String url,
                           java.io.File destinationFile,
                           boolean ignoreErrors,
                           boolean useTimestamp,
                           java.lang.String proxyHost,
                           java.lang.String proxyPort,
                           java.lang.String proxyUserName,
                           java.lang.String proxyPassword)
                    throws java.io.IOException
Retrieve a remote file. Throws an Exception on errors unless the ifnoreErrors flag is set to True

Parameters:
url - the of the file to retrieve
destinationFile - where to store it
ignoreErrors - whether to ignore errors during I/O or throw an exception when they happen
useTimestamp - whether to check the modified timestamp on the destinationFile against the remote source
proxyHost - Proxy Host (if proxy is required), or null
proxyPort - Proxy Port (if proxy is required), or null
proxyUserName - Proxy Username (if authentification is required), or null
proxyPassword - Proxy Password (if authentification is required), or null
Throws:
java.io.IOException

getFile

public static void getFile(java.lang.String url,
                           java.io.File destinationFile,
                           boolean ignoreErrors,
                           boolean useTimestamp,
                           java.lang.String proxyHost,
                           java.lang.String proxyPort,
                           java.lang.String proxyUserName,
                           java.lang.String proxyPassword,
                           java.lang.String loginHost,
                           java.lang.String loginDomain,
                           DownloadMeter downloadMeter)
                    throws java.io.IOException
Retrieve a remote file. Throws an Exception on errors unless the ifnoreErrors flag is set to True

Parameters:
url - the of the file to retrieve
destinationFile - where to store it
ignoreErrors - whether to ignore errors during I/O or throw an exception when they happen
useTimestamp - whether to check the modified timestamp on the destinationFile against the remote source
proxyHost - Proxy Host (if proxy is required), or null
proxyPort - Proxy Port (if proxy is required), or null
proxyUserName - Proxy Username (if authentification is required), or null
proxyPassword - Proxy Password (if authentification is required), or null
loginHost - The host the authentication request is originating from. Essentially, the computer name for this machine.
loginDomain - the domain to authenticate within.
downloadMeter - the download meter to use
Throws:
java.io.IOException

getFile

public static void getFile(java.lang.String url,
                           java.io.File destinationFile,
                           long timestamp,
                           java.lang.String proxyHost,
                           java.lang.String proxyPort,
                           java.lang.String proxyUserName,
                           java.lang.String proxyPassword,
                           java.lang.String loginHost,
                           java.lang.String loginDomain,
                           DownloadMeter downloadMeter)
                    throws java.io.IOException
Retrieve a remote file.

Parameters:
url - the URL of the file to retrieve
destinationFile - where to store it
timestamp - if provided, the remote URL is only retrieved if it was modified more recently than timestamp. Otherwise, negative value indicates that the remote URL should be retrieved unconditionally.
proxyHost - Proxy Host (if proxy is required), or null
proxyPort - Proxy Port (if proxy is required), or null
proxyUserName - Proxy Username (if authentification is required), or null
proxyPassword - Proxy Password (if authentification is required), or null
loginHost - The host the authentication request is originating from. Essentially, the computer name for this machine.
loginDomain - the domain to authenticate within.
downloadMeter - the download meter to use
Throws:
java.io.IOException - If an I/O exception occurs.

setMeterType

public static void setMeterType(java.lang.String type)


Copyright © 2001-2005 Apache Software Foundation. All Rights Reserved.