Ray Milkey
Committed by Gerrit Code Review

Fix returned responses for DELETE operations

Change-Id: I5ad585841c69da86d89bca493a887e9af2cc4da3
...@@ -295,21 +295,23 @@ public class NetworkConfigWebResource extends AbstractWebResource { ...@@ -295,21 +295,23 @@ public class NetworkConfigWebResource extends AbstractWebResource {
295 public Response delete() { 295 public Response delete() {
296 NetworkConfigService service = get(NetworkConfigService.class); 296 NetworkConfigService service = get(NetworkConfigService.class);
297 service.removeConfig(); 297 service.removeConfig();
298 - return Response.ok().build(); 298 + return Response.noContent().build();
299 } 299 }
300 300
301 /** 301 /**
302 * Clear all network configurations for a subject class. 302 * Clear all network configurations for a subject class.
303 * 303 *
304 * @param subjectClassKey subject class key 304 * @param subjectClassKey subject class key
305 + * @return 204 NO CONTENT
305 */ 306 */
306 @DELETE 307 @DELETE
307 @Path("{subjectClassKey}") 308 @Path("{subjectClassKey}")
308 @SuppressWarnings("unchecked") 309 @SuppressWarnings("unchecked")
309 - public void delete(@PathParam("subjectClassKey") String subjectClassKey) { 310 + public Response delete(@PathParam("subjectClassKey") String subjectClassKey) {
310 NetworkConfigService service = get(NetworkConfigService.class); 311 NetworkConfigService service = get(NetworkConfigService.class);
311 service.getSubjects(service.getSubjectFactory(subjectClassKey).subjectClass()) 312 service.getSubjects(service.getSubjectFactory(subjectClassKey).subjectClass())
312 .forEach(subject -> service.removeConfig(subject)); 313 .forEach(subject -> service.removeConfig(subject));
314 + return Response.noContent().build();
313 } 315 }
314 316
315 /** 317 /**
...@@ -317,14 +319,16 @@ public class NetworkConfigWebResource extends AbstractWebResource { ...@@ -317,14 +319,16 @@ public class NetworkConfigWebResource extends AbstractWebResource {
317 * 319 *
318 * @param subjectClassKey subjectKey class key 320 * @param subjectClassKey subjectKey class key
319 * @param subjectKey subjectKey key 321 * @param subjectKey subjectKey key
322 + * @return 204 NO CONTENT
320 */ 323 */
321 @DELETE 324 @DELETE
322 @Path("{subjectClassKey}/{subjectKey}") 325 @Path("{subjectClassKey}/{subjectKey}")
323 @SuppressWarnings("unchecked") 326 @SuppressWarnings("unchecked")
324 - public void delete(@PathParam("subjectClassKey") String subjectClassKey, 327 + public Response delete(@PathParam("subjectClassKey") String subjectClassKey,
325 @PathParam("subjectKey") String subjectKey) { 328 @PathParam("subjectKey") String subjectKey) {
326 NetworkConfigService service = get(NetworkConfigService.class); 329 NetworkConfigService service = get(NetworkConfigService.class);
327 service.removeConfig(subjectKey); 330 service.removeConfig(subjectKey);
331 + return Response.noContent().build();
328 } 332 }
329 333
330 /** 334 /**
...@@ -333,17 +337,19 @@ public class NetworkConfigWebResource extends AbstractWebResource { ...@@ -333,17 +337,19 @@ public class NetworkConfigWebResource extends AbstractWebResource {
333 * @param subjectClassKey subjectKey class key 337 * @param subjectClassKey subjectKey class key
334 * @param subjectKey subjectKey key 338 * @param subjectKey subjectKey key
335 * @param configKey configuration class key 339 * @param configKey configuration class key
340 + * @return 204 NO CONTENT
336 */ 341 */
337 @DELETE 342 @DELETE
338 @Path("{subjectClassKey}/{subjectKey}/{configKey}") 343 @Path("{subjectClassKey}/{subjectKey}/{configKey}")
339 @SuppressWarnings("unchecked") 344 @SuppressWarnings("unchecked")
340 - public void delete(@PathParam("subjectClassKey") String subjectClassKey, 345 + public Response delete(@PathParam("subjectClassKey") String subjectClassKey,
341 @PathParam("subjectKey") String subjectKey, 346 @PathParam("subjectKey") String subjectKey,
342 @PathParam("configKey") String configKey) { 347 @PathParam("configKey") String configKey) {
343 NetworkConfigService service = get(NetworkConfigService.class); 348 NetworkConfigService service = get(NetworkConfigService.class);
344 service.removeConfig(subjectClassKey, 349 service.removeConfig(subjectClassKey,
345 service.getSubjectFactory(subjectClassKey).createSubject(subjectKey), 350 service.getSubjectFactory(subjectClassKey).createSubject(subjectKey),
346 configKey); 351 configKey);
352 + return Response.noContent().build();
347 } 353 }
348 354
349 } 355 }
......