當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。