Perhaps we should consider going one step further. If we can support the MultiThreadedHttpConnectionManager, then we should think about pulling HttpClient out of the Slide client all together.
1) To fully take advantage of the pooled connections offered by the MultiThreadedHttpConnectionManager we would really need to use the same client across several WebdavResource instances. 2) The next version of HttpClient (3.x) includes support for interactive logins, which could prove to be very useful to application developers. 3) If we ever get around to support redirect reference resources, then the client will potentially need to have (or be able to obtain) credentials for multiple servers. This means that setting user information within the HttpURL won't be sufficient. -Steve --- Paul Hussein <[EMAIL PROTECTED]> wrote: > I have had a quick look at > > getSessionInstance in WebdavSession to change it to > the > MultiThreadedHttpConnectionManager connection > manager > > It looks like the only change required is to switch > > client = new HttpClient(); > > to HttpClient client = new > HttpClient(connectionManager); > > > with the requisite change to the code to setup the > connectionManager to be > MultiThreadedHttpConnectionManager. > > What sort of implications would this change have ? > > > Is anyone familiar with the code hierachy. Would > more changes than this have > to be made ? > > Cheers > > > Paul. > > > -----Original Message----- > > From: Ingo Brunberg [mailto:[EMAIL PROTECTED] > > Sent: Friday, June 11, 2004 4:12 PM > > To: [EMAIL PROTECTED] > > Subject: Re: org.apache.webdav.lib.WebdavException > when calling > > WebdavFIle.isDirectory ( ) > > > > > > WebdavResource (also WebdavFile) is using the > > SimpleHttpConnectionManager of Httpclient, not the > > MultithreadedConnectionManager. So you would run > into a real problem > > if you tried to use it in a multithreaded program > with simultaneous > > access. > > > > Are you sure that JFileChooser makes filesystem > calls from multiple > > threads on its own? That would be a strong reason > to switch to > > MultithreadedConnectionManager. > > > > Btw., I noticed that WebdavFile urgently needs > some work. Against my > > advice it creates a new WebdavResource and hence a > new connection for > > nearly every method call. So if you experience > performance problems > > you should know that there is room for > optimizations. > > > > Ingo > > > > > Hi, > > > > > > > > > COuld someone explain why i get > > > > > > org.apache.webdav.lib.WebdavException: Address > already in use: connect > > > > > > When a multithreaded program ( JFIleChooser ) > tries to query the same > > > directory simultaneously ( I am guessing ). > > > > > > > > > Cheers > > > > > > > > > Paul. > > > > > > > > > package it.jrc.compass.webdav; > > > > > > import java.io.File; > > > import java.io.IOException; > > > /* > > > * WebDAVFileSystemView.java > > > * > > > * Created on May 13, 2004, 8:55 AM > > > */ > > > > > > import javax.swing.JFileChooser; > > > import javax.swing.JFrame; > > > import javax.swing.UIManager; > > > import javax.swing.filechooser.FileSystemView; > > > import org.apache.commons.httpclient.HttpURL; > > > import org.apache.commons.httpclient.HttpsURL; > > > import > org.apache.commons.httpclient.URIException; > > > import org.apache.webdav.lib.WebdavResource; > > > > > > /** > > > * > > > * @author hussepa > > > */ > > > public class WebDAVFileSystemView extends > FileSystemView { > > > > > > > > > /** The WebDAV resource. */ > > > private WebdavResource webdavResource = > null; > > > private HttpURL rootURL = null; > > > private WebdavFile homedir = null; > > > private String username = null; > > > private String password = null; > > > private String uri = null; > > > private String rootPath = null; > > > > > > private static final String newFolderString > = > > > > UIManager.getString("FileChooser.other.newFolder"); > > > static FileSystemView fsv = null; > > > > > > > > > public WebDAVFileSystemView( String uri, > String rootPath, String > > > username, String password ) throws > java.lang.IllegalAccessError, > > > URIException { > > > try { > > > this.rootURL = this.uriToHttpURL( > uri + rootPath ); > > > this.uri = uri; > > > this.rootURL.setUserinfo( username, > password ); > > > this.username = username; > > > this.password = password; > > > this.rootPath = rootPath; > > > > > > > > > this.connect(); > > > System.out.println( "Connected > successfully to : " + > > > this.rootURL ); > > > this.disconnect( ); > > > > > > // Create home directory object > > > this.homedir = new WebdavFile( > this.rootURL ); > > > System.out.println( "Homedir : " + > this.homedir ); > > > } > > > catch ( java.lang.IllegalAccessError e ) > { > > > System.err.println( e.toString() ); > > > e.printStackTrace( ); > > > throw e; > > > } > > > > > > } > > > > > > private static HttpURL uriToHttpURL(String > uri) throws > > URIException { > > > HttpURL url = null; > > > if (uri.startsWith("http://")) { > > > url = new HttpURL(uri); > > > }else if (uri.startsWith("https://")) { > > > url = new HttpsURL(uri); > > > } else { > > > throw new URIException("Unknown > protocol in URL " + uri); > > > } > > > return url; > > > } > > > > > > public void disconnect() throws > java.lang.UnknownError { > > > try { > > > this.webdavResource.close(); > > > } > > > catch ( Exception e ) { > > > System.out.println( e.toString() ); > > > throw new UnknownError( ); > > > } > > > } > > > public void connect( ) throws > java.lang.IllegalAccessError { > > > try { > > > > > > this.webdavResource = new > WebdavResource( this.rootURL ); > > > } > > > catch ( Exception e ) { > > > System.err.println( e.toString() ); > > > throw new IllegalAccessError( ); > === message truncated === __________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
