msmith      2002/10/22 23:15:25

  Modified:    src/webdav/client/src/org/apache/webdav/lib
                        WebdavSession.java
  Log:
  Basic proxy support in WebdavSession (and hence WebdavResource), for any apps
  that care to use it.
  
  Revision  Changes    Path
  1.24      +27 -5     
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavSession.java
  
  Index: WebdavSession.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavSession.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- WebdavSession.java        9 Sep 2002 10:49:01 -0000       1.23
  +++ WebdavSession.java        23 Oct 2002 06:15:24 -0000      1.24
  @@ -117,6 +117,17 @@
        */
       protected HttpClient client;
   
  +    /**
  +     * The hostname to use for the proxy, if any
  +     */
  +    protected String proxyHost = null;
  +
  +    /**
  +     * Port number to use for proxy, if any
  +     */
  +    protected int proxyPort = -1;
  +
  +
   
       /**
        * Debug level.
  @@ -178,8 +189,12 @@
               client.setDebug(debug);        
               // Set a state which allows lock tracking
               client.setState(new WebdavState());
  -                     client.startSession(httpURL.getHost(), httpURL.getPort(),
  -                    httpURL.getEscapedHttpURL().startsWith("https"));
  +            if(proxyHost != null && proxyPort > 0)
  +                client.startSession(httpURL.getHost(), httpURL.getPort(),
  +                        proxyHost, proxyPort);
  +            else    
  +                         client.startSession(httpURL.getHost(), httpURL.getPort(),
  +                        httpURL.getEscapedHttpURL().startsWith("https"));
                        
               String userName = httpURL.getUserName();
               if (userName != null && userName.length() > 0) {
  @@ -192,6 +207,13 @@
           return client;
       }
   
  +    /** Set proxy info, to use proxying.
  +     */
  +    public void setProxy(String host, int port)
  +    {
  +        this.proxyHost = host;
  +        this.proxyPort = port;
  +    }
      
       /**
        * Close an session and delete the connection information.
  
  
  

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

Reply via email to