Bug 7735 - Update restconf models by RFC 8040
[netconf.git] / restconf / sal-rest-connector / src / main / java / org / opendaylight / netconf / sal / rest / impl / PATCHXmlBodyWriter.java
index a4ac36178cccca6280977e4b01f6384a6ab7b4b8..9a60cabc5e721e4d74468153c7e218defe8149af 100644 (file)
@@ -12,6 +12,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
@@ -28,12 +29,12 @@ import org.opendaylight.netconf.sal.rest.api.RestconfService;
 import org.opendaylight.netconf.sal.restconf.impl.PATCHStatusContext;
 import org.opendaylight.netconf.sal.restconf.impl.PATCHStatusEntity;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfError;
-import org.opendaylight.restconf.Draft11;
+import org.opendaylight.restconf.Rfc8040;
 import org.opendaylight.restconf.utils.RestconfConstants;
 
 @Provider
 @Produces({Draft02.MediaTypes.PATCH_STATUS + RestconfService.XML,
-        Draft11.MediaTypes.PATCH_STATUS + RestconfConstants.XML})
+        Rfc8040.MediaTypes.PATCH_STATUS + RestconfConstants.XML})
 public class PATCHXmlBodyWriter implements MessageBodyWriter<PATCHStatusContext> {
 
     private static final XMLOutputFactory XML_FACTORY;
@@ -62,7 +63,7 @@ public class PATCHXmlBodyWriter implements MessageBodyWriter<PATCHStatusContext>
             throws IOException, WebApplicationException {
 
         try {
-            final XMLStreamWriter xmlWriter = XML_FACTORY.createXMLStreamWriter(entityStream);
+            final XMLStreamWriter xmlWriter = XML_FACTORY.createXMLStreamWriter(entityStream, StandardCharsets.UTF_8.name());
             writeDocument(xmlWriter, patchStatusContext);
         } catch (final XMLStreamException e) {
             throw new IllegalStateException(e);