本文整理匯總了Java中org.springframework.web.bind.annotation.RequestMethod.PATCH屬性的典型用法代碼示例。如果您正苦於以下問題:Java RequestMethod.PATCH屬性的具體用法?Java RequestMethod.PATCH怎麽用?Java RequestMethod.PATCH使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.springframework.web.bind.annotation.RequestMethod
的用法示例。
在下文中一共展示了RequestMethod.PATCH屬性的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateGameInLibrary
@RequestMapping(method = RequestMethod.PATCH, value = "/{userId}/games/{libraryId}")
@ApiOperation(value = "Update a game in your library",
notes = "Example Minimum Payload: {\"attributes\": {\"state\": \"SOLD\"}}")
public void updateGameInLibrary(Authentication user, @PathVariable Long userId, @PathVariable Long libraryId,
@RequestBody LibraryGameData data) {
libraryService.updateGameInLibrary(user, libraryId, data);
}
示例2: responseEntityPATCH
@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) {
HttpHeaders headers = new HttpHeaders();
headers.add("h1", "h1v " + c1.getContext().get(Const.SRC_MICROSERVICE).toString());
InvocationContext c2 = ContextUtils.getInvocationContext();
headers.add("h2", "h2v " + c2.getContext().get(Const.SRC_MICROSERVICE).toString());
return new ResponseEntity<Date>(date, headers, HttpStatus.ACCEPTED);
}
示例3: updateNote
@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);
}
示例4: updateTag
@RequestMapping(value = "/{id}", method = RequestMethod.PATCH)
@ResponseStatus(HttpStatus.NO_CONTENT)
void updateTag(@PathVariable("id") long id, @RequestBody TagPatchInput tagInput) {
Tag tag = findTagById(id);
if (tagInput.getName() != null) {
tag.setName(tagInput.getName());
}
this.repository.save(tag);
}
示例5: requestMappingUnprotectedAndProtectedUncommonMethods
/**
* 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-unprotected-and-protected-uncommon-methods", method = {RequestMethod.OPTIONS, RequestMethod.PATCH})
public void requestMappingUnprotectedAndProtectedUncommonMethods() {
}
開發者ID:blackarbiter,項目名稱:Android_Code_Arbiter,代碼行數:6,代碼來源:UnsafeSpringCsrfRequestMappingController.java
示例6: requestMappingAllUnprotectedMethodsAndOneProtectedMethod
/**
* 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() {
}
開發者ID:blackarbiter,項目名稱:Android_Code_Arbiter,代碼行數:7,代碼來源:UnsafeSpringCsrfRequestMappingController.java
示例7: patch
@RequestMapping(value = "/patch", method = RequestMethod.PATCH)
@ResponseBody
public Map<String, String> patch(@RequestBody Map<String, String> source) {
source.put("now", Calendar.getInstance().getTime().toString());
log.info("patch......");
return source;
}
示例8: extractMapping
/**
* Searches {@link org.springframework.web.bind.annotation.RequestMapping RequestMapping}
* annotation on the given method argument and extracts
* If RequestMapping annotation is not found, NoRequestMappingFoundException is thrown.
* {@link org.springframework.http.HttpMethod HttpMethod} type equivalent to
* {@link org.springframework.web.bind.annotation.RequestMethod RequestMethod} type
*
* @param element AnnotatedElement object to be examined.
* @return Mapping object
*/
Mapping extractMapping(AnnotatedElement element) {
Annotation annotation = findMappingAnnotation(element);
String[] urls;
RequestMethod requestMethod;
String consumes;
if (annotation instanceof RequestMapping) {
RequestMapping requestMapping = (RequestMapping) annotation;
requestMethod = requestMapping.method().length == 0
? RequestMethod.GET : requestMapping.method()[0];
urls = requestMapping.value();
consumes = StringHelper.getFirstOrEmpty(requestMapping.consumes());
} else if (annotation instanceof GetMapping) {
requestMethod = RequestMethod.GET;
urls = ((GetMapping) annotation).value();
consumes = StringHelper.getFirstOrEmpty(((GetMapping) annotation).consumes());
} else if (annotation instanceof PostMapping) {
requestMethod = RequestMethod.POST;
urls = ((PostMapping) annotation).value();
consumes = StringHelper.getFirstOrEmpty(((PostMapping) annotation).consumes());
} else if (annotation instanceof PutMapping) {
requestMethod = RequestMethod.PUT;
urls = ((PutMapping) annotation).value();
consumes = StringHelper.getFirstOrEmpty(((PutMapping) annotation).consumes());
} else if (annotation instanceof DeleteMapping) {
requestMethod = RequestMethod.DELETE;
urls = ((DeleteMapping) annotation).value();
consumes = StringHelper.getFirstOrEmpty(((DeleteMapping) annotation).consumes());
} else if (annotation instanceof PatchMapping) {
requestMethod = RequestMethod.PATCH;
urls = ((PatchMapping) annotation).value();
consumes = StringHelper.getFirstOrEmpty(((PatchMapping) annotation).consumes());
} else {
throw new NoRequestMappingFoundException(element);
}
HttpMethod httpMethod = HttpMethod.resolve(requestMethod.name());
String url = StringHelper.getFirstOrEmpty(urls);
MediaType mediaType;
try {
mediaType = MediaType.valueOf(consumes);
} catch (InvalidMediaTypeException exception) {
mediaType = MediaType.APPLICATION_JSON_UTF8;
}
return new Mapping(httpMethod, url, mediaType);
}
示例9: updateShortUrl
@ApiOperation(value = "Update the short code to point to another redirect URL", response = ShortUrl.class, produces = "application/json")
@RequestMapping(value = "shorturl", method = RequestMethod.PATCH)
public ShortUrl updateShortUrl(@RequestParam String existingCode, @RequestParam String newUrl) {
return service.updateShortUrl(existingCode, newUrl);
}
示例10: requestMappingAllProtectedMethodsAndOneUnprotectedMethod
/**
* 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-protected-methods-and-one-unprotected-method",
method = {RequestMethod.POST, RequestMethod.PUT, RequestMethod.DELETE, RequestMethod.PATCH, RequestMethod.OPTIONS})
public void requestMappingAllProtectedMethodsAndOneUnprotectedMethod() {
}
開發者ID:blackarbiter,項目名稱:Android_Code_Arbiter,代碼行數:7,代碼來源:UnsafeSpringCsrfRequestMappingController.java
示例11: requestMappingPatch
@RequestMapping(value = "/request-mapping-patch", method = RequestMethod.PATCH)
public void requestMappingPatch() {
}
開發者ID:blackarbiter,項目名稱:Android_Code_Arbiter,代碼行數:3,代碼來源:SafeSpringCsrfRequestMappingController.java
示例12: requestMappingSeveralProtectedMethods
/**
* Mapping to several HTTP request methods is fine as long as all the HTTP request methods used are protected.
*/
@RequestMapping(value = "/request-mapping-several-protected-methods",
method = {RequestMethod.POST, RequestMethod.PUT, RequestMethod.DELETE, RequestMethod.PATCH})
public void requestMappingSeveralProtectedMethods() {
}
開發者ID:blackarbiter,項目名稱:Android_Code_Arbiter,代碼行數:7,代碼來源:SafeSpringCsrfRequestMappingController.java