当前位置: 首页>>代码示例>>Java>>正文


Java HttpStatus.NO_CONTENT属性代码示例

本文整理汇总了Java中org.springframework.http.HttpStatus.NO_CONTENT属性的典型用法代码示例。如果您正苦于以下问题:Java HttpStatus.NO_CONTENT属性的具体用法?Java HttpStatus.NO_CONTENT怎么用?Java HttpStatus.NO_CONTENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.springframework.http.HttpStatus的用法示例。


在下文中一共展示了HttpStatus.NO_CONTENT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: globalsettingsHolidaysYearPost

@Override
@PreAuthorize("hasAuthority('admin')")
public ResponseEntity<Object> globalsettingsHolidaysYearPost( @Min(2000) @Max(2100)@ApiParam(value = "",required=true ) @PathVariable("year") Integer year,
    @ApiParam(value = "The holidays to set" ,required=true )  @Valid @RequestBody Holidays holidays)  throws ApiException {
    try {
         
    globalsettingsService.setHolidays(year, holidays);
    return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    
    } catch (OptimisticLockException ex) {
        try {
            Holidays lastHolidays = globalsettingsService.getHolidays(year);
            throw new ConcurrentModificationException(409, "Concurrent modification error.", lastHolidays);
        } catch (ApiException ex1) {
            Logger.getLogger(SettingsApiController.class.getName()).log(Level.SEVERE, null, ex1);
            throw new ApiException(500, "Concurrent modification exception: internal error");
        }
    }    
    
}
 
开发者ID:jrtechnologies,项目名称:yum,代码行数:20,代码来源:GlobalsettingsApiController.java

示例2: updateContributionStatus

@ApiOperation(value = "Update the contribution status")
@ApiResponses(value = {
        @ApiResponse(code = 403, message = "No permissions"),
        @ApiResponse(code = 404, message = "No contribution found or no user found")
})
@PreAuthorize("hasRole('ROLE_USER')")
@PutMapping(value = "/contributions/{id}/status")
@ResponseStatus(HttpStatus.NO_CONTENT)
public
void updateContributionStatus(
        @ApiParam(value = "The contribution ID", required = true)
        @PathVariable("id") final Long id,
        @ApiParam(value = "Status for the contribution", required = true)
        @RequestParam("status") final VerificationStatus status,
        @ApiParam(value = "Comment for verification")
        @RequestParam(value = "comment", required = false) final String comment
) {
    log.info("Called with id {}, status {}, comment {}", id, status, comment);

    this.movieContributionPersistenceService.updateContributionStatus(id, authorizationService.getUserId(), status, comment);
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:21,代码来源:MovieContributionRestController.java

示例3: findByName

/**
 * Fetch users with the specified name. A partial case-insensitive match is
 * supported. So <code>http://.../user/rest</code> will find any users with
 * upper or lower case 'rest' in their name.
 *
 * @param name
 * @return A non-null, non-empty collection of users.
 */
@HystrixCommand(fallbackMethod = "defaultUsers")
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<Collection<User>> findByName(@RequestParam("name") String name) {
    logger.info(String.format("user-service findByName() invoked:%s for %s ", userService.getClass().getName(), name));
    name = name.trim().toLowerCase();
    Collection<User> users;
    try {
        users = userService.findByName(name);
    } catch (Exception ex) {
        logger.log(Level.SEVERE, "Exception raised findByName REST Call", ex);
        return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
    }
    return users.size() > 0 ? new ResponseEntity<>(users, HttpStatus.OK)
            : new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Microservices-with-Java-9-Second-Edition,代码行数:23,代码来源:UserController.java

示例4: event

@PostMapping("/stack-events")
public ResponseEntity<String> event(@RequestBody String payload) {
    try {
        String result = java.net.URLDecoder.decode(payload, "UTF-8");
        ObjectMapper objectMapper = new ObjectMapper();

        StackEvent stackEvent = objectMapper.readValue(result, StackEvent.class);
        stackEvent.setUserToken(authenticationService.getCurrentToken());

        payload = jsonTransformService.write(stackEvent);

        this.queueMessagingTemplate.send(queue,
                MessageBuilder.withPayload(payload).build());
    } catch (IOException e) {
        log.error(e.getLocalizedMessage());
    }

    return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
 
开发者ID:peavers,项目名称:swordfish-service,代码行数:19,代码来源:RestoreCommandGatewayRestController.java

示例5: findByName

/**
 * Fetch restaurants with the specified name. A partial case-insensitive
 * match is supported. So <code>http://.../restaurants/rest</code> will find
 * any restaurants with upper or lower case 'rest' in their name.
 *
 * @param name
 * @return A non-null, non-empty collection of restaurants.
 */
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<Collection<Restaurant>> findByName(@RequestParam("name") String name) {
    logger.info(String.format("restaurant-service findByName() invoked:{} for {} ", restaurantService.getClass().getName(), name));
    name = name.trim().toLowerCase();
    Collection<Restaurant> restaurants;
    try {
        restaurants = restaurantService.findByName(name);
    } catch (Exception ex) {
        logger.log(Level.SEVERE, "Exception raised findByName REST Call", ex);
        return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
    }
    return restaurants.size() > 0 ? new ResponseEntity<>(restaurants, HttpStatus.OK)
            : new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Microservices-with-Java-9-Second-Edition,代码行数:22,代码来源:RestaurantController.java

示例6: deleteBot

/**
 * Deletes a Bot configuration for a given id.
 *
 * @param user  the authenticated user.
 * @param botId the id of the Bot configuration to delete.
 * @return 204 'No Content' HTTP status code if delete successful, some other HTTP status code otherwise.
 */
@PreAuthorize("hasRole('ADMIN')")
@RequestMapping(value = "/{botId}", method = RequestMethod.DELETE)
public ResponseEntity<?> deleteBot(@AuthenticationPrincipal User user, @PathVariable String botId) {

    LOG.info("DELETE " + CONFIG_ENDPOINT_BASE_URI + botId + " - deleteBot()"); // - caller: " + user.getUsername());

    final BotConfig deletedConfig = botConfigService.deleteBotConfig(botId);
    return deletedConfig == null
            ? new ResponseEntity<>(HttpStatus.NOT_FOUND)
            : new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
 
开发者ID:gazbert,项目名称:bxbot-ui-server,代码行数:18,代码来源:BotsConfigController.java

示例7: changeLevel

@PutMapping("/logs")
@ResponseStatus(HttpStatus.NO_CONTENT)
@Timed
public void changeLevel(@RequestBody LoggerVM jsonLogger) {
    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel()));
}
 
开发者ID:oktadeveloper,项目名称:jhipster-microservices-example,代码行数:7,代码来源:LogsResource.java

示例8: delete

@Authorize(scopes = "authorities:delete")
@ResponseStatus(value = HttpStatus.NO_CONTENT)
@RequestMapping(value = "/v1/authorities/{id}", method = DELETE)
public void delete(@PathVariable String id) {
	Authority authority = authorityService.findById(id).orThrow();
	authorityService.delete(authority).orThrow();
}
 
开发者ID:PatternFM,项目名称:tokamak,代码行数:7,代码来源:AuthoritiesEndpoint.java

示例9: deleteUser

@RequestMapping(value = "/users/{id}", method = RequestMethod.DELETE)
public ResponseEntity<?> deleteUser(@PathVariable("id") long id) {
    logger.info("Fetching & Deleting User with id {}", id);

    User user = userService.getById(id);
    if (user == null) {
        logger.error("Unable to delete. User with id {} not found.", id);
        return new ResponseEntity(new CustomErrorType("Unable to delete. User with id " + id + " not found."),
                HttpStatus.NOT_FOUND);
    }
    userService.delete(id);
    return new ResponseEntity<User>(HttpStatus.NO_CONTENT);
}
 
开发者ID:noveogroup-amorgunov,项目名称:spring-mvc-react,代码行数:13,代码来源:UserController.java

示例10: getStats

/**
 * Gets the stats.
 *
 * @param request the request
 * @param model the model
 * @param startDate the start date
 * @param endDate the end date
 * @param metric the metric
 * @return the stats
 * @throws Exception the exception
 */
@RequestMapping(value = "/{startDate}/{endDate}/{metric:.+}", method = RequestMethod.GET,
        produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody ResponseEntity<Object> getStats(@Context HttpServletRequest request,
         @PathVariable String startDate, @PathVariable String endDate,
        @PathVariable String metric) throws Exception {

    log.info("Inside StatsController method getStats ");
    String response = statsService.getStats(startDate, endDate, metric, request);
    if (response == null || response.equalsIgnoreCase(""))
        return new ResponseEntity<Object>(new JSONObject(), HttpStatus.NO_CONTENT);
    return new ResponseEntity<Object>(response, HttpStatus.OK);
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:23,代码来源:StatsController.java

示例11: removeItem

@RequestMapping(value = "/remove/{productId}", method = RequestMethod.PUT)
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void removeItem(@PathVariable long productId, HttpServletRequest request) {
    String sessionId = request.getSession(true).getId();
    Cart cart = cartService.read(sessionId);
    if(cart== null) {
        cart = cartService.create(new Cart(sessionId));
    }
    Product product = productService.read(productId);
    if(product == null) {
        throw new IllegalArgumentException(new ProductNotFoundException(productId));
    }
    cart.removeCartItem(new CartItem(product));
    cartService.update(sessionId, cart);
}
 
开发者ID:TomirKlos,项目名称:Webstore,代码行数:15,代码来源:CartRestController.java

示例12: deleteImage

/**
 * Delete image from system.
 */
@DeleteMapping("/{id}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteImage(@PathVariable final String id) {
    log.info("deleting image with id: \"" + id + "\"");
    imageService.delete(id);
}
 
开发者ID:akraskovski,项目名称:product-management-system,代码行数:9,代码来源:ImageController.java

示例13: post

@PostMapping("/teams")
public ResponseEntity<String> post(@RequestBody String payload) {
    log.info(new GsonBuilder().setPrettyPrinting().create().toJson(new JsonParser().parse(payload)));

    Team team = jsonTransformService.read(Team.class, payload);
    team.setRequestToken(authenticationService.getCurrentToken());

    this.queueMessagingTemplate.send(queue, MessageBuilder.withPayload(jsonTransformService.write(team)).build());

    return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
 
开发者ID:peavers,项目名称:swordfish-service,代码行数:11,代码来源:TeamCommandGatewayRestController.java

示例14: stopJms

@RequestMapping(path="/mockedserver/jms/stop", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody ResponseEntity<?> stopJms() throws MockServerException {
    mockedServerEngineService.shutdownJms();
    return new ResponseEntity<String>(HttpStatus.NO_CONTENT);
}
 
开发者ID:mgtechsoftware,项目名称:smockin,代码行数:5,代码来源:MockedServerEngineController.java

示例15: deleteLotteryDetail

@DeleteMapping("/lottery-details/{detailId}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteLotteryDetail(@PathVariable Integer detailId) {
	LotteryDetail lotteryDetail = getLotteryDetailFromRequest(detailId);
	lotteryDetailRepository.delete(lotteryDetail);
}
 
开发者ID:wengwh,项目名称:plumdo-stock,代码行数:6,代码来源:LotteryDetailResource.java


注:本文中的org.springframework.http.HttpStatus.NO_CONTENT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。