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:com.unidev.polycms.hateoas.controller.ControllerErrorHandler.java
@ExceptionHandler(StorageNotFoundException.class) @ResponseStatus(value = HttpStatus.NOT_FOUND) @ResponseBody//from w w w.j a v a 2 s.c o m public Response handleNotFoundError(HttpServletRequest req) { Response<String, String> response = new Response<>(); response.setPayload("Not found"); response.setStatus("not-found"); return response; }
From source file:com.expedia.seiso.web.controller.ExceptionHandlerAdvice.java
@ExceptionHandler(ResourceNotFoundException.class) @ResponseStatus(HttpStatus.NOT_FOUND) @ResponseBody/* www . ja v a 2 s.c om*/ public ErrorObject handleResourceNotFoundException(ResourceNotFoundException e, WebRequest request) { return new ErrorObject(C.EC_RESOURCE_NOT_FOUND, e.getMessage()); }
From source file:org.openbaton.autoscaling.api.exceptions.GlobalExceptionHandler.java
@ExceptionHandler({ NotFoundException.class, NoResultException.class }) @ResponseStatus(value = HttpStatus.NOT_FOUND) protected ResponseEntity<Object> handleNotFoundException(Exception e, WebRequest request) { log.error("Exception with message " + e.getMessage() + " was thrown"); ExceptionResource exc = new ExceptionResource("Not Found", e.getMessage()); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); return handleExceptionInternal(e, exc, headers, HttpStatus.UNPROCESSABLE_ENTITY, request); }
From source file:com.monitor.controller.MessageController.java
@ApiOperation(value = "show", notes = "show a message") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public ResponseEntity<Message> show(@PathVariable(name = "id", required = true) String id) { final Message messageFound = service.findOne(id); if (messageFound != null) { return new ResponseEntity<>(messageFound, HttpStatus.FOUND); } else {//w w w. j a v a 2 s . c o m return new ResponseEntity<>(HttpStatus.NOT_FOUND); } }
From source file:org.kurento.repository.test.TimeoutTests.java
@Test public void playerAutoTerminationTest() throws Exception { String id = uploadFile(new File("test-files/sample.txt")); log.info("File uploaded"); RepositoryHttpPlayer player = getRepository().findRepositoryItemById(id).createRepositoryHttpPlayer(); player.setAutoTerminationTimeout(1000); RestTemplate template = getRestTemplate(); assertEquals(HttpStatus.OK, template.getForEntity(player.getURL(), byte[].class).getStatusCode()); log.info("Request 1 Passed"); Thread.sleep(300);/*from w w w .ja va2s.co m*/ assertEquals(HttpStatus.OK, template.getForEntity(player.getURL(), byte[].class).getStatusCode()); log.info("Request 2 Passed"); Thread.sleep(1500); assertEquals(HttpStatus.NOT_FOUND, template.getForEntity(player.getURL(), byte[].class).getStatusCode()); log.info("Request 3 Passed"); }
From source file:org.openbaton.vnfm.api.exceptions.GlobalExceptionHandler.java
@ExceptionHandler({ NotFoundException.class, NoResultException.class, NullPointerException.class }) @ResponseStatus(value = HttpStatus.NOT_FOUND) protected ResponseEntity<Object> handleNotFoundException(Exception e, WebRequest request) { log.error("Exception with message " + e.getMessage() + " was thrown"); ExceptionResource exc = new ExceptionResource("Not Found", e.getMessage()); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); return handleExceptionInternal(e, exc, headers, HttpStatus.NOT_FOUND, request); }
From source file:com.boxedfolder.carrot.Application.java
@Bean public EmbeddedServletContainerCustomizer containerCustomizer() { return new EmbeddedServletContainerCustomizer() { @Override//from w w w .j av a 2 s .c om public void customize(ConfigurableEmbeddedServletContainer container) { ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/401.html"); ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html"); ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.html"); container.addErrorPages(error401Page, error404Page, error500Page); } }; }
From source file:com.armeniopinto.time.ApplicationStarter.java
@ExceptionHandler public void handleUnkonwnDateFormat(final IllegalArgumentException iae, final HttpServletResponse response) throws IOException { response.sendError(HttpStatus.NOT_FOUND.value()); }
From source file:org.cloudfoundry.test.web.ServiceController.java
@RequestMapping(value = "/beans", method = RequestMethod.GET) public ResponseEntity<List<String>> getBeanNames() { if (serviceHolder.getBeanNames() == null) { return new ResponseEntity<List<String>>(HttpStatus.NOT_FOUND); }//from ww w . jav a2 s.c o m List<String> beans = Arrays.asList(serviceHolder.getBeanNames()); return new ResponseEntity<List<String>>(beans, HttpStatus.OK); }
From source file:com.hypersocket.auth.json.BootstrapResourceController.java
@ExceptionHandler(ResourceNotFoundException.class) @ResponseStatus(value = HttpStatus.NOT_FOUND) public void resourceChangeError(HttpServletRequest request, HttpServletResponse response, ResourceNotFoundException e) {/*ww w.ja v a2s . c o m*/ log.error("Resource not found error", e); }