List of usage examples for org.springframework.web.bind.annotation RequestMethod PATCH
RequestMethod PATCH
To view the source code for org.springframework.web.bind.annotation RequestMethod PATCH.
Click Source Link
From source file:io.servicecomb.swagger.generator.springmvc.processor.annotation.PatchMappingMethodAnnotationProcessor.java
@Override public void process(Object annotation, OperationGenerator operationGenerator) { PatchMapping mappingAnnotation = (PatchMapping) annotation; Operation operation = operationGenerator.getOperation(); // path/value? this.processPath(mappingAnnotation.path(), operationGenerator); this.processPath(mappingAnnotation.value(), operationGenerator); this.processMethod(RequestMethod.PATCH, operationGenerator); this.processConsumes(mappingAnnotation.consumes(), operation); this.processProduces(mappingAnnotation.produces(), operation); if (StringUtils.isEmpty(operationGenerator.getHttpMethod()) && StringUtils.isEmpty(operationGenerator.getSwaggerGenerator().getHttpMethod())) { throw new Error("HttpMethod must not both be empty in class and method"); }// w ww . ja va 2 s .c om }
From source file:com.github.hateoas.forms.spring.uber.UberActionTest.java
@Test public void translatesPatchToPartial() throws Exception { assertEquals(UberAction.PARTIAL, UberAction.forRequestMethod(RequestMethod.PATCH)); }
From source file:com.swcguild.vendingmachinemvc.controller.UserController.java
@RequestMapping(value = "/item/{id}", method = RequestMethod.PATCH) @ResponseBody// ww w . j a va 2 s. c om public String vendItem(@PathVariable("id") int id) { if (dao.getItemById(id).getQuantity() != 0 && dao.getItemById(id).getPennyCost().intValueExact() * 100 <= dao.getMoney()) { System.out.println(dao.getItemById(id).getPennyCost().intValueExact() * 100); System.out.println("<=" + dao.getMoney()); dao.vendItem(dao.getItemById(id)); dao.updateMoney(-dao.getItemById(id).getPennyCost().intValue() * 100); return "purchase successful!"; } else { return "purchase unsuccessful!"; } }
From source file:com.monitor.controller.MessageController.java
@ApiOperation(value = "update", notes = "update message") @RequestMapping(method = { RequestMethod.PUT, RequestMethod.PATCH }, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public ResponseEntity<Message> update(Message messageRequest) { Message messageSaved = service.insert(messageRequest); if (messageSaved != null) { return new ResponseEntity<>(messageSaved, HttpStatus.OK); } else {/*from w w w.j a v a 2 s . c o m*/ return new ResponseEntity<>(messageSaved, HttpStatus.BAD_REQUEST); } }
From source file:com.github.wxiaoqi.search.controller.SearchController.java
@RequestMapping(value = "/index", method = RequestMethod.PATCH) public ObjectRestResponse batchCreateIndexObject(@RequestBody List<IndexObject> indexObjects) { for (IndexObject object : indexObjects) { luceneService.save(object);//w ww . ja v a2s .c o m } return new ObjectRestResponse(); }
From source file:org.osiam.resources.helper.JsonInputValidator.java
public JsonInputValidator() { ObjectMapper mapper = new ObjectMapper(); SimpleModule testModule = new SimpleModule("userDeserializerModule", new Version(1, 0, 0, null, "org.osiam", "scim-schema")).addDeserializer(User.class, new UserDeserializer(User.class)); mapper.registerModule(testModule);/*from w ww.j a va 2s . c o m*/ validators = new HashMap<>(); validators.put(RequestMethod.PATCH, new PatchValidator(mapper)); validators.put(RequestMethod.POST, new PostValidator(mapper)); validators.put(RequestMethod.PUT, new PutValidator(mapper)); }
From source file:com.orange.cloud.servicebroker.filter.core.service.ServiceInstanceServiceClient.java
@RequestMapping(value = "/v2/service_instances/{instanceId}", method = RequestMethod.PATCH, produces = { MediaType.APPLICATION_JSON_VALUE }) ResponseEntity<UpdateServiceInstanceResponse> updateServiceInstance( @PathVariable("instanceId") String serviceInstanceId, @Valid @RequestBody UpdateServiceInstanceRequest request, @RequestParam(value = "accepts_incomplete", required = false) boolean acceptsIncomplete);
From source file:com.jiwhiz.rest.user.UserAccountRestController.java
/** * Updates current user profile, like name, email, website, imageUrl. * //from ww w.j ava 2s.c o m * @param updateMap * @return * @throws ResourceNotFoundException */ @RequestMapping(method = RequestMethod.PATCH, value = URL_USER_PROFILE) @Transactional public HttpEntity<Void> patchUserProfile(@RequestBody Map<String, String> updateMap) throws ResourceNotFoundException { UserAccount currentUser = getCurrentAuthenticatedUser(); String displayName = updateMap.get("displayName"); if (displayName != null) { currentUser.setDisplayName(displayName); } String email = updateMap.get("email"); if (email != null) { currentUser.setEmail(email); } String webSite = updateMap.get("webSite"); if (webSite != null) { currentUser.setWebSite(webSite); } String imageUrl = updateMap.get("imageUrl"); if (imageUrl != null) { currentUser.setImageUrl(imageUrl); } userAccountRepository.save(currentUser); return new ResponseEntity<Void>(HttpStatus.NO_CONTENT); }
From source file:com.swcguild.capstoneproject.controller.PinnedPostController.java
@RequestMapping(value = "/pinpost/{id}", method = RequestMethod.PATCH) @ResponseBody// w w w . j a v a2 s . com public void publishPinPost(@PathVariable("id") int id, @RequestBody PinPost data) { dao.publishPinPost(id, data); }
From source file:de.metas.ui.web.pattribute.ASIRestControllerDeprecated.java
@RequestMapping(value = "/instance/{asiDocId}", method = RequestMethod.PATCH) @Deprecated/*from w w w . j a va 2 s .co m*/ public List<JSONDocument> processChanges_DEPRECATED(@PathVariable("asiDocId") final int asiDocId // , @RequestBody final List<JSONDocumentChangedEvent> events // ) { userSession.assertDeprecatedRestAPIAllowed(); return asiRestController.processChanges(asiDocId, events); }