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:io.github.howiefh.jeews.modules.sys.controller.RoleController.java
@RequiresPermissions("role:delete") @RequestMapping(value = "", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) public void deleteBatch(@RequestBody List<Long> ids) { roleService.deleteBatch(ids);/*from ww w. j a v a 2s .c o m*/ }
From source file:com.parivero.swagger.demo.controller.PersonaController.java
@RequestMapping(method = RequestMethod.PUT) @ResponseStatus(HttpStatus.NO_CONTENT) @ApiOperation(value = "Modificacin de Persona") @ApiErrors(errors = { @ApiError(code = 400, reason = "Request invalido") }) public void modificacion( @ApiParam(value = "recurso a modificar", required = true) @RequestBody Persona persona) { if (persona.getId() == null) { throw new IllegalArgumentException(); }//from ww w . j a va2 s .com if (persona.getId() == 0) { throw new NotFoundException(); } }
From source file:org.venice.piazza.servicecontroller.messaging.handlers.SearchServiceHandler.java
/** * //from w ww . j a va 2 s . c om * @param criteria * to search. field and regex expression * @return a String of ResourceMetadata items that match the search */ public ResponseEntity<String> handle(SearchCriteria criteria) { ResponseEntity<String> responseEntity; String result; if (criteria != null) { coreLogger.log("About to search using criteria" + criteria, Severity.INFORMATIONAL); List<Service> results = accessor.search(criteria); if (results.isEmpty()) { coreLogger.log("No results were returned searching for field " + criteria.getField() + " and search criteria " + criteria.getPattern(), Severity.INFORMATIONAL); responseEntity = new ResponseEntity<>("No results were returned searching for field", HttpStatus.NO_CONTENT); } else { ObjectMapper mapper = makeObjectMapper(); try { result = mapper.writeValueAsString(results); responseEntity = new ResponseEntity<>(result, HttpStatus.OK); } catch (JsonProcessingException jpe) { // This should never happen, but still have to catch it LOGGER.error("There was a problem generating the Json response", jpe); coreLogger.log("There was a problem generating the Json response", Severity.ERROR); responseEntity = new ResponseEntity<>("Could not search for services", HttpStatus.NOT_FOUND); } } } else responseEntity = new ResponseEntity<>("No criteria was specified", HttpStatus.NO_CONTENT); return responseEntity; }
From source file:com.jiwhiz.rest.user.UserAccountRestController.java
/** * Updates current user profile, like name, email, website, imageUrl. * // w ww . j a va2 s.co m * @param updateMap * @return * @throws ResourceNotFoundException */ @RequestMapping(method = RequestMethod.PATCH, value = URL_USER_PROFILE) @Transactional public HttpEntity<Void> patchUserProfile(@RequestBody Map<String, String> updateMap) throws ResourceNotFoundException { UserAccount currentUser = getCurrentAuthenticatedUser(); String displayName = updateMap.get("displayName"); if (displayName != null) { currentUser.setDisplayName(displayName); } String email = updateMap.get("email"); if (email != null) { currentUser.setEmail(email); } String webSite = updateMap.get("webSite"); if (webSite != null) { currentUser.setWebSite(webSite); } String imageUrl = updateMap.get("imageUrl"); if (imageUrl != null) { currentUser.setImageUrl(imageUrl); } userAccountRepository.save(currentUser); return new ResponseEntity<Void>(HttpStatus.NO_CONTENT); }
From source file:fr.esiea.esieaddress.controllers.crud.CrudContactCtrl.java
@Secured("ROLE_USER") @RequestMapping(value = "", method = RequestMethod.PUT, consumes = "application/json") @ResponseStatus(HttpStatus.NO_CONTENT) public void edit(@RequestBody Contact contact) throws ServiceException, DaoException { LOGGER.info("[Controller] Querying to edit Contact : \"" + contact.toString() + "\""); crudService.save(contact);//from w ww. j av a 2 s . c o m }
From source file:com.thesoftwareguild.capstoneblog.controller.HomeController.java
@RequestMapping(value = "/post/{id}", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.NO_CONTENT) public void editPost(@PathVariable("id") int id, @RequestBody Content content) { Post p = dao.getPostById(id);// ww w . j a va2 s .c o m p.setAuthor(content.getAuthor()); p.setContent(content.getText()); p.setTitle(content.getTitle()); List<String> tagsList = new ArrayList<>(); String[] tagsArr = content.getTags().split(","); tagsList.addAll(Arrays.asList(tagsArr)); p.setTags(tagsList); dao.updatePost(p); }
From source file:io.fourfinanceit.homework.controller.LoanControler.java
@RequestMapping(value = "/loan/{id}", method = RequestMethod.DELETE, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<LoanApplication> deleteGreeting(@PathVariable("id") Long id, @RequestBody LoanApplication loanApplication) { if (loanApplicationRepository.findOne(id) != null) { loanApplicationRepository.delete(id); return new ResponseEntity<LoanApplication>(HttpStatus.INTERNAL_SERVER_ERROR); } else {/*from ww w .j a v a 2 s. c o m*/ return new ResponseEntity<LoanApplication>(HttpStatus.NO_CONTENT); } }
From source file:cn.designthoughts.sample.axon.sfav.customer.controller.CustomerController.java
@RequestMapping(value = "/rest/customers/{customerId}/address", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void createAddressForCustomer(@PathVariable String customerId, @RequestBody @Valid CreateAddressForCustomerRequest request) { commandGateway.send(new AddCustomerAddressCommand(new CustomerId(customerId), new Address(request.getBuilding(), request.getStreet(), request.getCity(), request.getCountry()))); return;/*from ww w . ja v a2s . c om*/ }
From source file:com.gazbert.bxbot.rest.api.ExchangeConfigController.java
/** * Updates Exchange configuration for the bot. * * @return 204 'No Content' HTTP status code if exchange config was updated, some other HTTP status code otherwise. *///from w w w . java 2s .c om @RequestMapping(value = "/exchange", method = RequestMethod.PUT) ResponseEntity<?> updateExchange(@AuthenticationPrincipal User user, @RequestBody ExchangeConfig config) { exchangeConfigService.updateConfig(config); final HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders .setLocation(ServletUriComponentsBuilder.fromCurrentRequest().path("/").buildAndExpand().toUri()); return new ResponseEntity<>(null, httpHeaders, HttpStatus.NO_CONTENT); }
From source file:ca.qhrtech.controllers.UserController.java
@ApiMethod(description = "Deletes the User at the specified location") @RequestMapping(value = "/user/{id}", method = RequestMethod.DELETE) public ResponseEntity<BGLUser> deleteUser(@PathVariable("id") long id) { if (userService.findUserById(id) == null) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); }//from w ww .j a v a 2 s . com userService.deleteUser(id); return new ResponseEntity<>(HttpStatus.NO_CONTENT); }