Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 19336 invoked from network); 20 Feb 2003 07:32:57 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 20 Feb 2003 07:32:57 -0000 Received: (qmail 9148 invoked by uid 97); 20 Feb 2003 07:34:32 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@nagoya.betaversion.org Received: (qmail 9141 invoked from network); 20 Feb 2003 07:34:32 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 20 Feb 2003 07:34:32 -0000 Received: (qmail 19129 invoked by uid 500); 20 Feb 2003 07:32:55 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 19118 invoked by uid 500); 20 Feb 2003 07:32:55 -0000 Received: (qmail 19115 invoked from network); 20 Feb 2003 07:32:54 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 20 Feb 2003 07:32:54 -0000 Received: (qmail 64102 invoked by uid 1439); 20 Feb 2003 07:32:56 -0000 Date: 20 Feb 2003 07:32:56 -0000 Message-ID: <20030220073256.64100.qmail@icarus.apache.org> From: adammurdoch@apache.org To: jakarta-commons-sandbox-cvs@apache.org Subject: cvs commit: jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/webdav WebDavFileSystem.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N adammurdoch 2003/02/19 23:32:56 Modified: vfs/src/java/org/apache/commons/vfs/provider/webdav WebDavFileSystem.java Log: Lazy creation of the HttpClient. Revision Changes Path 1.3 +23 -20 jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/webdav/WebDavFileSystem.java Index: WebDavFileSystem.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/webdav/WebDavFileSystem.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- WebDavFileSystem.java 15 Feb 2003 02:35:35 -0000 1.2 +++ WebDavFileSystem.java 20 Feb 2003 07:32:55 -0000 1.3 @@ -78,27 +78,11 @@ extends AbstractFileSystem implements FileSystem { - private final HttpClient client; + private HttpClient client; - public WebDavFileSystem( final GenericFileName rootName ) throws FileSystemException + public WebDavFileSystem( final GenericFileName rootName ) { super( rootName, null ); - - // Create an Http client - try - { - final HttpURL url = new HttpURL( rootName.getUserName(), - rootName.getPassword(), - rootName.getHostName(), - rootName.getPort(), - "/" ); - final WebdavResource resource = new WebdavResource( url, WebdavResource.NOACTION, 1 ); - client = resource.retrieveSessionInstance(); - } - catch ( final IOException e ) - { - throw new FileSystemException( "vfs.provider.webdav/create-client.error", rootName, e ); - } } /** @@ -118,8 +102,27 @@ /** * Returns the client for this file system. */ - protected HttpClient getClient() + protected HttpClient getClient() throws FileSystemException { + if ( client == null ) + { + // Create an Http client + try + { + final GenericFileName rootName = (GenericFileName)getRootName(); + final HttpURL url = new HttpURL( rootName.getUserName(), + rootName.getPassword(), + rootName.getHostName(), + rootName.getPort(), + "/" ); + final WebdavResource resource = new WebdavResource( url, WebdavResource.NOACTION, 1 ); + client = resource.retrieveSessionInstance(); + } + catch ( final IOException e ) + { + throw new FileSystemException( "vfs.provider.webdav/create-client.error", getRootName(), e ); + } + } return client; } --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org