de.undercouch.gradle.tasks.download.internal
Class CachingHttpClientFactory

java.lang.Object
  extended by de.undercouch.gradle.tasks.download.internal.DefaultHttpClientFactory
      extended by de.undercouch.gradle.tasks.download.internal.CachingHttpClientFactory
All Implemented Interfaces:
HttpClientFactory

public class CachingHttpClientFactory
extends DefaultHttpClientFactory

An implementation of HttpClientFactory that caches created clients until the close() method is called.


Constructor Summary
CachingHttpClientFactory()
           
 
Method Summary
 void close()
          Close all HTTP clients created by this factory
 org.apache.http.impl.client.CloseableHttpClient createHttpClient(org.apache.http.HttpHost httpHost, boolean acceptAnyCertificate, org.apache.http.HttpRequestInterceptor requestInterceptor, org.apache.http.HttpResponseInterceptor responseInterceptor)
          Creates an HTTP client for the given host
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingHttpClientFactory

public CachingHttpClientFactory()
Method Detail

createHttpClient

public org.apache.http.impl.client.CloseableHttpClient createHttpClient(org.apache.http.HttpHost httpHost,
                                                                        boolean acceptAnyCertificate,
                                                                        org.apache.http.HttpRequestInterceptor requestInterceptor,
                                                                        org.apache.http.HttpResponseInterceptor responseInterceptor)
Description copied from interface: HttpClientFactory
Creates an HTTP client for the given host

Specified by:
createHttpClient in interface HttpClientFactory
Overrides:
createHttpClient in class DefaultHttpClientFactory
Parameters:
httpHost - the host to connect to
acceptAnyCertificate - true if HTTPS certificate verification errors should be ignored and any certificate (even an invalid one) should be accepted
requestInterceptor - intercepts HTTP requests before they are sent (may be null)
responseInterceptor - intercepts HTTP responses before they are handled (may be null)
Returns:
the HTTP client

close

public void close()
           throws java.io.IOException
Close all HTTP clients created by this factory

Throws:
java.io.IOException - if an I/O error occurs