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:com.parivero.swagger.demo.controller.PaisController.java
@RequestMapping(method = RequestMethod.PUT) @ResponseStatus(HttpStatus.NO_CONTENT)//from w ww . j a v a 2s .c o m public void modificacion(@RequestBody Pais pais) { if (pais.getId() == null) { throw new IllegalArgumentException(); } if (pais.getId() == 0) { throw new NotFoundException(); } }
From source file:com.swcguild.dvdlibrarymvc.controller.HomeController.java
@RequestMapping(value = "/dvd/{id}", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.NO_CONTENT)/* w ww .j a va 2 s .com*/ public void editDvd(@Valid @RequestBody Dvd dvd, @PathVariable("id") int id) { dvd.setDvdId(id); dao.updateDVD(dvd); }
From source file:org.munie.envwater.controller.DeviceController.java
@ResponseBody @RequestMapping(value = "/device", method = RequestMethod.PUT, produces = "application/json;charset=UTF-8") public String put(HttpServletRequest request, HttpServletResponse respond) { // Valid parameters String id = request.getParameter("id"); String name = request.getParameter("name"); if (id == null || id.isEmpty()) return "fail"; // Find device BaseDao dao = context.getBean("BaseDaoImpl", BaseDao.class); Device dev = (Device) dao.get(Device.class, Integer.parseInt(id)); if (dev == null) return "fail"; // Update device if (name != null && !name.isEmpty()) dev.setName(name);/* ww w .j a va 2 s. c om*/ dao.update(dev); return "success"; }
From source file:com.cloudbees.demo.beesshop.web.ConfigurationController.java
@RequestMapping(method = RequestMethod.PUT, value = "/configuration/aws/credentials") public String updateAwsCredentials(@RequestParam("awsAccessKeyId") String awsAccessKeyId, @RequestParam("awsSecretKey") String awsSecretKey, RedirectAttributes redirectAttributes) { amazonS3FileStorageService.setAmazonCredentials(awsAccessKeyId, awsSecretKey); redirectAttributes.addFlashAttribute("successMessage", "AWS Credentials Configuration saved"); return "redirect:/configuration"; }
From source file:com.swcguild.addressbookarch.controller.HomeController.java
@RequestMapping(value = "/address/{id}", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.NO_CONTENT)//from w ww .j a va2 s. c om public void putAddress(@PathVariable("id") int id, @RequestBody Address address) { // set the value of the PathVariable id on the incoming Address object // to ensure that a) the address id is set on the object and b) that // the value of the PathVariable id and the Address object id are the // same. address.setAddressId(id); // update the address dao.updateAddress(address); }
From source file:edu.unc.lib.dl.cdr.sword.server.servlets.ContainerServlet.java
@RequestMapping(value = { "/{pid}", "/{pid}/*" }, method = RequestMethod.PUT) public void replaceMetadataOrMetadataAndContent(HttpServletRequest req, HttpServletResponse resp) { try {//from w w w .j a v a2 s .c o m this.api.put(req, resp); } catch (Exception e) { log.error("Failed to update container " + req.getQueryString(), e); resp.setStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR); } }
From source file:es.fdi.reservas.reserva.web.EdificioRestController.java
@RequestMapping(value = "/gestor/administrar/edificios/editar/{idEdificio}", method = RequestMethod.PUT) public void editarEdificioGestor(@PathVariable("idEdificio") long idEdificio, @RequestBody EdificioDTO edificioActualizado) { Attachment attachment = new Attachment(""); if (edificio_service.getAttachmentByName(edificioActualizado.getImagen()).isEmpty()) { //si no esta, lo aado attachment.setAttachmentUrl("/img/" + edificioActualizado.getImagen()); attachment.setStorageKey(edificio_service.getEdificio(idEdificio).getNombreEdificio() + "/" + edificioActualizado.getImagen()); //reserva_service.addAttachment(attachment); } else {//from w w w.j av a2s .c o m attachment = edificio_service.getAttachmentByName(edificioActualizado.getImagen()).get(0); } edificio_service.editarEdificio(edificioActualizado, attachment); }
From source file:org.lamop.riche.webservices.SourceRESTWS.java
@RequestMapping(method = RequestMethod.PUT, headers = "Accept=application/json") public @ResponseBody Source update(@PathParam("id") int id, @RequestBody Source work) { System.out.println("ID " + id); System.out.println("Modify " + work); serviceSource.modifyEntity(work);/* ww w . j a v a 2 s .co m*/ return work; }
From source file:gt.dakaik.rest.interfaces.WSUser.java
@Transactional() @RequestMapping(value = "/set", method = RequestMethod.PUT) public ResponseEntity<User> doUpdate(@RequestParam(value = "idUser", defaultValue = "0") int idUsuario, @RequestParam(value = "token", defaultValue = "") String token, @RequestBody User user) throws EntidadNoEncontradaException, EntidadDuplicadaException;
From source file:org.wallride.web.controller.guest.user.PasswordUpdateController.java
@RequestMapping(method = RequestMethod.PUT) public String update(@Validated @ModelAttribute(FORM_MODEL_KEY) PasswordUpdateForm form, BindingResult errors, AuthorizedUser authorizedUser, RedirectAttributes redirectAttributes) { redirectAttributes.addFlashAttribute(FORM_MODEL_KEY, form); redirectAttributes.addFlashAttribute(ERRORS_MODEL_KEY, errors); if (!errors.hasFieldErrors("newPassword")) { if (!ObjectUtils.nullSafeEquals(form.getNewPassword(), form.getNewPasswordRetype())) { errors.rejectValue("newPasswordRetype", "MatchRetype"); }// w w w . j a v a2 s . com } if (!errors.hasErrors()) { User user = userService.getUserById(authorizedUser.getId()); PasswordEncoder passwordEncoder = new StandardPasswordEncoder(); if (!passwordEncoder.matches(form.getCurrentPassword(), user.getLoginPassword())) { errors.rejectValue("currentPassword", "MatchCurrentPassword"); } } if (errors.hasErrors()) { return "redirect:/settings/password?step.edit"; } PasswordUpdateRequest request = new PasswordUpdateRequest().withUserId(authorizedUser.getId()) .withPassword(form.getNewPassword()); userService.updatePassword(request, authorizedUser); redirectAttributes.getFlashAttributes().clear(); redirectAttributes.addFlashAttribute("updatedPassword", true); return "redirect:/settings/password"; }