Use YangConstants.RFC6020_YIN_MEDIA_TYPE
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / RestconfApplication.java
index 89c858788043374e911f576b6cd2f35a74ee8279..36528b8b824889461555b99aa703997ea1ac4d67 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.restconf.nb.rfc8040;
 import com.google.common.collect.ImmutableSet;
 import java.util.HashSet;
 import java.util.Set;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.core.Application;
 import org.opendaylight.restconf.nb.rfc8040.handlers.DOMMountPointServiceHandler;
 import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
@@ -17,6 +19,7 @@ import org.opendaylight.restconf.nb.rfc8040.jersey.providers.JsonNormalizedNodeB
 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.NormalizedNodeJsonBodyWriter;
 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.NormalizedNodeXmlBodyWriter;
 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.XmlNormalizedNodeBodyReader;
+import org.opendaylight.restconf.nb.rfc8040.jersey.providers.errors.RestconfDocumentedExceptionMapper;
 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.patch.JsonToPatchBodyReader;
 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.patch.PatchJsonBodyWriter;
 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.patch.PatchXmlBodyWriter;
@@ -25,11 +28,14 @@ import org.opendaylight.restconf.nb.rfc8040.jersey.providers.schema.SchemaExport
 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.schema.SchemaExportContentYinBodyWriter;
 import org.opendaylight.restconf.nb.rfc8040.services.wrapper.ServicesWrapper;
 
+@Singleton
 public class RestconfApplication extends Application {
+
     private final SchemaContextHandler schemaContextHandler;
     private final DOMMountPointServiceHandler mountPointServiceHandler;
     private final ServicesWrapper servicesWrapper;
 
+    @Inject
     public RestconfApplication(SchemaContextHandler schemaContextHandler,
             DOMMountPointServiceHandler mountPointServiceHandler, ServicesWrapper servicesWrapper) {
         this.schemaContextHandler = schemaContextHandler;
@@ -54,6 +60,7 @@ public class RestconfApplication extends Application {
         singletons.add(new JsonToPatchBodyReader(schemaContextHandler, mountPointServiceHandler));
         singletons.add(new XmlNormalizedNodeBodyReader(schemaContextHandler, mountPointServiceHandler));
         singletons.add(new XmlToPatchBodyReader(schemaContextHandler, mountPointServiceHandler));
+        singletons.add(new RestconfDocumentedExceptionMapper(schemaContextHandler));
         return singletons;
     }
 }