Bug 6848 - update url pattern of restconf from 16 to 17
[netconf.git] / restconf / sal-rest-connector / src / main / java / org / opendaylight / netconf / sal / rest / impl / JsonNormalizedNodeBodyReader.java
index ea51998d9f06d2199054f23dcadae0e7010c0ca8..179d2ad59c5ed20a6a6821efb83949d77dbd6729 100644 (file)
@@ -70,7 +70,14 @@ public class JsonNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsPr
             final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws IOException,
             WebApplicationException {
         try {
-            return readFrom(getInstanceIdentifierContext(), entityStream, isPost());
+            if (getUriInfo().getAbsolutePath().getPath().contains(RestconfConstants.DRAFT_PATTERN)) {
+                final org.opendaylight.restconf.jersey.providers.JsonNormalizedNodeBodyReader jsonReaderNewRest =
+                        new org.opendaylight.restconf.jersey.providers.JsonNormalizedNodeBodyReader();
+                jsonReaderNewRest.injectParams(getUriInfo(), getRequest());
+                return jsonReaderNewRest.readFrom(type, genericType, annotations, mediaType, httpHeaders, entityStream);
+            } else {
+                return readFrom(getInstanceIdentifierContext(), entityStream, isPost());
+            }
         } catch (final Exception e) {
             propagateExceptionAs(e);
             return null; // no-op