* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
import org.onap.so.cloudify.base.client.CloudifyRequest;
import org.onap.so.cloudify.base.client.CloudifyResponse;
import org.onap.so.cloudify.base.client.CloudifyResponseException;
-import org.onap.so.logger.MsoLogger;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class HttpClientConnector implements CloudifyClientConnector {
private static ObjectMapper DEFAULT_MAPPER;
private static ObjectMapper WRAPPED_MAPPER;
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, HttpClientConnector.class);
+ private static Logger logger = LoggerFactory.getLogger(HttpClientConnector.class);
static {
DEFAULT_MAPPER = new ObjectMapper();
String entityJson = mapper.writeValueAsString (request.entity().getEntity());
entity = new StringEntity(entityJson, ContentType.create(request.entity().getContentType()));
- LOGGER.debug ("Request JSON Body: " + entityJson.replaceAll("\"password\":\"[^\"]*\"", "\"password\":\"***\""));
+ logger.debug ("Request JSON Body: {}", entityJson.replaceAll("\"password\":\"[^\"]*\"",
+ "\"password\":\"***\""));
} catch (JsonProcessingException e) {
throw new HttpClientException ("Json processing error on request entity", e);
try {
httpResponse = httpClient.execute(httpRequest);
- LOGGER.debug ("Response status: " + httpResponse.getStatusLine().getStatusCode());
+ logger.debug ("Response status: {}", httpResponse.getStatusLine().getStatusCode());
httpClientResponse = new HttpClientResponse (httpResponse);
}
catch (Exception e) {
// Catchall for anything else, must throw as a RuntimeException
- LOGGER.error("Client exception", e);
+ logger.error("Client exception", e);
throw new RuntimeException("Unexpected client exception", e);
}
finally {
try {
httpResponse.close();
} catch (IOException e) {
- LOGGER.debug("Unable to close HTTP Response: " + e);
+ logger.debug("Unable to close HTTP Response: " + e);
}
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
import com.fasterxml.jackson.databind.ObjectMapper;
import org.onap.so.cloudify.base.client.CloudifyResponse;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
public class HttpClientResponse implements CloudifyResponse {
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, HttpClientResponse.class);
+ private static Logger logger = LoggerFactory.getLogger(HttpClientResponse.class);
private HttpResponse response = null;
private String entityBody = null;
// Read the body so InputStream can be closed
if (response.getEntity() == null) {
- // No body
- LOGGER.debug ("No Response Body");
- return;
+ // No body
+ logger.debug("No Response Body");
+ return;
}
ByteArrayOutputStream responseBody = new ByteArrayOutputStream();
throw new HttpClientException ("Error Reading Response Body", e);
}
entityBody = responseBody.toString();
- LOGGER.debug (entityBody);
+ logger.debug(entityBody);
}
@Override
public Map<String, String> headers() {
- Map<String, String> headers = new HashMap<String, String>();
+ Map<String, String> headers = new HashMap<>();
Header responseHeaders[] = response.getAllHeaders();
for (Header h : responseHeaders) {