List of usage examples for org.springframework.http HttpStatus BANDWIDTH_LIMIT_EXCEEDED
HttpStatus BANDWIDTH_LIMIT_EXCEEDED
To view the source code for org.springframework.http HttpStatus BANDWIDTH_LIMIT_EXCEEDED.
Click Source Link
From source file:plbtw.klmpk.barang.hilang.controller.UserController.java
@RequestMapping(method = RequestMethod.DELETE, produces = "application/json") public CustomResponseMessage deleteUser(@RequestHeader String apiKey, @RequestBody UserRequest userRequest) { try {/*from w w w. j a v a2s . c om*/ if (!authApiKey(apiKey)) { return new CustomResponseMessage(HttpStatus.FORBIDDEN, "Please use your api key to authentication"); } LogRequest temp = DependencyFactory.createLog(apiKey, "Delete"); if (checkRateLimit(RATE_LIMIT, apiKey)) { return new CustomResponseMessage(HttpStatus.BANDWIDTH_LIMIT_EXCEEDED, "Please wait a while, you have reached your rate limit"); } Log log = new Log(); log.setApiKey(temp.getApiKey()); log.setStatus(temp.getStatus()); log.setTimeRequest(temp.getTime_request()); logService.addLog(log); userService.deleteUser(userRequest.getId()); return new CustomResponseMessage(HttpStatus.CREATED, "Delete Successful"); } catch (Exception ex) { return new CustomResponseMessage(HttpStatus.BAD_REQUEST, ex.toString()); } }