3
When creating an HTTP connection using:
HttpClientBuilder.create().build(), HttpClients.createDefault()
or:
DefaultHttpClient
.
What’s the difference?
private static CloseableHttpClient httpClient = HttpClientBuilder.create().build();
private static CloseableHttpClient httpClient = HttpClients.createDefault();
private static DefaultHttpClient httpClient = new DefaultHttpClient();
And which is the best one to use?
Thanks for your help. Just one more question you explained that build() and createDefault() generate a Defaulthttpclient class and when I use Defaulthttpclient directly it is deprecated. So for me not to have this warning the most suitable and I use one of the other two methods?
– David Soares
That’s right @Davidsoares!
– Felipe Bonezi
Got it thank you.
– David Soares