The only pure Java Subversion library in the world!
Home Get Library Knowledge Base Licensing

Customizing network connections

For accessing a repository via the http:// (https://) protocol JavaSVN uses the IHTTPConnection interface. And IHTTPConnection objects are provided by IHTTPConnectionFactory. Both these interfaces can be found in the org.tmatesoft.svn.core.internal.io.dav package.

Using your custom implementations

To make JavaSVN use your implementations of IHTTPConnection and IHTTPConnectionFactory provide your factory implementation to DAVRepositoryFactory when setting up the library for using via the http:// protocol:

...
import org.tmatesoft.svn.core.internal.io.dav;
...
    IHTTPConnectionFactory factory = new YourCustomHTTPConnectionFactory();
    DAVRepositoryFactory.setup(factory);

JavaSVN default implementations

When you call DAVRepositoryFactory.setup(), JavaSVN takes into use a default implementation of IHTTPConnectionFactory - IHTTPConnectionFactory.DEFAULT. Depending on use conditions this implementation can produce two kinds of IHTTPConnection implementations:

  • One that uses the jakarta Commons-HttpClient library - CommonsHTTPConnection (org.tmatesoft.svn.core.internal.io.dav.commons).
  • Another one - DefaultHTTPConnection (org.tmatesoft.svn.core.internal.io.dav) - a JavaSVN default HTTP connection implementation.

Differences between DefaultHTTPConnection and CommonsHTTPConnection

CommonsHTTPConnection uses the Commons-HttpClient (apache's jakarta project) library which is a thorough realization of the HTTP protocol that implements all specifications and features of the protocol. Meanwhile using DefaultHTTPConnection you may probably experience problems with some servers. Thus, of the two implementations CommonsHTTPConnection is the one that is more stable and safe in usage with the http:// protocol.

Switching between JavaSVN implementations of IHTTPConnection

CommonsHTTPConnection is optional and not used by default. Instead IHTTPConnectionFactory.DEFAULT provides DefaultHTTPConnection instances. To switch to using CommonsHTTPConnection you should:
  1. place the commons-httpclient and commons-codec jar archive files onto your classpath (these archives are distributed along with the JavaSVN builds, also they can be found in the 'contrib/httpclient' directory of the JavaSVN project),
  2. set the system property "javasvn.httpclient" to "jakarta" (see the IHTTPConnectionFactory source code for details).


If you have any questions regarding JavaSVN, would like to report a bug or contribute a patch, please write to support@tmatesoft.com