X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=restconf%2Fsal-rest-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fsal%2Frest%2Fimpl%2FJsonNormalizedNodeBodyReader.java;h=179d2ad59c5ed20a6a6821efb83949d77dbd6729;hb=1927682ff5f558c9120aafbf68bee75a5d5cfb07;hp=34b69e5dca1cf322d365416ac4161ec1396253b5;hpb=72fa00b36dff4b41997f5935daa5a77e1afd1b52;p=netconf.git diff --git a/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java b/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java index 34b69e5dca..179d2ad59c 100644 --- a/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java +++ b/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java @@ -30,7 +30,7 @@ import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext; import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException; import org.opendaylight.netconf.sal.restconf.impl.RestconfError.ErrorTag; import org.opendaylight.netconf.sal.restconf.impl.RestconfError.ErrorType; -import org.opendaylight.restconf.Draft16; +import org.opendaylight.restconf.Draft17; import org.opendaylight.restconf.utils.RestconfConstants; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode; @@ -53,7 +53,7 @@ import org.slf4j.LoggerFactory; @Provider @Consumes({ Draft02.MediaTypes.DATA + RestconfService.JSON, Draft02.MediaTypes.OPERATION + RestconfService.JSON, - Draft16.MediaTypes.DATA + RestconfConstants.JSON, MediaType.APPLICATION_JSON }) + Draft17.MediaTypes.DATA + RestconfConstants.JSON, MediaType.APPLICATION_JSON }) public class JsonNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsProvider implements MessageBodyReader { private final static Logger LOG = LoggerFactory.getLogger(JsonNormalizedNodeBodyReader.class); @@ -70,7 +70,14 @@ public class JsonNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsPr final MultivaluedMap 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