aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap/vid/controllers/WebConfig.java
diff options
context:
space:
mode:
authorgolabek <tomasz.golabek@nokia.com>2018-08-29 15:29:56 +0200
committergolabek <tomasz.golabek@nokia.com>2018-11-15 10:43:56 +0100
commit34f18a178b4b38632f435e776e15ce2f79d58094 (patch)
tree7bb78584134cbbe35f2db7f0f30ee0cd9ca7065b /vid-app-common/src/main/java/org/onap/vid/controllers/WebConfig.java
parentf4766e0a53cb3e8408d56aaa113e6350024566b3 (diff)
Get subscribers rewritten to new rest client
Should be merged after: I561f8a5d95ec35fdddc648b24965dd9dac03c9a4 It contains cherry-picked changes from that review Change-Id: I22a9e9ce709ae4dd3abcf7a9cda6354a4f656b00 Issue-ID: VID-269 Signed-off-by: golabek <tomasz.golabek@nokia.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/controllers/WebConfig.java')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controllers/WebConfig.java44
1 files changed, 36 insertions, 8 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/controllers/WebConfig.java b/vid-app-common/src/main/java/org/onap/vid/controllers/WebConfig.java
index fb8b5195c..56dce9ac7 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controllers/WebConfig.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controllers/WebConfig.java
@@ -22,7 +22,7 @@
package org.onap.vid.controllers;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import io.joshworks.restclient.http.mapper.ObjectMapper;
import java.io.IOException;
import org.onap.vid.aai.AaiClient;
import org.onap.vid.aai.AaiClientInterface;
@@ -70,8 +70,8 @@ public class WebConfig {
* @return the object mapper
*/
@Bean
- public ObjectMapper getObjectMapper() {
- return new ObjectMapper();
+ public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper() {
+ return new com.fasterxml.jackson.databind.ObjectMapper();
}
@@ -166,13 +166,41 @@ public class WebConfig {
return new SchedulerRestInterface();
}
+ @Bean(name = "aaiClientForFasterXmlMapping")
+ public AaiOverTLSClientInterface getAaiClientForFasterXmlMapping(){
+ ObjectMapper objectMapper = new ObjectMapper() {
- @Bean
- public AaiOverTLSClientInterface getAaiOverTLSClientInterface() {
+ com.fasterxml.jackson.databind.ObjectMapper om = new com.fasterxml.jackson.databind.ObjectMapper();
- io.joshworks.restclient.http.mapper.ObjectMapper objectMapper = new io.joshworks.restclient.http.mapper.ObjectMapper() {
+ @Override
+ public <T> T readValue(String s, Class<T> aClass) {
+ try {
+ return om.readValue(s, aClass);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
- ObjectMapper om = new ObjectMapper();
+ @Override
+ public String writeValue(Object o) {
+ try {
+ return om.writeValueAsString(o);
+ } catch (JsonProcessingException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+
+ return new AaiOverTLSClient(new SyncRestClient(objectMapper), new AaiOverTLSPropertySupplier());
+ }
+
+
+ @Bean(name = "aaiClientForCodehausMapping")
+ public AaiOverTLSClientInterface getAaiClientForCodehausMapping() {
+
+ ObjectMapper objectMapper = new ObjectMapper() {
+
+ org.codehaus.jackson.map.ObjectMapper om = new org.codehaus.jackson.map.ObjectMapper();
@Override
public <T> T readValue(String s, Class<T> aClass) {
@@ -187,7 +215,7 @@ public class WebConfig {
public String writeValue(Object o) {
try {
return om.writeValueAsString(o);
- } catch (JsonProcessingException e) {
+ } catch (IOException e) {
throw new RuntimeException(e);
}
}