Java 类org.springframework.web.bind.annotation.DeleteMapping 实例源码
项目:Using-Spring-Oauth2-to-secure-REST
文件:AccountController.java
@PreAuthorize("isFullyAuthenticated()")
@DeleteMapping("/api/account/remove")
public ResponseEntity<GeneralController.RestMsg> removeAccount(Principal principal){
boolean isDeleted = accountService.removeAuthenticatedAccount();
if ( isDeleted ) {
return new ResponseEntity<>(
new GeneralController.RestMsg(String.format("[%s] removed.", principal.getName())),
HttpStatus.OK
);
} else {
return new ResponseEntity<GeneralController.RestMsg>(
new GeneralController.RestMsg(String.format("An error ocurred while delete [%s]", principal.getName())),
HttpStatus.BAD_REQUEST
);
}
}
项目:ponto-inteligente-api
文件:LancamentoController.java
/**
* Remove um lançamento por ID.
*
* @param id
* @return ResponseEntity<Response<Lancamento>>
*/
@DeleteMapping(value = "/{id}")
@PreAuthorize("hasAnyRole('ADMIN')")
public ResponseEntity<Response<String>> remover(@PathVariable("id") Long id) {
log.info("Removendo lançamento: {}", id);
Response<String> response = new Response<String>();
Optional<Lancamento> lancamento = this.lancamentoService.buscarPorId(id);
if (!lancamento.isPresent()) {
log.info("Erro ao remover devido ao lançamento ID: {} ser inválido.", id);
response.getErrors().add("Erro ao remover lançamento. Registro não encontrado para o id " + id);
return ResponseEntity.badRequest().body(response);
}
this.lancamentoService.remover(id);
return ResponseEntity.ok(new Response<String>());
}
项目:spring-web-services
文件:UserResource.java
@DeleteMapping("/users/{id}")
public void deleteUser(@PathVariable int id) {
User user = service.deleteById(id);
if(user==null)
throw new UserNotFoundException("id-"+ id);
}
项目:mongodb-file-server
文件:FileController.java
/**
* 删除文件
* @param id
* @return
*/
@DeleteMapping("/{id}")
@ResponseBody
public ResponseEntity<String> deleteFile(@PathVariable String id) {
try {
fileService.removeFile(id);
return ResponseEntity.status(HttpStatus.OK).body("DELETE Success!");
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage());
}
}
项目:xm-uaa
文件:UserResource.java
/**
* DELETE /users/:userKey : delete the "userKey" User.
*
* @param userKey the user key of the user to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/users/{userKey}")
@Timed
@Secured(AuthoritiesConstants.ADMIN)
public ResponseEntity<Void> deleteUser(@PathVariable String userKey) {
userService.deleteUser(userKey);
return ResponseEntity.ok().headers(HeaderUtil.createAlert("userManagement.deleted", userKey)).build();
}
项目:meparty
文件:RestApiProxyInvocationHandler.java
Annotation findMappingAnnotation(AnnotatedElement element) {
Annotation mappingAnnotation = element.getAnnotation(RequestMapping.class);
if (mappingAnnotation == null) {
mappingAnnotation = element.getAnnotation(GetMapping.class);
if (mappingAnnotation == null) {
mappingAnnotation = element.getAnnotation(PostMapping.class);
if (mappingAnnotation == null) {
mappingAnnotation = element.getAnnotation(PutMapping.class);
if (mappingAnnotation == null) {
mappingAnnotation = element.getAnnotation(DeleteMapping.class);
if (mappingAnnotation == null) {
mappingAnnotation = element.getAnnotation(PatchMapping.class);
}
}
}
}
}
if (mappingAnnotation == null) {
if (element instanceof Method) {
Method method = (Method) element;
mappingAnnotation = AnnotationUtils.findAnnotation(method, RequestMapping.class);
} else {
Class<?> clazz = (Class<?>) element;
mappingAnnotation = AnnotationUtils.findAnnotation(clazz, RequestMapping.class);
}
}
return mappingAnnotation;
}
项目:incubator-servicecomb-java-chassis
文件:SpringmvcSwaggerGeneratorContext.java
@Override
public boolean canProcess(Method method) {
return method.getAnnotation(RequestMapping.class) != null ||
method.getAnnotation(GetMapping.class) != null ||
method.getAnnotation(PutMapping.class) != null ||
method.getAnnotation(PostMapping.class) != null ||
method.getAnnotation(PatchMapping.class) != null ||
method.getAnnotation(DeleteMapping.class) != null;
}
项目:incubator-servicecomb-java-chassis
文件:MethodMixupAnnotations.java
@DeleteMapping(
path = "usingDeleteMapping/{targetName}",
consumes = {"text/plain", "application/*"},
produces = {"text/plain", "application/*"})
public String usingDeleteMapping(@RequestBody User srcUser, @RequestHeader String header,
@PathVariable String targetName, @RequestParam(name = "word") String word, @RequestAttribute String form) {
return String.format("%s %s %s %s %s", srcUser.name, header, targetName, word, form);
}
项目:Learning-Spring-5.0
文件:MyBookController.java
@DeleteMapping("/books/{ISBN}")
public ResponseEntity<Book> deleteBook(@PathVariable long ISBN) {
Book book = bookDAO.getBook(ISBN);
if (book == null) {
return new ResponseEntity<Book>(HttpStatus.NOT_FOUND);
}
boolean deleted = bookDAO.deleteBook(ISBN);
return new ResponseEntity(book, HttpStatus.OK);
}
项目:easynetcn-cloud
文件:JobServiceController.java
@DeleteMapping("")
public RestResult<Boolean> delete(@RequestParam("job_name") String jobName,
@RequestParam("job_group_name") String jobGroupName) throws SchedulerException {
jobService.delete(jobName, jobGroupName);
return new RestResult<>(true);
}
项目:xm-ms-entity
文件:VoteResource.java
/**
* DELETE /votes/:id : delete the "id" vote.
*
* @param id the id of the vote to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/votes/{id}")
@Timed
public ResponseEntity<Void> deleteVote(@PathVariable Long id) {
log.debug("REST request to delete Vote : {}", id);
voteRepository.delete(id);
voteSearchRepository.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
项目:spring-boot-jwt
文件:UserController.java
@DeleteMapping(value = "/{username}")
@PreAuthorize("hasRole('ROLE_ADMIN')")
@ApiOperation(value = "${UserController.delete}")
@ApiResponses(value = {//
@ApiResponse(code = 400, message = "Something went wrong"), //
@ApiResponse(code = 403, message = "Access denied"), //
@ApiResponse(code = 404, message = "The user doesn't exist"), //
@ApiResponse(code = 500, message = "Expired or invalid JWT token")})
public String delete(@ApiParam("Username") @PathVariable String username) {
userService.delete(username);
return username;
}
项目:gauravbytes
文件:UserController.java
@DeleteMapping(value = "/{id}")
public ResponseEntity<User> deleteUser(@PathVariable("id") long id) {
logger.info("Deleting User with id : {}", id);
Optional<User> optionalUser = userService.findById(id);
if (optionalUser.isPresent()) {
userService.deleteUserById(id);
return ResponseEntity.noContent().build();
}
else {
logger.info("User with id: {} not found", id);
return ResponseEntity.notFound().build();
}
}
项目:xm-ms-entity
文件:XmEntityResource.java
@DeleteMapping("/xm-entities/self/links/targets/{targetId}")
@Timed
public ResponseEntity<Void> deleteSelfLinkTarget(@PathVariable String targetId) {
log.debug("REST request to delete link target {} for self", targetId);
xmEntityService.deleteSelfLinkTarget(targetId);
return ResponseEntity.ok().build();
}
项目:product-management-system
文件:StoreController.java
/**
* Delete relation between {@link by.kraskovski.pms.domain.model.Stock} and {@link Store}
*/
@DeleteMapping("/stock-manage")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteStock(@RequestParam final String storeId,
@RequestParam final String stockId) {
log.info("Start delete stock: {} from store: {}", stockId, storeId);
storeService.deleteStock(storeId, stockId);
}
项目:JAVA-
文件:ScheduledController.java
@DeleteMapping
@ApiOperation(value = "删除任务")
@RequiresPermissions("sys.task.scheduled.delete")
public Object delete(@RequestBody TaskScheduled scheduled, ModelMap modelMap) {
Assert.notNull(scheduled.getTaskGroup(), "TASKGROUP");
Assert.notNull(scheduled.getTaskName(), "TASKNAME");
Parameter parameter = new Parameter(getService(), "delTask").setModel(scheduled);
provider.execute(parameter);
return setSuccessModelMap(modelMap);
}
项目:xm-ms-entity
文件:XmFunctionResource.java
/**
* DELETE /xm-functions/:id : delete the "id" xmFunction.
*
* @param id the id of the xmFunction to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/xm-functions/{id}")
@Timed
public ResponseEntity<Void> deleteXmFunction(@PathVariable Long id) {
log.debug("REST request to delete XmFunction : {}", id);
xmFunctionService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
项目:springboot-jsp-generator
文件:DictionaryController.java
@DeleteMapping(path = "/{id}")
public ResponseEntity<Void> delete(@PathVariable("id") Long id) {
if (this.dictionaryService.delete(id) == 1) {
return ResponseEntity.accepted().build();
} else {
return ResponseEntity.status(HttpStatus.NOT_FOUND).build();
}
}
项目:springboot-jsp-generator
文件:DictionaryController.java
@DeleteMapping(value= "/{dicId}/entries/{entryId}")
public String removeField(@PathVariable("dicId") Long dicId, @PathVariable("entryId") Long entryId
, Map<String, Object> model) {
Dictionary dictionaryEntity = this.dictionaryService.removeEntry(dicId, entryId);
model.put("dictionaryEntity", dictionaryEntity);
return "tool/dictionary_entries";
}
项目:springboot-jsp-generator
文件:TableController.java
@DeleteMapping(value = "/{id}")
public ResponseEntity<Void> delete(@PathVariable("id") Long id) {
if (this.tableService.delete(id) == 1) {
return ResponseEntity.accepted().build();
} else {
return ResponseEntity.status(HttpStatus.NOT_FOUND).build();
}
}
项目:product-management-system
文件:CartController.java
/**
* Delete product from cart by id.
*/
@DeleteMapping
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteProductFromCart(
@RequestParam final String cartId,
@RequestParam final String productStockId,
@RequestParam(value = "count", required = false, defaultValue = "1") final int count) {
log.info("start deleteProductFromCart: {} from cart: {} with count: {}", productStockId, cartId, count);
cartService.deleteProduct(cartId, productStockId, count);
}
项目:product-management-system
文件:StockController.java
/**
* Delete product from the stock
*/
@DeleteMapping("/{stockId}/product/{productId}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteProductFromStock(
@PathVariable final String stockId,
@PathVariable final String productId,
@RequestParam(value = "count", required = false, defaultValue = "1")
@Min(value = 1, message = "Can't validate products count. It must be greater than 1.") final int count) {
log.info("Start delete Product: {} from Stock: {} with count: {}", productId, stockId, count);
stockService.deleteProduct(stockId, productId, count);
}
项目:spring-microservice-sample
文件:UserController.java
@DeleteMapping(value = "/{username}")
public ResponseEntity deleteById(@PathVariable("id") String username) {
User _user = this.userRepository.findByUsername(username).orElseThrow(
() -> {
return new UserNotFoundException(username);
}
);
this.userRepository.delete(_user);
return ResponseEntity.noContent().build();
}
项目:che-starter
文件:WorkspaceController.java
@ApiOperation(value = "Delete an existing workspace")
@DeleteMapping("/workspace/oso/{name}")
public void deleteExistingWorkspaceOnOpenShift(@PathVariable String name, @RequestParam String masterUrl,
@RequestParam String namespace,
@ApiParam(value = "OpenShift token", required = true) @RequestHeader("Authorization") String openShiftToken)
throws JsonProcessingException, IOException, KeycloakException, RouteNotFoundException, WorkspaceNotFound {
deleteWorkspace(masterUrl, namespace, openShiftToken, name, null);
}
项目:plumdo-stock
文件:LotteryDetailResource.java
@DeleteMapping("/lottery-details/{detailId}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteLotteryDetail(@PathVariable Integer detailId) {
LotteryDetail lotteryDetail = getLotteryDetailFromRequest(detailId);
lotteryDetailRepository.delete(lotteryDetail);
}
项目:automat
文件:ScheduledController.java
@DeleteMapping
@ApiOperation(value = "删除任务")
@RequiresPermissions("sys.task.scheduled.close")
public Object delete(@RequestBody TaskScheduled scheduled, ModelMap modelMap) {
Assert.notNull(scheduled.getTaskGroup(), "TASKGROUP");
Assert.notNull(scheduled.getTaskName(), "TASKNAME");
Parameter parameter = new Parameter(getService(), "delTask").setModel(scheduled);
provider.execute(parameter);
return setSuccessModelMap(modelMap);
}
项目:Learning-Spring-Boot-2.0-Second-Edition
文件:HomeController.java
@DeleteMapping(BASE_PATH + "/" + FILENAME)
public Mono<String> deleteFile(@PathVariable String filename) {
return imageService.deleteImage(filename)
.then(Mono.just("redirect:/"));
}
项目:Learning-Spring-Boot-2.0-Second-Edition
文件:HomeController.java
@DeleteMapping(BASE_PATH + "/" + FILENAME)
public Mono<String> deleteFile(@PathVariable String filename) {
return imageService.deleteImage(filename)
.then(Mono.just("redirect:/"));
}
项目:Learning-Spring-Boot-2.0-Second-Edition
文件:HomeController.java
@DeleteMapping(BASE_PATH + "/" + FILENAME)
public Mono<String> deleteFile(@PathVariable String filename) {
return imageService.deleteImage(filename)
.log("delete-image")
.then(Mono.just("redirect:/"));
}
项目:Learning-Spring-Boot-2.0-Second-Edition
文件:HomeController.java
@DeleteMapping(BASE_PATH + "/" + FILENAME)
public Mono<String> deleteFile(@PathVariable String filename) {
return imageService.deleteImage(filename)
.then(Mono.just("redirect:/"));
}
项目:Learning-Spring-Boot-2.0-Second-Edition
文件:UploadController.java
@DeleteMapping(BASE_PATH + "/" + FILENAME)
public Mono<String> deleteFile(@PathVariable String filename) {
return imageService.deleteImage(filename)
.then(Mono.just("redirect:/"));
}
项目:Learning-Spring-Boot-2.0-Second-Edition
文件:UploadController.java
@DeleteMapping(BASE_PATH + "/" + FILENAME)
public Mono<String> deleteFile(@PathVariable String filename) {
return imageService.deleteImage(filename)
.then(Mono.just("redirect:/"));
}
项目:Learning-Spring-Boot-2.0-Second-Edition
文件:UploadController.java
@DeleteMapping(BASE_PATH + "/" + FILENAME)
public Mono<String> deleteFile(@PathVariable String filename) {
return imageService.deleteImage(filename)
.then(Mono.just("redirect:/"));
}
项目:openshift-workshop
文件:FrontendController.java
@DeleteMapping(path = "/users/{id}")
public void deleteUser(@PathVariable("id") String uuid) {
repository.deleteById(p -> p.onNext(uuid));
}
项目:Learning-Spring-Boot-2.0-Second-Edition
文件:HomeController.java
@DeleteMapping(BASE_PATH + "/" + FILENAME)
public Mono<String> deleteFile(@PathVariable String filename) {
return imageService.deleteImage(filename)
.then(Mono.just("redirect:/"));
}
项目:Learning-Spring-Boot-2.0-Second-Edition
文件:HomeController.java
@DeleteMapping(BASE_PATH + "/" + FILENAME)
public Mono<String> deleteFile(@PathVariable String filename) {
return imageService.deleteImage(filename)
.then(Mono.just("redirect:/"));
}
项目:Learning-Spring-Boot-2.0-Second-Edition
文件:HomeController.java
@DeleteMapping(BASE_PATH + "/" + FILENAME)
public Mono<String> deleteFile(@PathVariable String filename) {
return imageService.deleteImage(filename)
.then(Mono.just("redirect:/"));
}
项目:errorest-spring-boot-starter
文件:Controller.java
@DeleteMapping(path = "/request-method-not-supported", produces = {APPLICATION_JSON_VALUE, APPLICATION_XML_VALUE})
public void throwHttpRequestMethodNotSupportedException() {
}
项目:JAVA-
文件:SysSessionController.java
@DeleteMapping
@ApiOperation(value = "删除会话")
@RequiresPermissions("sys.base.session.delete")
public Object delete(ModelMap modelMap, @RequestBody SysSession param) {
return super.delete(modelMap, param);
}
项目:Learning-Spring-Boot-2.0-Second-Edition
文件:HomeController.java
@DeleteMapping(BASE_PATH + "/" + FILENAME)
public Mono<String> deleteFile(@PathVariable String filename) {
return imageService.deleteImage(filename)
.then(Mono.just("redirect:/"));
}