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:infowall.web.controller.ItemValueController.java
@RequestMapping(value = "/single/item/{dashboardId}/{itemName}/{value}", method = RequestMethod.PUT) @ResponseBody/* w ww. j ava 2s . c om*/ public ReturnStatus storeSimpleValue(@PathVariable String dashboardId, @PathVariable String itemName, @PathVariable String value) { itemValueProcess.storeSimpleValue(dashboardId, itemName, value); return success(); }
From source file:nl.surfnet.mujina.controllers.IdentityProviderAPI.java
@RequestMapping(value = { "/attributes" }, method = RequestMethod.PUT) @ResponseStatus(HttpStatus.NO_CONTENT)/* w w w . ja va 2 s . com*/ @ResponseBody public void setAttributes(@RequestBody AttributesMap attribues) { log.debug("Request to replace all attributes"); configuration.getAttributes().clear(); for (String name : attribues.keySet()) { Attribute attribute = attribues.get(name); configuration.getAttributes().put(name, attribute.getValue()); } }
From source file:com.tsg.contactlistmvc.RESTController.java
@RequestMapping(value = "/contact/{id}", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.NO_CONTENT)//from ww w.j av a2 s. co m public void updateContact(@PathVariable("id") int id, @Valid @RequestBody Contact contact) { contact.setContactId(id); dao.updateContact(contact); }
From source file:reconf.server.services.security.UpsertUserService.java
@RequestMapping(value = "/user", method = RequestMethod.PUT) @Transactional// www .j a v a 2 s . c o m public ResponseEntity<Client> doIt(@RequestBody Client client, Authentication authentication) { List<String> errors = DomainValidator.checkForErrors(client); if (!errors.isEmpty()) { return new ResponseEntity<Client>(new Client(client, errors), HttpStatus.BAD_REQUEST); } HttpStatus status = null; List<GrantedAuthority> authorities = new ArrayList<>(); authorities.add(new SimpleGrantedAuthority("USER")); if (ApplicationSecurity.isRoot(authentication)) { if (ApplicationSecurity.isRoot(client.getUsername())) { return new ResponseEntity<Client>(new Client(client, cannotChangeRootPassword), HttpStatus.BAD_REQUEST); } status = upsert(client, authorities); } else if (StringUtils.equals(client.getUsername(), authentication.getName())) { if (!userDetailsManager.userExists(client.getUsername())) { return new ResponseEntity<Client>(new Client(client, mustBeRoot), HttpStatus.BAD_REQUEST); } User user = new User(client.getUsername(), client.getPassword(), authorities); userDetailsManager.updateUser(user); status = HttpStatus.OK; } else { return new ResponseEntity<Client>(HttpStatus.FORBIDDEN); } return new ResponseEntity<Client>(new Client(client), status); }
From source file:io.curly.gathering.mention.MentionController.java
@RequestMapping(value = "", method = { RequestMethod.PUT, RequestMethod.POST }) public Callable<HttpEntity<?>> mention(@Valid @RequestBody MentionBody body, @PathVariable String listId, @GitHubAuthentication User user, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return () -> new ResponseEntity<Object>(new ModelErrors(bindingResult), HttpStatus.BAD_REQUEST); } else {//from www . j a va 2s . co m return () -> { interaction.mention(new Mention(body.getParticipant(), listId), user); return new ResponseEntity<>(HttpStatus.CREATED); }; } }
From source file:school.controller.Controller.java
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = "application/json") public T update(@PathVariable Long id, @RequestBody T entity, final HttpServletResponse response) { setHeaders(response);//w w w . j a v a2 s . co m return update(id, entity); }
From source file:org.royrusso.mvc.controller.UserController.java
@ResponseBody @RequestMapping(method = RequestMethod.PUT, produces = "application/json") public RestResponse updateUser(@RequestBody User user) { userService.updateUser(user);/* www .ja va 2 s . com*/ return new RestResponse<String>(true, "", null); }
From source file:com.sg.addressbookmvc.HomeController.java
@RequestMapping(value = "/address/{id}", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.NO_CONTENT)//from w w w . j av a2s .c o m public void putAddress(@PathVariable("id") int id, @RequestBody Address address) { address.setAddressId(id); dao.updateAddress(address); }
From source file:edu.sjsu.cmpe275.lab2.controller.ManageFriendshipController.java
/** Add a friendship object (9) Add a friend// w w w . j a v a 2 s .c o m Path:friends/{id1}/{id2} Method: PUT This makes the two persons with the given IDs friends with each other. If either person does not exist, return 404. If the two persons are already friends, do nothing, just return 200. Otherwise, Record this friendship relation. If all is successful, return HTTP code 200 and any informative text message in the HTTP payload. * @param a Description of a * @param b Description of b * @return Description of c */ @RequestMapping(value = "/{id1}/{id2}", method = RequestMethod.PUT) @ResponseBody public ResponseEntity createFriendship(@PathVariable("id1") long id1, @PathVariable("id2") long id2) { int result = friendshipDao.create(id1, id2); if (result == 0) { return new ResponseEntity(new String[] { "Create friendship successfuly" }, HttpStatus.OK); } else { return new ResponseEntity(new String[] { "Can not find persons" }, HttpStatus.NOT_FOUND); } }
From source file:com.smallpay.workflow.service.api.model.ModelSaveRestResource.java
@RequestMapping(value = "/service/model/{modelId}/save", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ResponseStatus(value = HttpStatus.OK)/*from ww w . java2s.c o m*/ public void saveModel(@PathVariable String modelId, @RequestParam MultiValueMap<String, String> values) { try { Model model = repositoryService.getModel(modelId); ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo()); modelJson.put(MODEL_NAME, values.getFirst("name")); modelJson.put(MODEL_DESCRIPTION, values.getFirst("description")); model.setMetaInfo(modelJson.toString()); model.setName(values.getFirst("name")); repositoryService.saveModel(model); repositoryService.addModelEditorSource(model.getId(), values.getFirst("json_xml").getBytes("utf-8")); InputStream svgStream = new ByteArrayInputStream(values.getFirst("svg_xml").getBytes("utf-8")); TranscoderInput input = new TranscoderInput(svgStream); PNGTranscoder transcoder = new PNGTranscoder(); // Setup output ByteArrayOutputStream outStream = new ByteArrayOutputStream(); TranscoderOutput output = new TranscoderOutput(outStream); // Do the transformation transcoder.transcode(input, output); final byte[] result = outStream.toByteArray(); repositoryService.addModelEditorSourceExtra(model.getId(), result); outStream.close(); } catch (Exception e) { LOGGER.error("Error saving model", e); throw new ActivitiException("Error saving model", e); } }