Example usage for org.springframework.http HttpStatus NOT_FOUND

List of usage examples for org.springframework.http HttpStatus NOT_FOUND

Introduction

In this page you can find the example usage for org.springframework.http HttpStatus NOT_FOUND.

Prototype

HttpStatus NOT_FOUND

To view the source code for org.springframework.http HttpStatus NOT_FOUND.

Click Source Link

Document

404 Not Found .

Usage

From source file:br.com.authentication.business.handler.GlobalRestExceptionHandler.java

@ExceptionHandler(Exception.class)
@ResponseBody//  w  w w.  j a  v  a 2 s .  co  m
public ResponseEntity<Object> handleException(Exception e) {
    LOGGER.info("handleException {} {}", e.getClass(), e.getMessage());
    return new ResponseEntity<Object>(e.getMessage(), HttpStatus.NOT_FOUND);
}

From source file:com.sg.rest.controllers.RestErrorHandler.java

@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
@ResponseStatus(HttpStatus.NOT_FOUND)
@ResponseBody//ww w. ja v  a  2s . co  m
public void processResourceNotFoundError(HttpRequestMethodNotSupportedException ex) {
}

From source file:br.com.avelar.bac.controllers.CarController.java

@CrossOrigin
@RequestMapping("/license/{license}")
public ResponseEntity<Car> findByLicense(@PathVariable String license) {
    Car Car = service.findOne(license);/*from   w w w . j  ava  2 s. c om*/

    if (Car == null) {
        return new ResponseEntity<Car>(HttpStatus.NOT_FOUND);
    }

    return new ResponseEntity<Car>(Car, HttpStatus.OK);

}

From source file:gt.dakaik.exceptions.ManejadorExcepciones.java

@ResponseBody
@ExceptionHandler(EntidadNoEncontradaException.class)
@ResponseStatus(HttpStatus.NOT_FOUND)
Map<String, String> entidadNoEncontradaExceptionHandler(EntidadNoEncontradaException ex) {
    Map<String, String> res = new HashMap<>();
    res.put("error", "Entidad no Encontrada");
    res.put("entidad", ex.getMessage());
    return res;/* w w w . j  a  v a2s.  co m*/
}

From source file:org.cloudifysource.rest.util.NotFoundHttpException.java

public NotFoundHttpException() {
    super(HttpStatus.NOT_FOUND);
}

From source file:com.appglu.AppGluHttpNotFoundException.java

public AppGluHttpNotFoundException(Error error) {
    super(HttpStatus.NOT_FOUND.value(), error);
}

From source file:cherry.foundation.springmvc.ExceptionController.java

@ExceptionHandler(NotFoundException.class)
public ResponseEntity<String> handleNotFoundException(NotFoundException ex) {
    return new ResponseEntity<String>(HttpStatus.NOT_FOUND);
}

From source file:org.obiba.onyx.core.service.impl.RestfulParticipantRegistryErrorHandler.java

@Override
public void handleError(ClientHttpResponse response) throws IOException {
    if (response.getStatusCode().equals(HttpStatus.NOT_FOUND)) {
        throw new NoSuchParticipantException(response.getStatusText());
    }/*  w w  w  .j  a va  2  s  .c  om*/
    throw new ParticipantRegistryLookupException(response.getStatusText());
}

From source file:cherry.foundation.springmvc.ExceptionControllerTest.java

@Test
public void testHandleNotFoundException() {
    ExceptionController c = new ExceptionController();
    ResponseEntity<String> response = c.handleNotFoundException(new NotFoundException());
    assertEquals(HttpStatus.NOT_FOUND, response.getStatusCode());
    assertNull(response.getBody());//from w  ww  .  j  a v a2s  . c  o  m
}

From source file:de.msg.controller.RouteControllerAdvice.java

@ExceptionHandler(value = RouteNotFoundException.class)
@ResponseStatus(HttpStatus.NOT_FOUND)
@ResponseBody/* ww w  . j a v a 2s  . com*/
public RouteErrorStatus exception(RouteNotFoundException exception) {
    return new RouteErrorStatus(6573L, "RouteNotFound: " + exception.getMessage());

}