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:com.baidu.terminator.manager.action.LinkAction.java
/** * Delete link through id.//from w ww. j av a2s.co m * * @param linkId * link id */ @RequestMapping(value = "/{linkId}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) public void deleteLink(@PathVariable int linkId) { linkService.deleteLink(linkId); }
From source file:org.openlmis.fulfillment.web.TemplateController.java
/** * Allows deleting template./*from w w w. j a v a2 s .c om*/ * * @param templateId UUID of template which we want to delete * @return ResponseEntity containing the HTTP Status */ @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) public ResponseEntity<TemplateDto> deleteTemplate(@PathVariable("id") UUID templateId) { Template template = templateRepository.findOne(templateId); if (template == null) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } else { templateRepository.delete(template); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } }
From source file:cn.org.once.cstack.volumes.VolumeControllerTestIT.java
/** * Create and delete a volume//ww w .j a v a 2 s . c o m * * @throws Exception */ @Test public void createAndDeleteVolume() throws Exception { VolumeResource volumeResource = new VolumeResource(); volumeResource.setName("shared" + new Random().nextInt(100000)); ResultActions resultActions = createVolume(volumeResource); resultActions.andExpect(status().isCreated()); volumeResource = getVolumeResource(mapper, resultActions); existVolume(volumeResource); deleteVolume(volumeResource.getId(), HttpStatus.NO_CONTENT); }
From source file:org.cloudfoundry.tools.timeout.HotSwappingTimeoutProtectionStrategy.java
public void handlePoll(TimeoutProtectionHttpRequest request, HttpServletResponse response) throws IOException { RequestCoordinator requestCoordinator = this.requestCoordinators.get(request); synchronized (requestCoordinator) { requestCoordinator.setPollResponse(response); }//w w w .ja v a2 s. c o m try { requestCoordinator.awaitPollReponseConsumed(this.longPollTime); } catch (InterruptedException e) { } synchronized (requestCoordinator) { if (requestCoordinator.isPollResponseConsumed()) { try { requestCoordinator.awaitFinish(this.failTimeout); } catch (InterruptedException e) { throw new IllegalStateException("Timeout waiting for cleanup"); } finally { this.requestCoordinators.delete(request); } } else { requestCoordinator.clearPollResponse(); response.setHeader(TimeoutProtectionHttpHeader.POLL, request.getUid()); response.setStatus(HttpStatus.NO_CONTENT.value()); } } }
From source file:org.nekorp.workflow.backend.security.controller.imp.UsuarioClienteWebControllerImp.java
/**{@inheritDoc}*/ @Override/*w w w .j av a2 s . c om*/ @RequestMapping(value = "/{alias}", method = RequestMethod.DELETE) public void borrar(@PathVariable final String alias, final HttpServletResponse response) { String buscar = StringUtils.lowerCase(alias); UsuarioClienteWeb resultado = usuarioClienteWebDAO.consultar(buscar); if (resultado == null) { response.setStatus(HttpStatus.NO_CONTENT.value()); return; } usuarioClienteWebDAO.borrar(resultado); //se acepto la peticion de borrado, no quiere decir que sucede de inmediato. response.setStatus(HttpStatus.ACCEPTED.value()); }
From source file:net.navasoft.madcoin.backend.services.controller.BusinessController.java
@ExceptionHandler(InsufficientCategoryException.class) @ResponseStatus(value = HttpStatus.NO_CONTENT) private @ResponseBody FailedResponseVO handleNoCategories(BusinessControllerException e) { FailedResponseVO value = new BusinessFailedResponseVO(); value.setErrorMessage(e.getMessage()); value.setCauses(e.getCauses());//from ww w .jav a2 s.c om value.setTip(e.formulateTips()); return value; }
From source file:web.UsersRESTController.java
/** * Removes a user from the database through REST API * @param id// w w w . j av a 2 s . com * @return */ @RequestMapping(value = "/api/users/userinfo/{id}", method = RequestMethod.DELETE) public ResponseEntity<Users> deleteUser(@PathVariable("id") int id) { Users user = null; //gets User info. Returns NOT_FOUND error if no User exists try { user = dao.getUserById(id); } catch (EmptyResultDataAccessException ex) { return new ResponseEntity<Users>(HttpStatus.NOT_FOUND); } //otherwise returns NO_CONTENT status after deletion dao.deleteUser(id); return new ResponseEntity<Users>(HttpStatus.NO_CONTENT); }
From source file:org.mitre.uma.web.ClaimsAPI.java
@RequestMapping(value = "/{rsid}", method = RequestMethod.DELETE, produces = MimeTypeUtils.APPLICATION_JSON_VALUE) public String deleteResourceSet(@PathVariable("rsid") Long id, Model m, Authentication auth) { ResourceSet rs = resourceSetService.getById(id); if (rs == null) { m.addAttribute(HttpCodeView.CODE, HttpStatus.NOT_FOUND); m.addAttribute(JsonErrorView.ERROR, "not_found"); return JsonErrorView.VIEWNAME; } else {//from w w w. ja va 2 s . co m if (!auth.getName().equals(rs.getOwner())) { logger.warn("Unauthorized resource set request from bad user; expected " + rs.getOwner() + " got " + auth.getName()); // it wasn't issued to this user m.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN); return JsonErrorView.VIEWNAME; } else { resourceSetService.remove(rs); m.addAttribute(HttpCodeView.CODE, HttpStatus.NO_CONTENT); return HttpCodeView.VIEWNAME; } } }
From source file:org.avidj.zuul.rs.Zuul.java
/** * Release the given lock if it is held by the given {@code session}. * @param session the session id to release the lock for * @param request the request// w w w .ja v a 2 s. c om * @param uriBuilder a builder for the response location header URI * @return {@code true}, iff the lock was released */ @RequestMapping(value = "/s/{id}/**", method = RequestMethod.DELETE) public ResponseEntity<String> release(@PathVariable("id") String session, HttpServletRequest request, UriComponentsBuilder uriBuilder) { final List<String> path = getLockPath(request, session); final boolean deleted = lm.release(session, path); HttpStatus httpStatus = deleted ? HttpStatus.NO_CONTENT : HttpStatus.FORBIDDEN; UriComponents uriComponents = uriBuilder.path("/s/{id}/{lockPath}").buildAndExpand(session, Strings.join("/", path)); HttpHeaders headers = new HttpHeaders(); headers.setLocation(uriComponents.toUri()); return new ResponseEntity<String>(headers, httpStatus); }
From source file:ca.qhrtech.controllers.GameController.java
@ApiMethod(description = "Searches for BoardGameGeek Games to Link") @RequestMapping(value = "/game/{id}/link", method = RequestMethod.GET) public ResponseEntity<List<Game>> findLinkableGames(@PathVariable("id") long id) { List<Game> linkableGames = bggService.findLinkableGames(id); if (linkableGames.isEmpty()) { return new ResponseEntity<>(HttpStatus.NO_CONTENT); }// ww w . j a v a2 s. c om return new ResponseEntity(linkableGames, HttpStatus.OK); }