You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Oleg Kalnichevski <ol...@apache.org> on 2013/08/16 11:40:46 UTC

#custom() vs #createBuilder(); was Re: HttpClient 4.3 tutorial preview

On Thu, 2013-08-15 at 10:41 -0400, Gary Gregory wrote:
> It seems to me that the method HttpClients.custom() should be renamed
> createBuilder(). All the other APIs in the class are create*().
> 
> Gary
> 

Gary,

The #custom() method is also used in a few other classes for the same
purpose: SocketConfig, ConnectionConfig, IOReactorConfig, CacheConfig,
RequestConfig, SSLContexts, CachingHttpClients. For consistency sake we
would have to rename the namesake method in those classes too. The
trouble is that  SocketConfig, ConnectionConfig, and IOReactorConfig
have already been released with HttpCore 4.3. 

A middle ground solution may be to leave #custom() method in all classes
that represent config parameters (SocketConfig, ConnectionConfig,
IOReactorConfig, CacheConfig, RequestConfig) and rename it in factory
classes (SSLContexts, HttpClients, and CachingHttpClients)

----
CloseableHttpClient httpclient = HttpClients.custom()
        .setKeepAliveStrategy(strat)
        .build();
----

----
CloseableHttpClient httpclient = HttpClients.createBuilder()
        .setKeepAliveStrategy(strat)
        .build();
----

Folks, please give us some input as to which variant seems better (or
consistent).

Oleg 

> 
> On Thu, Aug 15, 2013 at 4:37 AM, Oleg Kalnichevski <ol...@apache.org> wrote:
> 
> > Folks
> >
> > HttpClient 4.3 tutorial preview can be found here:
> >
> > http://people.apache.org/~olegk/httpclient-tutorial-4.3/html/
> >
> > This is pretty much the last chance to review the new APIs and make
> > amends.
> >
> > As always, review /feedback / comments / proofreading would be hugely
> > appreciated.
> >
> > Cheers
> >
> > Oleg
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> > For additional commands, e-mail: dev-help@hc.apache.org
> >
> >
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org