Fix returned responses for DELETE operations
Change-Id: I5ad585841c69da86d89bca493a887e9af2cc4da3
diff --git a/web/api/src/main/java/org/onosproject/rest/resources/NetworkConfigWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/NetworkConfigWebResource.java
index 00daa28..fc0b55d 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/NetworkConfigWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/NetworkConfigWebResource.java
@@ -295,21 +295,23 @@
public Response delete() {
NetworkConfigService service = get(NetworkConfigService.class);
service.removeConfig();
- return Response.ok().build();
+ return Response.noContent().build();
}
/**
* Clear all network configurations for a subject class.
*
* @param subjectClassKey subject class key
+ * @return 204 NO CONTENT
*/
@DELETE
@Path("{subjectClassKey}")
@SuppressWarnings("unchecked")
- public void delete(@PathParam("subjectClassKey") String subjectClassKey) {
+ public Response delete(@PathParam("subjectClassKey") String subjectClassKey) {
NetworkConfigService service = get(NetworkConfigService.class);
service.getSubjects(service.getSubjectFactory(subjectClassKey).subjectClass())
.forEach(subject -> service.removeConfig(subject));
+ return Response.noContent().build();
}
/**
@@ -317,14 +319,16 @@
*
* @param subjectClassKey subjectKey class key
* @param subjectKey subjectKey key
+ * @return 204 NO CONTENT
*/
@DELETE
@Path("{subjectClassKey}/{subjectKey}")
@SuppressWarnings("unchecked")
- public void delete(@PathParam("subjectClassKey") String subjectClassKey,
+ public Response delete(@PathParam("subjectClassKey") String subjectClassKey,
@PathParam("subjectKey") String subjectKey) {
NetworkConfigService service = get(NetworkConfigService.class);
service.removeConfig(subjectKey);
+ return Response.noContent().build();
}
/**
@@ -333,17 +337,19 @@
* @param subjectClassKey subjectKey class key
* @param subjectKey subjectKey key
* @param configKey configuration class key
+ * @return 204 NO CONTENT
*/
@DELETE
@Path("{subjectClassKey}/{subjectKey}/{configKey}")
@SuppressWarnings("unchecked")
- public void delete(@PathParam("subjectClassKey") String subjectClassKey,
+ public Response delete(@PathParam("subjectClassKey") String subjectClassKey,
@PathParam("subjectKey") String subjectKey,
@PathParam("configKey") String configKey) {
NetworkConfigService service = get(NetworkConfigService.class);
service.removeConfig(subjectClassKey,
service.getSubjectFactory(subjectClassKey).createSubject(subjectKey),
configKey);
+ return Response.noContent().build();
}
}