Java Code Examples for org.springframework.web.bind.annotation.RequestMethod#PATCH
The following examples show how to use
org.springframework.web.bind.annotation.RequestMethod#PATCH .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Moss File: InstancesProxyController.java License: Apache License 2.0 | 6 votes |
@RequestMapping(path = REQUEST_MAPPING_PATH, method = {RequestMethod.GET, RequestMethod.HEAD, RequestMethod.POST, RequestMethod.PUT, RequestMethod.PATCH, RequestMethod.DELETE, RequestMethod.OPTIONS}) public Mono<Void> endpointProxy(@PathVariable("instanceId") String instanceId, ServerHttpRequest request, ServerHttpResponse response) { String endpointLocalPath = getEndpointLocalPath(request.getPath().pathWithinApplication().value()); URI uri = UriComponentsBuilder.fromPath(endpointLocalPath) .query(request.getURI().getRawQuery()) .build(true) .toUri(); return super.forward(instanceId, uri, request.getMethod(), request.getHeaders(), () -> BodyInserters.fromDataBuffers(request.getBody())).flatMap(clientResponse -> { response.setStatusCode(clientResponse.statusCode()); response.getHeaders().addAll(filterHeaders(clientResponse.headers().asHttpHeaders())); return response.writeAndFlushWith(clientResponse.body(BodyExtractors.toDataBuffers()).window(1)); }); }
Example 2
Source Project: openapi-generator File: AnotherFakeApi.java License: Apache License 2.0 | 6 votes |
/** * PATCH /another-fake/dummy : To test special tags * To test special tags and operation ID starting with number * * @param body client model (required) * @return successful operation (status code 200) */ @ApiOperation(value = "To test special tags", nickname = "call123testSpecialTags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) @RequestMapping(value = "/another-fake/dummy", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) default ResponseEntity<Client> call123testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { String exampleString = "{ \"client\" : \"client\" }"; ApiUtil.setExampleResponse(request, "application/json", exampleString); break; } } }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); }
Example 3
Source Project: entando-core File: DataObjectModelController.java License: GNU Lesser General Public License v3.0 | 6 votes |
@RestAccessControl(permission = Permission.SUPERUSER) @RequestMapping(value = "/{dataModelId}", method = RequestMethod.PATCH, produces = MediaType.APPLICATION_JSON_VALUE, consumes="application/json-patch+json") public ResponseEntity<SimpleRestResponse<DataModelDto>> patchDataObjectModel(@PathVariable Long dataModelId, @RequestBody JsonNode jsonPatch, BindingResult bindingResult) throws JsonProcessingException { logger.debug("Patching data object model -> {}", dataModelId); this.getDataObjectModelValidator().validateDataObjectModelJsonPatch(jsonPatch, bindingResult); if (bindingResult.hasErrors()) { throw new ValidationGenericException(bindingResult); } DataModelDto patchedDataModelDto = this.getDataObjectModelService().getPatchedDataObjectModel(dataModelId, jsonPatch); DataObjectModelRequest dataObjectModelRequest = this.dataModelDtoToRequestConverter.convert(patchedDataModelDto); return this.updateDataObjectModel(Long.toString(dataModelId), dataObjectModelRequest, bindingResult); }
Example 4
Source Project: metron File: UpdateController.java License: Apache License 2.0 | 5 votes |
@ApiOperation(value = "Update a document with a patch") @ApiResponse(message = "Returns the complete patched document.", code = 200) @RequestMapping(value = "/patch", method = RequestMethod.PATCH) ResponseEntity<Document> patch( final @ApiParam(name = "request", value = "Patch request", required = true) @RequestBody PatchRequest request ) throws RestException { try { return new ResponseEntity<>(service.patch(request), HttpStatus.OK); } catch (OriginalNotFoundException e) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } }
Example 5
Source Project: entando-core File: RoleController.java License: GNU Lesser General Public License v3.0 | 5 votes |
@RestAccessControl(permission = Permission.SUPERUSER) @RequestMapping(value = "/{roleCode}", method = RequestMethod.PATCH, produces = MediaType.APPLICATION_JSON_VALUE, consumes="application/json-patch+json") public ResponseEntity<SimpleRestResponse<RoleDto>> updateRole(@PathVariable String roleCode, @RequestBody JsonNode patchRequest, BindingResult bindingResult) { logger.debug("update role {} with jsonpatch-request {}", roleCode, patchRequest); this.getRoleValidator().validateJsonPatch(patchRequest, bindingResult); if (bindingResult.hasErrors()) { throw new ValidationGenericException(bindingResult); } RoleDto patchedRoleDto = this.getRoleService().getPatchedRole(roleCode, patchRequest); RoleRequest patchedRoleRequest = this.roleDtotoRoleRequestConverter.convert(patchedRoleDto); return this.updateRole(roleCode, patchedRoleRequest, bindingResult); }
Example 6
Source Project: openapi-generator File: FakeClassnameTestApi.java License: Apache License 2.0 | 5 votes |
/** * PATCH /fake_classname_test : To test class name in snake case * To test class name in snake case * * @param body client model (required) * @return successful operation (status code 200) */ @ApiOperation(value = "To test class name in snake case", nickname = "testClassname", notes = "To test class name in snake case", response = Client.class, authorizations = { @Authorization(value = "api_key_query") }, tags={ "fake_classname_tags 123#$%^", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) @RequestMapping(value = "/fake_classname_test", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) default ResponseEntity<Client> testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { return getDelegate().testClassname(body); }
Example 7
Source Project: openapi-generator File: FakeApi.java License: Apache License 2.0 | 5 votes |
/** * PATCH /fake : To test \"client\" model * To test \"client\" model * * @param body client model (required) * @return successful operation (status code 200) */ @ApiOperation(value = "To test \"client\" model", nickname = "testClientModel", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body);
Example 8
Source Project: restdocs-raml File: NotesController.java License: MIT License | 5 votes |
@RequestMapping(value = "/{id}", method = RequestMethod.PATCH) @ResponseStatus(HttpStatus.NO_CONTENT) void updateNote(@PathVariable("id") long id, @RequestBody NotePatchInput noteInput) { Note note = findNoteById(id); if (noteInput.getTagUris() != null) { note.setTags(getTags(noteInput.getTagUris())); } if (noteInput.getTitle() != null) { note.setTitle(noteInput.getTitle()); } if (noteInput.getBody() != null) { note.setBody(noteInput.getBody()); } this.noteRepository.save(note); }
Example 9
Source Project: JiwhizBlogWeb File: AuthorBlogRestController.java License: Apache License 2.0 | 5 votes |
@RequestMapping(method = RequestMethod.PATCH, value = ApiUrls.URL_AUTHOR_BLOGS_BLOG) public HttpEntity<AuthorBlogResource> patchBlogPost( @PathVariable("blogId") String blogId, @RequestBody Map<String, String> updateMap) throws ResourceNotFoundException { BlogPost blogPost = getBlogByIdAndCheckAuthor(blogId); String content = updateMap.get("content"); if (content != null) { blogPost.setContent(content); } String title = updateMap.get("title"); if (title != null) { blogPost.setTitle(title); } String tagString = updateMap.get("tagString"); if (tagString != null) { blogPost.parseAndSetTags(tagString); } String published = updateMap.get("published"); if (published != null) { blogPost.setPublished(published.equals("true")); } blogPost = blogPostRepository.save(blogPost); AuthorBlogResource resource = authorBlogResourceAssembler.toResource(blogPost); return new ResponseEntity<>(resource, HttpStatus.OK); }
Example 10
Source Project: openapi-generator File: FakeApi.java License: Apache License 2.0 | 5 votes |
/** * PATCH /fake : To test \"client\" model * To test \"client\" model * * @param body client model (required) * @return successful operation (status code 200) */ @ApiOperation(value = "To test \"client\" model", nickname = "testClientModel", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body);
Example 11
Source Project: dhis2-core File: ChartFacadeController.java License: BSD 3-Clause "New" or "Revised" License | 4 votes |
@RequestMapping( value = "/{uid}", method = RequestMethod.PATCH ) @ResponseStatus( value = HttpStatus.NO_CONTENT ) public void partialUpdateObject( @PathVariable( "uid" ) String pvUid, @RequestParam Map<String, String> rpParameters, HttpServletRequest request, HttpServletResponse response ) throws Exception { WebOptions options = new WebOptions( rpParameters ); List<Visualization> entities = getEntity( pvUid, options ); if ( entities.isEmpty() ) { throw new WebMessageException( WebMessageUtils.notFound( Chart.class, pvUid ) ); } Visualization persistedObject = entities.get( 0 ); User user = currentUserService.getCurrentUser(); if ( !aclService.canUpdate( user, persistedObject ) ) { throw new UpdateAccessDeniedException( "You don't have the proper permissions to update this object." ); } Patch patch = null; if ( isJson( request ) ) { patch = patchService.diff( new PatchParams( jsonMapper.readTree( request.getInputStream() ) ) ); } else if ( isXml( request ) ) { patch = patchService.diff( new PatchParams( xmlMapper.readTree( request.getInputStream() ) ) ); } patchService.apply( patch, persistedObject ); manager.update( persistedObject ); }
Example 12
Source Project: SO File: ContextModelController.java License: BSD 2-Clause "Simplified" License | 4 votes |
/** * response for request "/cm, HTTP-method:PATCH(update)".<BR/> * @param cm ContextModelForMQ * @return updated ContextModelForMQ id */ @RequestMapping(method=RequestMethod.PATCH) public String updateContextModel(ContextModelForDB cm) { //implements... return null; }
Example 13
Source Project: Android_Code_Arbiter File: SafeSpringCsrfRequestMappingController.java License: GNU Lesser General Public License v3.0 | 4 votes |
@RequestMapping(value = "/request-mapping-patch", method = RequestMethod.PATCH) public void requestMappingPatch() { }
Example 14
Source Project: java-technology-stack File: ServletAnnotationControllerHandlerMethodTests.java License: MIT License | 4 votes |
@RequestMapping(value = "/something", method = RequestMethod.PATCH) @ResponseBody public String handlePartialUpdate(@RequestBody String content) throws IOException { return content; }
Example 15
Source Project: tutorials File: HeavyResourceController.java License: MIT License | 4 votes |
@RequestMapping(value = "/heavyresource2/{id}", method = RequestMethod.PATCH, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<?> partialUpdateGeneric(@RequestBody Map<String, Object> updates, @PathVariable("id") String id) { heavyResourceRepository.save(updates, id); return ResponseEntity.ok("resource updated"); }
Example 16
Source Project: SO File: OrchestrationServiceController.java License: BSD 2-Clause "Simplified" License | 4 votes |
/** * response for request "/os, HTTP-method:PATCH(update)".<BR/> * @param os OrchestrationServiceForDB * @return updated OrchestrationServiceForDB id */ @RequestMapping(method=RequestMethod.PATCH) public String updateOrchestrationService(OrchestrationServiceForDB os) { //implements... return null; }
Example 17
Source Project: SO File: CompositeVirtualObjectController.java License: BSD 2-Clause "Simplified" License | 4 votes |
/** * response for request "/cvo, HTTP-method:PATCH(update)".<BR/> * @param cvo CompositeVirtualObjectForDB * @return updated profile id */ @RequestMapping(method=RequestMethod.PATCH) public String updateCompositeVirtualObject(CompositeVirtualObjectForDB cvo) { //implements... return null; }
Example 18
Source Project: SO File: FixedDeviceController.java License: BSD 2-Clause "Simplified" License | 4 votes |
/** * response for request "/fd, HTTP-method:PATCH(update)".<BR/> * @param fd FixedDeviceForDB * @return updated FixedDeviceForDB id */ @RequestMapping(method=RequestMethod.PATCH) public String updateFixedDevice(FixedDeviceForDB fd) { //implements... return null; }
Example 19
Source Project: servicecomb-java-chassis File: CodeFirstSpringmvc.java License: Apache License 2.0 | 4 votes |
@ResponseHeaders({@ResponseHeader(name = "h1", response = String.class), @ResponseHeader(name = "h2", response = String.class)}) @RequestMapping(path = "/responseEntity", method = RequestMethod.PATCH) public ResponseEntity<Date> responseEntityPATCH(InvocationContext c1, @RequestAttribute("date") Date date) { return responseEntity(c1, date); }
Example 20
Source Project: Android_Code_Arbiter File: UnsafeSpringCsrfRequestMappingController.java License: GNU Lesser General Public License v3.0 | 4 votes |
/** * Mapping to several HTTP request methods is not OK if it's a mix of unprotected and protected HTTP request methods. */ @RequestMapping(value = "/request-mapping-all-unprotected-methods-and-one-protected-method", method = {RequestMethod.GET, RequestMethod.HEAD, RequestMethod.TRACE, RequestMethod.OPTIONS, RequestMethod.PATCH}) public void requestMappingAllUnprotectedMethodsAndOneProtectedMethod() { }