List of usage examples for org.springframework.http HttpStatus NO_CONTENT
HttpStatus NO_CONTENT
To view the source code for org.springframework.http HttpStatus NO_CONTENT.
Click Source Link
From source file:ca.qhrtech.controllers.TableController.java
@RequestMapping(value = "/table/{id}", method = RequestMethod.DELETE) public ResponseEntity<BGLTable> deleteTable(@PathVariable("id") long id) { if (tableService.findTableById(id) == null) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); }//from w w w . ja va 2s . com tableService.deleteTable(id); return new ResponseEntity<>(HttpStatus.NO_CONTENT); }
From source file:at.ac.tuwien.dsg.cloud.utilities.gateway.registry.UserController.java
@RequestMapping(method = RequestMethod.DELETE, value = REST_USER_PATH_VARIABLE) public ResponseEntity<String> remove(@PathVariable String user) { boolean res = this.kongUsers.getUsers().removeIf((KongUser u) -> { if (u.getUserName().equals(user)) { RequestEntity<Void> request = RequestEntity .delete(URI.create(this.kongUris.getKongConsumerIdUri(u.getId()))).accept(MediaType.ALL) .build();/*w w w . j a va2 s . c o m*/ ResponseEntity<String> resp = restUtilities.simpleRestExchange(request, String.class); if (resp == null || resp.getStatusCode() != HttpStatus.NO_CONTENT) { return false; } return true; } return false; }); if (!res) { return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } return new ResponseEntity<>(HttpStatus.OK); }
From source file:com.mycompany.springrest.controllers.RoleController.java
@RequestMapping(value = "/role/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Role> deleteRole(@PathVariable("id") int id) { logger.info("Fetching & Deleting Role with id " + id); Role role = roleService.getRoleById(id); if (role == null) { logger.info("Unable to delete. Role with id " + id + " not found"); return new ResponseEntity<Role>(HttpStatus.NOT_FOUND); }// w w w .j a v a 2 s.c om roleService.removeRole(id); return new ResponseEntity<Role>(HttpStatus.NO_CONTENT); }
From source file:rest.DependenciaRestController.java
@RequestMapping(value = "/dependencia/{codDep}", method = RequestMethod.DELETE) public ResponseEntity<DependenciaBean> deleteDependencia(@PathVariable("codDep") long codDep) { DependenciaBean dependencia = dependenciaService.findById(codDep); if (dependencia == null) { System.out.println("No se puede eliminar la dependencia con cod_dep = " + codDep); return new ResponseEntity<DependenciaBean>(HttpStatus.NOT_FOUND); }//w w w .jav a 2s . c o m dependenciaService.deleteById(codDep); return new ResponseEntity<DependenciaBean>(HttpStatus.NO_CONTENT); }
From source file:com.jiwhiz.rest.user.UserCommentRestController.java
/** * Updates comment content by current user. * /*w w w . ja v a 2 s . c om*/ * @param commentId * @param updateMap * @return */ @RequestMapping(method = RequestMethod.PATCH, value = URL_USER_COMMENTS_COMMENT) @Transactional public HttpEntity<Void> updateComment(@PathVariable("commentId") String commentId, @RequestBody Map<String, String> updateMap) { CommentPost comment = getCommentPostByIdAndCheckAuthor(commentId); String content = updateMap.get("content"); if (content != null) { comment.update(content); commentPostRepository.save(comment); } return new ResponseEntity<Void>(HttpStatus.NO_CONTENT); }
From source file:za.ac.cput.project.universalhardwarestorev2.api.ItemApi.java
@RequestMapping(value = "/item/delete/{id}", method = RequestMethod.GET) public ResponseEntity<Item> deleteItem(@PathVariable("id") long id) { System.out.println("Fetching & Deleting Item with id " + id); Item item = service.findById(id);/*w w w . j av a2s . c o m*/ if (item == null) { System.out.println("Unable to delete. Item with id " + id + " not found"); return new ResponseEntity<Item>(HttpStatus.NOT_FOUND); } service.delete(item); return new ResponseEntity<Item>(HttpStatus.NO_CONTENT); }
From source file:za.ac.cput.project.universalhardwarestorev2.api.LoginApi.java
@RequestMapping(value = "/logins/", method = RequestMethod.GET) public ResponseEntity<List<Login>> listAllLogins() { List<Login> Logins = service.findAll(); if (Logins.isEmpty()) { return new ResponseEntity<List<Login>>(HttpStatus.NO_CONTENT);//You many decide to return HttpStatus.NOT_FOUND }//from w w w. j a v a 2 s . c o m return new ResponseEntity<List<Login>>(Logins, HttpStatus.OK); }
From source file:com.swcguild.blacksmithblogcapstone.controller.BlackSmithController.java
@RequestMapping(value = "edit/blogEntry/{id}", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.NO_CONTENT) public void editBlogEntry(@PathVariable("id") int idOfBlogEntryToEdit, @RequestBody BlogEntry blogEntryEdits) { blogEntryEdits.setId(idOfBlogEntryToEdit); dao.editBlogEntry(blogEntryEdits);/*from www . java 2 s . co m*/ }
From source file:org.openbaton.nfvo.api.RestNetworkServiceDescriptor.java
/** * Removes a list Network Service Descriptor from the NSDs Repository * * @param ids: the list of the ids// w w w.j a v a 2 s .co m * @throws NotFoundException * @throws InterruptedException * @throws ExecutionException * @throws WrongStatusException * @throws VimException */ @RequestMapping(value = "/multipledelete", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.NO_CONTENT) public void multipleDelete(@RequestBody @Valid List<String> ids, @RequestHeader(value = "project-id") String projectId) throws InterruptedException, ExecutionException, WrongStatusException, VimException, NotFoundException { for (String id : ids) networkServiceDescriptorManagement.delete(id, projectId); }
From source file:org.bozzo.ipplan.web.AddressPlanController.java
@RequestMapping(value = "/{planId}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) public void deleteAddressPlan(@PathVariable Integer infraId, @PathVariable Long planId) { logger.info("delete subnet with id: {} (infra id: {})", planId, infraId); this.repository.deleteByInfraIdAndId(infraId, planId); }