aboutsummaryrefslogtreecommitdiffstats
path: root/gson/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-02-22 16:30:07 -0500
committerJim Hahn <jrh3@att.com>2019-02-22 16:32:15 -0500
commit9e43e5a72b77ba4701dfd320bf6cefaffaaa3823 (patch)
treebfaa4f469803d35ce64f1d9495a71eb18f9b7a70 /gson/src/main
parent4aaa6bf18c1cc72b1fff9c6687cf52ccd0d07a07 (diff)
Log which gson style is being used
Different gson providers may be used for REST APIs. Updated the code to identify which was being used. Change-Id: I8ffbda7409142ec728e217a87c9bcba3c34b814b Issue-ID: POLICY-1428 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'gson/src/main')
-rw-r--r--gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java6
-rw-r--r--gson/src/main/java/org/onap/policy/common/gson/JacksonHandler.java4
2 files changed, 8 insertions, 2 deletions
diff --git a/gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java b/gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java
index 6906696f..fc8e23ef 100644
--- a/gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java
+++ b/gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java
@@ -36,6 +36,8 @@ import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyReader;
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Provider that serializes and de-serializes JSON via gson.
@@ -45,6 +47,8 @@ import javax.ws.rs.ext.Provider;
@Produces(MediaType.WILDCARD)
public class GsonMessageBodyHandler implements MessageBodyReader<Object>, MessageBodyWriter<Object> {
+ public static final Logger logger = LoggerFactory.getLogger(GsonMessageBodyHandler.class);
+
/**
* Object to be used to serialize and de-serialize.
*/
@@ -55,6 +59,8 @@ public class GsonMessageBodyHandler implements MessageBodyReader<Object>, Messag
*/
public GsonMessageBodyHandler() {
this(new Gson());
+
+ logger.info("Using GSON for REST calls");
}
/**
diff --git a/gson/src/main/java/org/onap/policy/common/gson/JacksonHandler.java b/gson/src/main/java/org/onap/policy/common/gson/JacksonHandler.java
index a1c54afa..b2648b0b 100644
--- a/gson/src/main/java/org/onap/policy/common/gson/JacksonHandler.java
+++ b/gson/src/main/java/org/onap/policy/common/gson/JacksonHandler.java
@@ -37,6 +37,8 @@ public class JacksonHandler extends GsonMessageBodyHandler {
*/
public JacksonHandler() {
this(new GsonBuilder());
+
+ logger.info("Using GSON with Jackson behaviors for REST calls");
}
/**
@@ -49,8 +51,6 @@ public class JacksonHandler extends GsonMessageBodyHandler {
.registerTypeAdapterFactory(new JacksonMethodAdapterFactory())
.setExclusionStrategies(new JacksonExclusionStrategy())
.create());
-
- logger.info("Using GSON for REST calls");
}
}