public class HttpUtils extends Object
HttpClient, used to make REST calls| Constructor and Description |
|---|
HttpUtils() |
| Modifier and Type | Method and Description |
|---|---|
static SSLContext |
buildCertificateIgnoringSslContext()
Will create a certificate-ignoring
SSLContext. |
static void |
prepareRestTemplate(org.springframework.web.client.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(org.springframework.web.client.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 - the rest template, must not be nullhost - the target host URIusername - the username for authentication, can be nullpassword - the password for authentication, can be nullskipSslValidation - whether to skip ssl validation. 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.