You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by lu...@apache.org on 2005/02/21 18:41:36 UTC

cvs commit: jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs WebdavTask.java

luetzkendorf    2005/02/21 09:41:36

  Modified:    webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs
                        WebdavTask.java
  Log:
  Proxy support added
  
  Revision  Changes    Path
  1.6       +20 -5     jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/WebdavTask.java
  
  Index: WebdavTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/WebdavTask.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- WebdavTask.java	20 Aug 2004 10:53:22 -0000	1.5
  +++ WebdavTask.java	21 Feb 2005 17:41:36 -0000	1.6
  @@ -34,8 +34,6 @@
   /**
    * Base class of all WebDAV tasks. Provides common attributes and the creation
    * of the HttpClient.
  - * 
  - * <p>TODO enable proxies?
    */
   public abstract class WebdavTask extends Task {
      private HttpURL url = null;
  @@ -54,6 +52,23 @@
                        null, 
                        this.url.getHost(),
                        new UsernamePasswordCredentials(this.userid, this.password));
  +               
  +               String proxyHost = System.getProperty("http.proxyHost");
  +               String proxyPort = System.getProperty("http.proxyPort");
  +               
  +               if (proxyHost != null) {
  +                   this.httpClient.getHostConfiguration().setProxy(
  +                           proxyHost, 
  +                           proxyPort != null ? Integer.parseInt(proxyPort) : 80);
  +                   
  +                   String proxyUser = System.getProperty("http.proxyUser");
  +                   String proxyPassword = System.getProperty("http.proxyPassword");
  +                   if (proxyUser != null) {
  +                       this.httpClient.getState().setProxyCredentials(
  +                               null, proxyHost, 
  +                               new UsernamePasswordCredentials(proxyUser, proxyPassword));
  +                   }
  +               }
               }
            }
            return this.httpClient;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org