summaryrefslogtreecommitdiffstats
path: root/policy-management
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-09-13 17:31:46 -0400
committerJim Hahn <jrh3@att.com>2019-09-16 18:24:42 -0400
commit50cd3fbf4561fe445751d299c53efc499df6dfb6 (patch)
tree28d10581129d3b5107693d7183bd2f46af419377 /policy-management
parent89a8e32aabc34432b3d614f452e10f7125b478ce (diff)
Add YAML support to drools-pdp rest servlets
Drools-pdp depends on some of the GsonJackson annotations that cannot be easily worked around via standard gson. Consequently, this continues to use the JacksonHandler for json-encoding, thus it uses the YamlJacksonHandler for yaml-encoding. Added YAML to swagger "consumes" list. Change-Id: Ic70c68bb274222db571b3515cbf1ab22d9ff2366 Issue-ID: POLICY-2081 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'policy-management')
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java8
-rw-r--r--policy-management/src/main/server/config/engine.properties2
2 files changed, 6 insertions, 4 deletions
diff --git a/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java b/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java
index 2d40a1f1..c5841b06 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java
@@ -55,6 +55,7 @@ import org.onap.policy.common.endpoints.event.comm.TopicEndpoint;
import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.TopicSource;
+import org.onap.policy.common.endpoints.http.server.YamlMessageBodyHandler;
import org.onap.policy.drools.controller.DroolsController;
import org.onap.policy.drools.features.PolicyControllerFeatureApi;
import org.onap.policy.drools.features.PolicyEngineFeatureApi;
@@ -78,11 +79,12 @@ import org.slf4j.LoggerFactory;
*/
@Path("/policy/pdp")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
+@Produces({MediaType.APPLICATION_JSON, YamlMessageBodyHandler.APPLICATION_YAML})
+@Consumes({MediaType.APPLICATION_JSON, YamlMessageBodyHandler.APPLICATION_YAML})
@Api
@SwaggerDefinition(info = @Info(description = "PDP-D Telemetry Services", version = "v1.0", title = "PDP-D Telemetry"),
- consumes = {MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN}, produces = {MediaType.APPLICATION_JSON},
+ consumes = {MediaType.APPLICATION_JSON, YamlMessageBodyHandler.APPLICATION_YAML, MediaType.TEXT_PLAIN},
+ produces = {MediaType.APPLICATION_JSON, YamlMessageBodyHandler.APPLICATION_YAML},
schemes = {SwaggerDefinition.Scheme.HTTP},
tags = {@Tag(name = "pdp-d-telemetry", description = "Drools PDP Telemetry Operations")})
public class RestManager {
diff --git a/policy-management/src/main/server/config/engine.properties b/policy-management/src/main/server/config/engine.properties
index 05f682e3..aa9b6d80 100644
--- a/policy-management/src/main/server/config/engine.properties
+++ b/policy-management/src/main/server/config/engine.properties
@@ -42,7 +42,7 @@ http.server.services.SECURED-CONFIG.managed=false
http.server.services.SECURED-CONFIG.swagger=true
http.server.services.SECURED-CONFIG.https=true
http.server.services.SECURED-CONFIG.aaf=${env:AAF}
-http.server.services.SECURED-CONFIG.serialization.provider=org.onap.policy.common.gson.JacksonHandler
+http.server.services.SECURED-CONFIG.serialization.provider=org.onap.policy.common.gson.JacksonHandler,org.onap.policy.common.endpoints.http.server.YamlJacksonHandler
aaf.namespace=${env:AAF_NAMESPACE}
aaf.root.permission=${env:AAF_NAMESPACE}.pdpd