List of usage examples for org.springframework.http HttpStatus NOT_FOUND
HttpStatus NOT_FOUND
To view the source code for org.springframework.http HttpStatus NOT_FOUND.
Click Source Link
From source file:io.getlime.push.errorhandling.DefaultExceptionHandler.java
@ResponseStatus(HttpStatus.NOT_FOUND) // 404 @ExceptionHandler(EmptyResultDataAccessException.class) @ResponseBody//w w w . j av a2 s. c om public ErrorResponse handleDatabaseNotFound(Exception e) { ErrorResponse response = new ErrorResponse(new Error(DatabaseError.Code.ERROR_DATABASE, e.getMessage())); Logger.getLogger(DefaultExceptionHandler.class.getName()).log(Level.SEVERE, null, e); return response; }
From source file:org.kurento.repository.RepositoryController.java
@RequestMapping(method = RequestMethod.DELETE, value = "/{itemId}") public void removeRepositoryItem(@PathVariable("itemId") String itemId, HttpServletResponse response) { try {/*from w w w .java 2 s.co m*/ repoService.removeRepositoryItem(itemId); } catch (ItemNotFoundException e) { try { response.sendError(HttpStatus.NOT_FOUND.value(), e.getMessage()); } catch (IOException ioe) { ioe.printStackTrace(); throw new KurentoException(ioe); } } }
From source file:com._8x8.presentation.restfulController.ZPayRestfulController.java
@RequestMapping(value = "/decryptQRCode/{qrCode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<String> decryptQRCode(@PathVariable("qrCode") String qrCode) { try {//from w ww . j a v a 2 s . c om String code = _encryptorService.decryptCode(qrCode); return new ResponseEntity<String>(code, HttpStatus.OK); } catch (Exception ex) { Logger.getLogger(ZPayRestfulController.class.getName()).log(Level.SEVERE, null, ex); return new ResponseEntity<String>(HttpStatus.NOT_FOUND); } }
From source file:ch.wisv.areafiftylan.exception.GlobalControllerExceptionHandler.java
@ExceptionHandler(OrderNotFoundException.class) public ResponseEntity<?> handleOrderNotFoundException(OrderNotFoundException ex) { return createResponseEntity(HttpStatus.NOT_FOUND, ex.getMessage()); }
From source file:fi.helsinki.opintoni.integration.unisport.UnisportRestClient.java
@Override public Optional<UnisportUser> getUnisportUserByPrincipal(String username) { UnisportUser unisportUser = null;//from w w w . j a v a 2s . c o m try { unisportUser = restTemplate .exchange("{baseUrl}/api/v1/{locale}/ext/opintoni/authorization?eppn={userName}", HttpMethod.GET, null, new ParameterizedTypeReference<UnisportUser>() { }, baseUrl, new Locale("en"), username) .getBody(); } catch (HttpStatusCodeException e) { if (!e.getStatusCode().equals(HttpStatus.NOT_FOUND)) { throw e; } } return Optional.ofNullable(unisportUser); }
From source file:com.todo.backend.web.rest.UserApi.java
@RequestMapping(value = "/user/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed/*w ww .j av a 2 s . co m*/ @Transactional(readOnly = true) @PreAuthorize("hasAuthority('ADMIN')") public ResponseEntity<ReadUserResponse> readUser(@PathVariable Long id) { log.debug("GET /user/{}", id); final Optional<User> result = Optional.ofNullable(userRepository.findOne(id)); if (result.isPresent()) { return ResponseEntity.ok().body(convertToReadUserResponse(result.get())); } return new ResponseEntity<>(HttpStatus.NOT_FOUND); }
From source file:nu.yona.server.rest.HibernateStatisticsController.java
@RequestMapping(value = "/", params = { "reset" }, method = RequestMethod.GET) @ResponseBody// w ww . j a va 2 s . c o m public ResponseEntity<StatisticsResource> getStatistics( @RequestParam(value = "reset", defaultValue = "false") String resetStr) { if (!hibernateStatisticsService.isStatisticsEnabled()) { return createResponse(HttpStatus.NOT_FOUND); } ResponseEntity<StatisticsResource> responseEntity = createOkResponse( hibernateStatisticsService.getStatistics(), createResourceAssembler()); if (Boolean.TRUE.toString().equals(resetStr)) { hibernateStatisticsService.resetStatistics(); } return responseEntity; }
From source file:com._8x8.presentation.restController.UserRestController.java
@RequestMapping(value = "/user/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<User> getUser(@PathVariable("id") int id) { System.out.println("Fetching User with id " + id); User user = _userService.GetUserById(id); if (user == null) { System.out.println("User with id " + id + " not found"); return new ResponseEntity<User>(HttpStatus.NOT_FOUND); }//www . j av a2 s .c o m return new ResponseEntity<User>(user, HttpStatus.OK); }
From source file:com.tamnd.app.rest.controller.AccountController.java
@RequestMapping(value = "/current", method = RequestMethod.GET) public ResponseEntity<AccountResource> getUserInfo(Principal user) { Account account = accountService.findByAccountName(user.getName()); if (account != null) { AccountResource res = new AccountResourceAsm().toResource(account); return new ResponseEntity<>(res, HttpStatus.OK); }//from w ww. ja va2s .c o m return new ResponseEntity<>(HttpStatus.NOT_FOUND); }
From source file:org.osiam.auth.exception.OsiamExceptionHandler.java
@ExceptionHandler(value = { ResourceNotFoundException.class }) @ResponseStatus(HttpStatus.NOT_FOUND) protected @ResponseBody JsonErrorResult handleResourceNotFound(HttpServletRequest request, HttpServletResponse response, ResourceNotFoundException e) { LOGGER.log(Level.WARNING, "A ResourceNotFoundException occurred", e); JsonErrorResult error = new JsonErrorResult(HttpStatus.NOT_FOUND.name(), e.getMessage()); return error; }