/** * Creates an instance of an {@link HttpClient} to be used to handle all HTTP communications with the target server. * * <p> * This HTTP client is used when the HTTP client is not specified through one of the constructors or the * {@link #httpClient(CloseableHttpClient, boolean)} method. * * <p> * Subclasses can override this method to provide specially-configured HTTP clients to handle stuff such as * SSL/TLS certificate handling, authentication, etc. * * <p> * The default implementation returns an instance of {@link HttpClient} using the client builder returned by * {@link #createHttpClientBuilder()}. * * @return The HTTP client to use. * @throws Exception */ protected CloseableHttpClient createHttpClient() throws Exception { // Don't call createConnectionManager() if RestClient.setConnectionManager() was called. if (httpClientConnectionManager == null) httpClientBuilder.setConnectionManager(createConnectionManager()); else httpClientBuilder.setConnectionManager(httpClientConnectionManager); return httpClientBuilder.build(); }
/** * Creates an instance of an {@link HttpClient} to be used to handle all HTTP communications with the target server. * * <p> * This HTTP client is used when the HTTP client is not specified through one of the constructors or the * {@link #httpClient(CloseableHttpClient, boolean)} method. * * <p> * Subclasses can override this method to provide specially-configured HTTP clients to handle stuff such as * SSL/TLS certificate handling, authentication, etc. * * <p> * The default implementation returns an instance of {@link HttpClient} using the client builder returned by * {@link #createHttpClientBuilder()}. * * @return The HTTP client to use. * @throws Exception */ protected CloseableHttpClient createHttpClient() throws Exception { // Don't call createConnectionManager() if RestClient.setConnectionManager() was called. if (httpClientConnectionManager == null) httpClientBuilder.setConnectionManager(createConnectionManager()); else httpClientBuilder.setConnectionManager(httpClientConnectionManager); return httpClientBuilder.build(); }
/** * Creates an instance of an {@link HttpClient} to be used to handle all HTTP communications with the target server. * * <p> * This HTTP client is used when the HTTP client is not specified through one of the constructors or the * {@link #httpClient(CloseableHttpClient, boolean)} method. * * <p> * Subclasses can override this method to provide specially-configured HTTP clients to handle stuff such as * SSL/TLS certificate handling, authentication, etc. * * <p> * The default implementation returns an instance of {@link HttpClient} using the client builder returned by * {@link #createHttpClientBuilder()}. * * @return The HTTP client to use. * @throws Exception */ protected CloseableHttpClient createHttpClient() throws Exception { // Don't call createConnectionManager() if RestClient.setConnectionManager() was called. if (httpClientConnectionManager == null) httpClientBuilder.setConnectionManager(createConnectionManager()); else httpClientBuilder.setConnectionManager(httpClientConnectionManager); return httpClientBuilder.build(); }