In SardineImpl a substantial part of the class is responsible for configuring the default HttpClientBuilder. Refactoring it outside of SardineImpl and allowing a SardineImpl constructor to be parameterized with an instance of that "HttpClientBuilderFactory" would allow the developers to selectively modify the default Sardine's setup instead of providing the whole new HttpClientBuilder themselves.
My motivation: I'm using Sardine as a Spring singleton bean. That should work fine if I adjust the maxTotal and defaultMaxPerRoute of the underlying PoolingHttpClientConnectionManager. However, SardineImpl does not give access to the connection manager, so I have to subclass it and override createDefaultConnectionManager(). But that method is called during construction of SardineImpl (superclass), so I don't have a way to pass the maxTotal and defaultMaxPerRoute, because my subclass instance which would have these fields is not constructed yet.
In
SardineImpl
a substantial part of the class is responsible for configuring the defaultHttpClientBuilder
. Refactoring it outside ofSardineImpl
and allowing aSardineImpl
constructor to be parameterized with an instance of that "HttpClientBuilderFactory" would allow the developers to selectively modify the default Sardine's setup instead of providing the whole newHttpClientBuilder
themselves.My motivation: I'm using Sardine as a Spring singleton bean. That should work fine if I adjust the
maxTotal
anddefaultMaxPerRoute
of the underlyingPoolingHttpClientConnectionManager
. However,SardineImpl
does not give access to the connection manager, so I have to subclass it and overridecreateDefaultConnectionManager()
. But that method is called during construction ofSardineImpl
(superclass), so I don't have a way to pass themaxTotal
anddefaultMaxPerRoute
, because my subclass instance which would have these fields is not constructed yet.