java类org.springframework.web.bind.annotation.ResponseStatus的实例源码

ProductController.java 文件源码 项目:product-management-system 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Delete {@link Product} from database by identifier.
 */
@DeleteMapping("/{id}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteProduct(@PathVariable final String id) {
    log.info("Start deleteProduct: {}", id);
    productService.delete(id);
}
LeveringsautorisatieController.java 文件源码 项目:OperatieBRP 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Slaat een gewijzigd item op.
 * @param leveringsautorisatieId Id van de leveringsautorisatie
 * @param dienstbundelGroepId groep ID
 * @param item item
 * @return item
 * @throws NotFoundException wanneer het item niet gevonden kan worden om te updaten
 */
@RequestMapping(value = "/{id2}/dienstbundels/{did8}/dienstbundelgroepen/{gid2}/attributen", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)
public final Page<DienstbundelGroepAttribuutView> saveDienstbundelGroepAttribuut(
        @PathVariable("id2") final Integer leveringsautorisatieId,
        @PathVariable("gid2") final Integer dienstbundelGroepId,
        @RequestBody final DienstbundelGroepAttribuutView item) throws NotFoundException {
    return new SaveTransaction<Page<DienstbundelGroepAttribuutView>>(getTransactionTemplate()).execute(() -> {
        final Leveringsautorisatie leveringsautorisatie = get(leveringsautorisatieId);
        if (!Stelsel.BRP.equals(leveringsautorisatie.getStelsel())) {
            throw new IllegalArgumentException("Groepen kunnen niet worden toegevoegd op een GBA autorisatie.");
        }

        final DienstbundelGroep dienstbundelGroep = dienstbundelGroepController.get(dienstbundelGroepId);

        if (item.getId() != null && !item.isActief()) {
            // Verwijderen attribuut uit dienstbundelgroep.
            dienstbundelGroep.getDienstbundelGroepAttribuutSet().removeIf(attribuut -> attribuut.getId().equals(item.getId()));
        } else if (item.isActief()) {
            // Toevoegen attribuut aan dienstbundelgroep.
            dienstbundelGroep.getDienstbundelGroepAttribuutSet().add(new DienstbundelGroepAttribuut(dienstbundelGroep, item.getAttribuut()));
        }

        dienstbundelGroepController.save(dienstbundelGroep);
        return new PageImpl<>(bepaalActiefStatusAttributenVoorGroep(dienstbundelGroep));
    });
}
LocAdviceErrorAutoConfiguration.java 文件源码 项目:loc-framework 阅读 19 收藏 0 点赞 0 评论 0
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
@ExceptionHandler(MethodArgumentNotValidException.class)
//验证requestbody失败异常的处理
public BasicResult handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
  logError("methodArgumentNotValidException", e.getMessage(), e);
  return BasicResult.fail(BasicResultCode.METHOD_ARGUMENT_MISS_ERROR.getCode(),
      BasicResultCode.METHOD_ARGUMENT_MISS_ERROR.getMsg(),
      MethodArgumentNotValidExceptionHelper.firstErrorMessage(e.getBindingResult()));
}
StockReportResource.java 文件源码 项目:plumdo-stock 阅读 21 收藏 0 点赞 0 评论 0
@GetMapping("/stock-reports/stock-details")
@ResponseStatus(HttpStatus.OK)
public PageResponse<StockDetail> getStockDetails(@RequestParam Map<String, String> allRequestParams) {
    Criteria<StockDetail> criteria = new Criteria<StockDetail>();
    criteria.add(Restrictions.like("stockCode", allRequestParams.get("stockCode"), true));
    criteria.add(Restrictions.like("stockName", allRequestParams.get("stockName"), true));
    criteria.add(Restrictions.gte("stockDate", ObjectUtils.convertToDate(allRequestParams.get("stockDateBegin")), true));
    criteria.add(Restrictions.lte("stockDate", ObjectUtils.convertToDate(allRequestParams.get("stockDateEnd")), true));
    return createPageResponse(stockDetailRepository.findAll(criteria, getPageable(allRequestParams)));
}
LibraryController.java 文件源码 项目:corporate-game-share 阅读 33 收藏 0 点赞 0 评论 0
@ResponseStatus(value = HttpStatus.CREATED)
@RequestMapping(method = RequestMethod.POST, value = "/{userId}/games")
@ApiOperation(value = "Add a game to your library",
              notes = "Example Minimum Payload: {\"attributes\": {\"game\": {\"id\": \"123\"}}}")
public void addGameToLibrary(Authentication user, @PathVariable Long userId, @RequestBody LibraryGameData data) {
    libraryService.addGameToLibrary(user, userId, data);
}
AboutController.java 文件源码 项目:spring-cloud-skipper 阅读 38 收藏 0 点赞 0 评论 0
/**
 * Return meta information about the Skipper server.
 *
 * @return Detailed information about the enabled features, versions of implementation
 * libraries, and security configuration
 */
@RequestMapping(method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public AboutResource getAboutResource() {
    final AboutResource aboutResource = new AboutResource();
    final VersionInfo versionInfo = getVersionInfo();
    aboutResource.setVersionInfo(versionInfo);
    return aboutResource;
}
AssetController.java 文件源码 项目:iotplatform 阅读 25 收藏 0 点赞 0 评论 0
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
@RequestMapping(value = "/asset/{assetId}", method = RequestMethod.DELETE)
@ResponseStatus(value = HttpStatus.OK)
public void deleteAsset(@PathVariable("assetId") String strAssetId) throws IoTPException {
  checkParameter("assetId", strAssetId);
  try {
    AssetId assetId = new AssetId(toUUID(strAssetId));
    checkAssetId(assetId);
    assetService.deleteAsset(assetId);
  } catch (Exception e) {
    throw handleException(e);
  }
}
GlobalHandler.java 文件源码 项目:spring-boot-jwt-jpa 阅读 17 收藏 0 点赞 0 评论 0
/**
 * 400 - Bad Request
 */
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(ConstraintViolationException.class)
public ResponseEntity handleServiceException(ConstraintViolationException e) {
    LOGGER.error("参数验证失败", e);
    Set<ConstraintViolation<?>> violations = e.getConstraintViolations();
    ConstraintViolation<?> violation = violations.iterator().next();
    String message = violation.getMessage();
    return ResponseEntity.badRequest().body("parameter:" + message);
}
FormDefinitionJsonResource.java 文件源码 项目:plumdo-work 阅读 13 收藏 0 点赞 0 评论 0
@ApiOperation(value = "获取表单定义设计内容", notes = "根据表单定义的id来获取表单定义设计内容")
@ApiImplicitParam(name = "id", value = "表单定义ID", required = true, dataType = "Long", paramType = "path")
@RequestMapping(value = "/form-definitions/{id}/json", method = RequestMethod.GET)
@ResponseStatus(value = HttpStatus.OK)
public String getEditorJson(@PathVariable Long id) throws UnsupportedEncodingException {
    FormDefinition formDefinition = getFormDefinitionFromRequest(id);
    String editorJson = null;
    if (formDefinition.getEditorSourceBytes() == null) {
        editorJson = objectMapper.createArrayNode().toString();
    } else {
        editorJson = new String(formDefinition.getEditorSourceBytes(), "utf-8");
    }
    return editorJson;
}
TestController.java 文件源码 项目:java-spring-web 阅读 15 收藏 0 点赞 0 评论 0
@ResponseStatus(value = HttpStatus.CONFLICT, reason = "Data integrity violation")
@ExceptionHandler(MappedException.class)
public void mappedExceptionHandler(MappedException ex) {
    verifyActiveSpan();

    // Nothing to do
}


问题


面经


文章

微信
公众号

扫码关注公众号