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:edu.infsci2560.services.LocationsService.java
@RequestMapping(method = RequestMethod.PUT, consumes = "application/json", produces = "application/json") public ResponseEntity<Location> update(@RequestBody Location locations, @PathVariable("id") long id) { HttpHeaders headers = new HttpHeaders(); return new ResponseEntity<>(repository.save(locations), headers, HttpStatus.OK); }
From source file:org.hsweb.web.oauth2.controller.OAuth2ClientController.java
@RequestMapping(value = "/disable/{id}", method = RequestMethod.PUT) @AccessLogger("?") @Authorize(action = "disable") protected ResponseMessage disbale(@PathVariable("id") String id) { oAuth2ClientService.disable(id);/*ww w. ja va 2s. co m*/ return ResponseMessage.ok(); }
From source file:business.controllers.ProfileController.java
@RequestMapping(value = "/profile", method = RequestMethod.PUT) public void putOwnProfile(UserAuthenticationToken user, @RequestBody ProfileRepresentation form) { log.info("PUT profile for user with id " + user.getId()); if (form == null) { log.warn("form is null!"); return;/*from w w w . j av a2s . co m*/ } // Get user User currentUser = userService.getOne(user.getId()); // Update ContactData cData = currentUser.getContactData(); if (cData == null) { cData = new ContactData(); currentUser.setContactData(cData); } // Only update the telephone number ContactData modifiedData = form.getContactData(); if (modifiedData == null) { log.warn("new contact data is null!"); } else { cData.setTelephone(modifiedData.getTelephone()); } if (currentUser.isRequester()) { String specialism = currentUser.getSpecialism(); // update specialism for any changes if (form.getSpecialism() != null && !form.getSpecialism().equals(specialism)) { currentUser.setSpecialism(form.getSpecialism()); } } // Save userService.save(currentUser); }
From source file:edu.uoc.json.controller.MeetingController.java
@RequestMapping(method = RequestMethod.PUT) public @ResponseBody JSONResponse startRecord(HttpSession session) { JSONResponse response = new JSONResponse(); try {// ww w .jav a2 s .c o m Room room = (Room) session.getAttribute(Constants.ROOM_SESSION); MeetingRoom meeting = (MeetingRoom) session.getAttribute(Constants.MEETING_SESSION); User user = (User) session.getAttribute(Constants.USER_SESSION); if (user != null && meeting != null) { meeting = meetingDao.findById(meeting.getId()); room = this.roomDao.findByRoomCode(room.getId()); room.setIs_blocked(true); room.setReason_blocked(Constants.REASON_BLOCK_RECORDING); this.roomDao.save(room); meeting.setRecorded((byte) 1); //meeting.setPath(meeting.getPath().replaceAll("_", "/")); meeting.setStart_record(new Timestamp(new Date().getTime())); this.meetingDao.save(meeting); response.setOk(true); } } catch (Exception e) { logger.error("Error starting record ", e); } return response; }
From source file:locksdemo.LocksController.java
@RequestMapping(value = "{name}/{value}", method = RequestMethod.PUT) public Lock refresh(@PathVariable String name, @PathVariable String value) { return service.refresh(name, value); }
From source file:com.seabee.snapdragon.controller.StaticPageController.java
@RequestMapping(value = "/{staticPageId}", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.NO_CONTENT)//from w ww.j a va2 s . c o m public void editStaticPage(@Valid @RequestBody StaticPage page, @PathVariable("staticPageId") int id) { // take a static page object, and replace it? // Yes. page.setSpId(id); dao.updateStaticPage(page); }
From source file:gt.dakaik.rest.interfaces.WSSchool.java
@Transactional() @RequestMapping(value = "/set", method = RequestMethod.PUT) public ResponseEntity<School> doUpdate(@RequestParam(value = "idUser", defaultValue = "0") int idUsuario, @RequestParam(value = "token", defaultValue = "") String token, @RequestBody School school) throws EntidadNoEncontradaException, EntidadDuplicadaException;
From source file:net.eusashead.hateoas.response.argumentresolver.EntityController.java
@RequestMapping(method = RequestMethod.PUT) public ResponseEntity<Void> put(@RequestBody Entity entity, PutResponseBuilder<Entity> builder) { return builder.build(); }
From source file:edu.mum.waa.webstore.controller.CartRestController.java
@RequestMapping(value = "/add/{productId}", method = RequestMethod.PUT) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void addIItem(@PathVariable String productId, HttpServletRequest request) { String sessionId = request.getSession(true).getId(); Cart cart = cartService.read(sessionId); if (cart == null) { cart = cartService.create(new Cart(sessionId)); }//from www .ja v a 2s . co m Product product = productService.getProductById(productId); if (product == null) { throw new IllegalArgumentException(String.format("Product with id (%) not found", productId)); } cart.addCartItem(new CartItem(product)); cartService.update(sessionId, cart); }
From source file:hello.TodoController.java
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = "application/json") @ResponseStatus(HttpStatus.NO_CONTENT)//w ww . j a v a 2s . c o m @Transactional public void update(@RequestBody Todo updatedTodo, @PathVariable("id") long id) throws IOException { if (id != updatedTodo.getId()) { repository.delete(id); } repository.save(updatedTodo); }