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:nl.surfnet.mujina.controllers.IdentityProviderAPI.java
@RequestMapping(value = { "/users" }, method = RequestMethod.PUT) @ResponseStatus(HttpStatus.NO_CONTENT)//from w w w.j a v a 2s . co m @ResponseBody public void addUser(@RequestBody User user) { log.debug("Request to add user {} with password {}", user.getName(), user.getPassword()); final List<GrantedAuthority> grants = new ArrayList<GrantedAuthority>(); final List<String> authorities = user.getAuthorities(); for (String authority : authorities) { grants.add(new GrantedAuthorityImpl(authority)); } SimpleAuthentication auth = new SimpleAuthentication(user.getName(), user.getPassword(), grants); configuration.getUsers().add(auth); }
From source file:org.parancoe.plugin.configuration.controllers.ConfigurationController.java
@RequestMapping(value = "/{propertyId}/store", method = { RequestMethod.PUT, RequestMethod.POST }) public String store(@ModelAttribute("pluginConfigurationProperty") @Valid Property property, BindingResult result, SessionStatus status, HttpServletRequest req) { String value = property.getValue(); if (PropertyType.STRING.equals(property.getType())) { if (value != null && value.length() > 255) { result.rejectValue("value", "PluginConfiguration_Error_MaxLengthExceeded", new Object[] { Integer.valueOf(255), Integer.valueOf(value.length()) }, "You exceeded the max length (255)"); }/*from w ww . j a v a 2s. co m*/ } else if (PropertyType.INTEGER.equals(property.getType())) { try { property.getValueAsInteger(); } catch (NumberFormatException numberFormatException) { result.rejectValue("value", "PluginConfiguration_Error_NotAnInteger", new Object[] { value }, "The value must be an integer number."); } } else if (PropertyType.REAL.equals(property.getType())) { try { Double.valueOf(value); } catch (NumberFormatException numberFormatException) { result.rejectValue("value", "PluginConfiguration_Error_NotAReal", new Object[] { value }, "The value must be a real number."); } } if (result.hasErrors()) { return "plugin/configuration/edit"; } configurationService.store(property); FlashHelper.setRedirectNotice(req, "PluginConfiguration_flash_PropertyUpdated"); status.setComplete(); return "redirect:.."; }
From source file:com.restfiddle.controller.rest.DataMapController.java
@RequestMapping(value = "/api/dataMaps/{id}", method = RequestMethod.PUT, headers = "Accept=application/json") public @ResponseBody DataMap update(@PathVariable("id") Long id, @RequestBody DataMapDTO updated) { logger.debug("Updating dataMap with information: " + updated); DataMap dataMap = dataMapRepository.findOne(updated.getId()); dataMap.setDataKey(updated.getKey()); dataMap.setValue(updated.getValue()); return dataMap; }
From source file:com.gazbert.bxbot.rest.api.EngineConfigController.java
/** * Updates Engine configuration for the bot. * * @return 204 'No Content' HTTP status code if engine config was updated successfully, some other HTTP status code otherwise. *//*ww w. j a v a2s . co m*/ @RequestMapping(value = "/engine", method = RequestMethod.PUT) public ResponseEntity<?> updateEngine(@AuthenticationPrincipal User user, @RequestBody EngineConfig config) { engineConfigService.updateConfig(config); final HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders .setLocation(ServletUriComponentsBuilder.fromCurrentRequest().path("/").buildAndExpand().toUri()); return new ResponseEntity<>(null, httpHeaders, HttpStatus.NO_CONTENT); }
From source file:com.pos.web.MasterItemKategoriCtrl.java
@RequestMapping(value = "/item-kategori", method = RequestMethod.PUT) public void update(@RequestBody ItemKategori ik, HttpServletResponse response) { itemKategoriDao.save(ik); }
From source file:cz.fi.muni.pa036.airticketbooking.rest.FlightTicket.java
@RequestMapping(method = RequestMethod.PUT) public void updateUser(@RequestBody @Valid FlightTicketDto flightTicketDto) { flightTicketService.update(flightTicketDto); }
From source file:eu.codesketch.adam.rest.interfaces.SwarmInterface.java
@ResponseStatus(code = HttpStatus.OK)
@RequestMapping(value = "/{swarmId}/containers/{containerId}/restart", method = RequestMethod.PUT)
SwarmMessage restartSwarmContainer(String swarmId, String containerId);
From source file:com.volho.example.todo.web.controller.TodoController.java
@RequestMapping(value = "/todos/{id}/status", method = RequestMethod.PUT, produces = "application/json", consumes = "application/json") @ResponseBody//from w w w.j a v a 2s . co m public ApiResponse setStatusById(@PathVariable Long id, @RequestBody Todo todo) throws Exception { ApiResponse response = new ApiResponse(); try { Todo item = todoService.setStatus(id, todo.getStatus()); response.setData(item); response.setSuccess(true); response.setMessage("Update item status successfully"); } catch (Exception e) { response.setSuccess(false); response.setMessage("Error occur, cannot update status of an item id = " + id); } return response; }
From source file:com.br.helpdesk.controller.UserGroupController.java
@RequestMapping(value = { "", "/{id}" }, method = { RequestMethod.PUT, RequestMethod.POST }) @ResponseBody/* w ww . j a va 2s .c om*/ public UserGroup save(@RequestBody UserGroup group) { return service.save(group); }
From source file:eu.supersede.dm.rest.ProcessAlertsRest.java
@RequestMapping(value = "/convert", method = RequestMethod.PUT) public void convertAlertToRequirement(@RequestParam String alertId, Long processId) { ProcessManager proc = DMGame.get().getProcessManager(processId); HAlert alert = alertsJpa.findOne(alertId); if (alert == null) { throw new NotFoundException( "Can't convert alert with id " + alertId + " to a requirement because it does not exist"); }/* www . jav a 2s.c o m*/ List<HReceivedUserRequest> requests = receivedUserRequestsJpa.findRequestsForAlert(alertId); if (requests == null || requests.size() == 0) { System.out.println("No user requests for alert " + alertId + ", no requirement added"); return; } for (HReceivedUserRequest request : requests) { Requirement requirement = new Requirement(); requirement.setName(request.getDescription()); // requirement.setDescription("Features:"); Requirement savedRequirement = requirementsJpa.save(requirement); proc.addRequirement(savedRequirement); requirementsPropertiesJpa.save(new HRequirementProperty(savedRequirement.getRequirementId(), RequirementProperties.CLASSIFICATION, request.getClassification())); requirementsPropertiesJpa.save(new HRequirementProperty(savedRequirement.getRequirementId(), RequirementProperties.ACCURACY, "" + request.getAccuracy())); requirementsPropertiesJpa.save(new HRequirementProperty(savedRequirement.getRequirementId(), RequirementProperties.POSITIVE_SENTIMENT, "" + request.getPositiveSentiment())); requirementsPropertiesJpa.save(new HRequirementProperty(savedRequirement.getRequirementId(), RequirementProperties.NEGATIVE_SENTIMENT, "" + request.getNegativeSentiment())); requirementsPropertiesJpa.save(new HRequirementProperty(savedRequirement.getRequirementId(), RequirementProperties.OVERALL_SENTIMENT, "" + request.getOverallSentiment())); requirementsPropertiesJpa.save(new HRequirementProperty(savedRequirement.getRequirementId(), "Original feedback", "" + request.getDescription())); } // Discard alert alertsJpa.delete(alert); }