import org.onap.aai.restclient.client.OperationResult;
import org.onap.aai.restclient.client.RestClient;
import org.onap.aai.restclient.enums.RestAuthenticationMode;
+import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
* Wrapper around the standard A&AI Rest Client interface. This currently uses Jersey client 1.x
*
*/
+@Component
public class AaiRestClient {
public static final String HEADER_TRANS_ID = "X-TransactionId";
private RestClient setupClient() {
RestClient restClient = new RestClient();
-
- // @formatter:off
restClient.validateServerHostname(false)
.validateServerCertChain(false)
+ .connectTimeoutMs(config.getClientConnectTimeoutMs())
+ .readTimeoutMs(config.getClientReadTimeoutMs());
+
+ //Use certs only if SSL is enabled
+ if (config.useHttpsWithAAI())
+ {// @formatter:off
+ restClient
.clientCertFile(config.getAaiKeyStorePath())
.clientCertPassword(config.getAaiKeyStorePassword());
- // @formatter:on
+ // @formatter:on
+ }
if (useBasicAuth()) {
restClient.authenticationMode(RestAuthenticationMode.SSL_BASIC);