I would like to make use of jgit in a server component which run's in a special cloud environment. With the help of JGit this server component should do pushes and fetches over the http protocol to a git server.
Now comes the tricky part: This environment forces me to use HttpClient instances to do http traffic. It's a feature of this cloud environment that I can deploy my server component together with metadata about which servers my component would like to contact via the http protocol. During runtime my server component can ask the cloud environment to get a connection to such a server and the environment will return me a preconfigured HttpClient instance. These specific HttpClient instances hide the concrete URLs,credentials from me.
I know that our JGit HTTP transport code works purely with java.net.* classes (e.g. HttpURLConnection). Up to know I couldn't find an easy way to make JGit work with HttpClient instance. I also couldn't find a bridge which translates from HttpURLConnection instances to HttpClient instances.
I was thinking about adding a new protocol to JGit which is handled by classes which are basically a copy of TransportHttp but use HttpClient instead. But that would mean a lot of duplicated code :-(
Does anybody has an idea how to solve this?