List of usage examples for org.springframework.web.bind.annotation RequestMethod PUT
RequestMethod PUT
To view the source code for org.springframework.web.bind.annotation RequestMethod PUT.
Click Source Link
From source file:fr.mby.opa.pics.web.controller.AlbumController.java
@ResponseBody @ResponseStatus(value = HttpStatus.OK)//from ww w .ja v a 2 s . c om @RequestMapping(method = RequestMethod.PUT) public Album updateAlbumJson(@Valid @RequestBody final Album album) throws Exception { final Album updatedAlbum = this.albumDao.updateAlbum(album); return updatedAlbum; }
From source file:cn.aozhi.songify.rest.TaskRestController.java
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaTypes.JSON) // Restful204??, . ?200??. @ResponseStatus(HttpStatus.NO_CONTENT)//from w ww . j av a2s. com public void update(@RequestBody Task task) { // JSR303 Bean Validator, RestExceptionHandler?. BeanValidators.validateWithException(validator, task); // ? taskService.saveTask(task); }
From source file:com.restfiddle.controller.rest.RoleController.java
@RequestMapping(value = "/api/roles/{id}", method = RequestMethod.PUT, headers = "Accept=application/json") public @ResponseBody Role update(@PathVariable("id") String id, @RequestBody RoleDTO updated) { logger.debug("Updating role with information: " + updated); Role role = roleRepository.findOne(updated.getId()); role.setName(updated.getName());//from w ww .j av a 2 s. co m role.setDescription(updated.getDescription()); return role; }
From source file:be.bittich.quote.controller.impl.AbstractController.java
@Override @RequestMapping(value = "/edit", method = RequestMethod.PUT) public T update(@RequestBody @Valid T t) { if (t.getId() == null || getService().findOneById((PK) t.getId()) == null) { getLogger().info(String.format("%s: %s", "Attempt to update an unknown entity with id", t.getId())); throw new EntityNotFoundException("Mise jour impossible : Entit introuvable"); }/* www . j a v a 2 s .co m*/ checkArgument(this.canUpdate(t), "Modification impossible: permission non accorde."); T saveOrUpdate = this.getService().saveOrUpdate(t); getLogger().info(String.format("%s: %s", "Entity edited successfully with id", t.getId())); return saveOrUpdate; }
From source file:nu.yona.server.subscriptions.rest.NewDeviceRequestController.java
@RequestMapping(value = "/{mobileNumber}", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.OK)/* w ww.j a v a 2 s .c om*/ public void setNewDeviceRequestForUser(@RequestHeader(value = Constants.PASSWORD_HEADER) String password, @PathVariable String mobileNumber, @RequestBody NewDeviceRequestCreationDto newDeviceRequestCreation) { try { userService.assertValidMobileNumber(mobileNumber); UUID userId = userService.getUserByMobileNumber(mobileNumber).getId(); try (CryptoSession cryptoSession = CryptoSession.start(Optional.of(password), () -> userService.doPreparationsAndCheckCanAccessPrivateData(userId))) { newDeviceRequestService.setNewDeviceRequestForUser(userId, password, newDeviceRequestCreation.getNewDeviceRequestPassword()); } } catch (UserServiceException e) { // prevent detecting whether a mobile number exists by throwing the same exception logger.error("Caught UserServiceException. Mapping it to CryptoException", e); throw CryptoException.decryptingData(); } }
From source file:org.smartparam.manager.spring.RepositoryEditController.java
@RequestMapping(value = "{in}/parameters/{name}/levels", method = RequestMethod.PUT) @ResponseBody//from ww w .j av a2 s . co m public LevelKey addLevel(@PathVariable("in") String in, @PathVariable("name") String parameter, @RequestBody SimpleLevel level) { return paramEditor.addLevel(new RepositoryName(in), parameter, level).data(); }
From source file:com.restfiddle.controller.rest.ModuleController.java
@RequestMapping(value = "/api/modules/{id}", method = RequestMethod.PUT, headers = "Accept=application/json") public @ResponseBody Module update(@PathVariable("id") String id, @RequestBody ModuleDTO updated) { logger.debug("Updating module with information: " + updated); Module module = moduleRepository.findOne(updated.getId()); module.setName(updated.getName());//from ww w. j a v a2 s. co m module.setDescription(updated.getDescription()); return module; }
From source file:com.swcguild.bluraymvc.controller.DisplayController.java
@RequestMapping(value = "/movie/{id}", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.NO_CONTENT)/*from ww w . ja v a 2 s. co m*/ public void putMovie(@PathVariable("id") int id, @RequestBody Movie movie) { movie.setMovieId(id); dao.updateMovie(movie); }
From source file:com.wavemaker.tools.apidocs.tools.spring.controller.UserController.java
@RequestMapping(value = "/{id:.+}", method = RequestMethod.PUT) @ApiOperation(value = "Updates the User instance associated with the given id.") public User editUser(@PathVariable("id") Integer id, @RequestBody User instance) throws EntityNotFoundException { return null;// w w w.j ava 2 s . com }
From source file:com.github.lynxdb.server.api.http.handlers.EpTree.java
@RequestMapping(path = "/rules", method = { RequestMethod.POST, RequestMethod.DELETE, RequestMethod.PUT }, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity rules() { return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build(); }