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.cxplonka.feature.service.controller.CustomerController.java
@RequestMapping(value = "/{id}", method = RequestMethod.PUT) public Customer update(@PathVariable long id, @Validated @RequestBody Customer customer) { Assert.notNull(customer, "This field is mandatory."); Assert.isTrue(id > 0, "No valid primary key."); Customer model = repository.findOne(id); if (model != null) { model.setFirstName(customer.getFirstName()); model.setLastName(customer.getLastName()); return repository.saveAndFlush(model); }/*from w ww. j a v a2 s .c om*/ return null; }
From source file:net.bluemix.questions.web.controllers.AdminSessionController.java
@RequestMapping(value = "{id}", method = RequestMethod.PUT) public Session update(@RequestBody Session domain, @PathVariable Long id) { Session session = repo.findOne(id);// w w w. j a va2s.c o m session.setActive(domain.isActive()); session.setConference(domain.getConference()); session.setNumber(domain.getNumber()); session.setPresenter(domain.getPresenter()); session.setSessionDate(domain.getSessionDate()); session.setTitle(domain.getTitle()); return repo.save(session); }
From source file:com.cemeterylistingsweb.presentation.rest.PublishedDeceasedListingController.java
@RequestMapping(value = "update", method = RequestMethod.PUT) //This the uri e.g http://localhost:8084/askweb/api/club/update @ResponseBody/*from w w w. jav a2s .c o m*/ public String update(@RequestBody PublishedDeceasedListing pdl) { ps.merge(pdl); System.out.println(" Update Called "); return "Club Update"; }
From source file:com.cemeterylistingsweb.presentation.rest.SearchSurnameController.java
@RequestMapping(value = "update", method = RequestMethod.PUT) //This the uri e.g http://localhost:8084/askweb/api/club/update @ResponseBody/*from w w w .j a v a 2s . co m*/ public String update(@RequestBody PublishedDeceasedListing cemetery) { cs.merge(cemetery); System.out.println(" Update Called "); return "Club Update"; }
From source file:com.hp.autonomy.frontend.find.hod.configuration.HodConfigurationController.java
@SuppressWarnings("ProhibitedExceptionDeclared") @RequestMapping(value = "/config", method = { RequestMethod.POST, RequestMethod.PUT }) @ResponseBody//from ww w .ja v a 2 s.co m public ResponseEntity<?> saveConfig(@RequestBody final ConfigResponse<HodFindConfig> configResponse) throws Exception { try { log.info(Markers.AUDIT, "REQUESTED CHANGE APPLICATION CONFIGURATION"); configService.updateConfig(configResponse.getConfig()); log.info(Markers.AUDIT, "CHANGED APPLICATION CONFIGURATION"); return new ResponseEntity<>(configService.getConfigResponse(), HttpStatus.OK); } catch (final ConfigException ce) { log.info(Markers.AUDIT, "CHANGE APPLICATION CONFIGURATION FAILED"); return new ResponseEntity<>(Collections.singletonMap("exception", ce.getMessage()), HttpStatus.NOT_ACCEPTABLE); } catch (final ConfigValidationException cve) { log.info(Markers.AUDIT, "CHANGE APPLICATION CONFIGURATION FAILED"); return new ResponseEntity<>(Collections.singletonMap("validation", cve.getValidationErrors()), HttpStatus.NOT_ACCEPTABLE); } }
From source file:mynotesrzd.springboot.controller.MynotesController.java
@RequestMapping(value = "/{id}", method = RequestMethod.PUT) public void edit(@PathVariable String id, @RequestBody Mynotes p) { Mynotes mynotes = mynotesDao.findOne(id); if (mynotes != null) { p.setId(id);/*from w ww . j a v a 2 s.c o m*/ mynotesDao.save(p); } }
From source file:com.opensearchserver.hadse.cluster.ClusterController.java
/** * //from ww w . j a v a 2s . co m * Add a node to the cluster * * @param addresse * @return */ @RequestMapping(method = RequestMethod.PUT, value = "/_cluster") @ResponseBody public HttpEntity<?> add(@RequestParam(value = "addr", required = true) String... addresses) { try { List<String> adressList = new ArrayList<String>(addresses.length); for (String ad : addresses) adressList.add(ad); return ClusterCatalog.add(adressList); } catch (Throwable t) { return new ResponseEntity<String>(t.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } }
From source file:customer.springboot.controller.CustomerController.java
@RequestMapping(value = "/{id}", method = RequestMethod.PUT) public void edit(@PathVariable String id, @RequestBody Customer p) { Customer customer = customerDao.findOne(id); if (customer != null) { p.setId(id);/* w w w. jav a 2 s . c o m*/ customerDao.save(p); } }
From source file:edu.mum.waa.webstore.controller.CartRestController.java
@RequestMapping(value = "/{cartId}", method = RequestMethod.PUT) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void update(@PathVariable(value = "cartId") String cartId, @RequestBody Cart cart) { cartService.update(cartId, cart);/*w w w.ja va 2 s.c om*/ }
From source file:com.artivisi.server.test.web.ProductController.java
@RequestMapping(value = "/{id}", method = RequestMethod.PUT) public void update(@PathVariable String id, @RequestBody Product product) throws Exception { Product p = productDao.findOne(id);/*from w ww . jav a 2 s.co m*/ if (p != null) { product.setId(p.getId()); productDao.save(product); } }