public class HttpClientUtils extends Object
HttpClient, used to make REST calls by the Shell.| Constructor and Description |
|---|
HttpClientUtils() |
| Modifier and Type | Method and Description |
|---|---|
static SSLContext |
buildCertificateIgnoringSslContext()
Will create a certificate-ignoring
SSLContext. |
static void |
prepareRestTemplate(RestTemplate restTemplate,
URI host,
String username,
String password,
boolean skipSslValidation)
Ensures that the passed-in
RestTemplate is using the Apache HTTP Client. |
public static void prepareRestTemplate(RestTemplate restTemplate, URI host, String username, String password, boolean skipSslValidation)
RestTemplate is using the Apache HTTP Client. If the optional username AND
password are not empty, then a BasicCredentialsProvider will be added to the CloseableHttpClient.
Furthermore, you can set the underlying SSLContext of the HttpClient allowing you to accept self-signed
certificates.restTemplate - Must not be nullusername - Can be nullpassword - Can be nullskipSslValidation - Use with caution! If true certificate warnings will be ignored.public static SSLContext buildCertificateIgnoringSslContext()
SSLContext. Please use with utmost caution as it undermines security,
but may be useful in certain testing or development scenarios.Copyright © 2017 Pivotal Software, Inc.. All rights reserved.