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:com.ar.dev.tierra.api.controller.ChartController.java

@RequestMapping(value = "/medio/cantidad", method = RequestMethod.GET)
public ResponseEntity<?> getMedioCantidad(@RequestParam("idMedioPago") int idMedioPago) {
    List<Chart> chart = impl.getVentaMedioPago(idMedioPago);
    if (!chart.isEmpty()) {
        return new ResponseEntity<>(chart, HttpStatus.OK);
    } else {/*w  ww  . ja v  a 2 s  . co m*/
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }
}

From source file:com.ar.dev.tierra.api.controller.DetalleFacturaController.java

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<DetalleFactura> list = facadeService.getDetalleFacturaDAO().getAll();
    if (!list.isEmpty()) {
        return new ResponseEntity<>(list, HttpStatus.OK);
    } else {/*  w w  w .j  a v  a  2s.  co m*/
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }
}

From source file:org.trustedanalytics.examples.hbase.api.ExceptionHandlerAdvice.java

@ExceptionHandler
@ResponseStatus(HttpStatus.NOT_FOUND)
@ResponseBody/*from   www  .j  a va2  s  .  co  m*/
public String handleTableNotFound(TableNotFoundException ex) {
    LOG.error("Table not found", ex);
    return ex.getMessage();
}

From source file:io.pivotal.strepsirrhini.chaoslemur.task.TaskManager.java

@RequestMapping(method = RequestMethod.GET, value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<?> read(@PathVariable Long id) {
    Task task = this.tasks.get(id);
    if (task == null) {
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }//from  w w  w. java2  s . co m

    return new ResponseEntity<>(this.resourceAssembler.toResource(task), HttpStatus.OK);
}

From source file:com.accenture.banking.resource.OfficeController.java

/**
 * This method returns a Office by Id given
 * /*from  w w  w  .  j a va 2 s  .c  o  m*/
 * @return OfficeDto
 */
@RequestMapping(value = "/{officeId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<OfficeDto> getOfficeById(@PathVariable("officeId") Long officeId) {
    Office office = this.officeService.getOfficeById(officeId);
    if (office == null) {
        return new ResponseEntity(HttpStatus.NOT_FOUND);
    }
    OfficeDto dto = dtoBuilder.buildOfficeDto(office);
    return new ResponseEntity<>(dto, HttpStatus.OK);
}

From source file:cn.cdwx.jpa.web.account.TaskRestController.java

@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaTypes.JSON_UTF_8)
public Task get(@PathVariable("id") String id) {
    Task task = taskService.getTask(id);
    if (task == null) {
        String message = "?(id:" + id + ")";
        logger.warn(message);// w w  w.j a v  a  2 s.  c o m
        throw new RestException(HttpStatus.NOT_FOUND, message);
    }
    return task;
}

From source file:com.iggroup.oss.sample.web.controller.exception.ExceptionHandler.java

/**
 * Exception handler for ReferenceNotFoundExceptions
 * //  w  w  w.  ja v  a  2s.  c  o  m
 * @param nfe the exception being handled
 */
@AfterThrowing(pointcut = "execution (* com.iggroup.wt.referencerest.service.*.*(..))", throwing = "nfe")
public void handleNotFoundException(ReferenceNotFoundException nfe) {
    throw new SampleException(new ReferenceNotFoundError(nfe.getReference()), HttpStatus.NOT_FOUND);
}

From source file:com.tamnd2.basicwebapp.rest.mvc.BlogEntryController.java

@RequestMapping(value = "/{blogEntryId}", method = RequestMethod.DELETE)
public ResponseEntity<BlogEntryResource> deleteBlogEntry(@PathVariable Long blogEntryId) {
    BlogEntry entry = service.deleteBlogEntry(blogEntryId);
    if (entry != null) {
        BlogEntryResource res = new BlogEntryResourceAsm().toResource(entry);
        return new ResponseEntity<BlogEntryResource>(res, HttpStatus.OK);
    } else {//from   w w  w .j a  va 2  s .  co m
        return new ResponseEntity<BlogEntryResource>(HttpStatus.NOT_FOUND);
    }
}

From source file:rest.DependenciaRestController.java

@RequestMapping(value = "/dependencia/{codDep}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<DependenciaBean> getDependencia(@PathVariable("codDep") long codDep) {
    System.out.println("Obtener una Dependencia cod_Dep = " + codDep);
    DependenciaBean dependencia = dependenciaService.findById(codDep);
    if (dependencia == null) {
        System.out.println("Dependencia con codDep = " + codDep + " No encontrado");
        return new ResponseEntity<DependenciaBean>(HttpStatus.NOT_FOUND);
    }/*from   w ww.j a v a 2  s  . co m*/
    return new ResponseEntity<DependenciaBean>(dependencia, HttpStatus.OK);
}

From source file:io.pivotal.ecosystem.service.HelloController.java

@RequestMapping(value = "/users/{username}", method = RequestMethod.DELETE)
ResponseEntity<Void> deleteUser(@PathVariable(value = "username") String username) {
    if (!userStore.userExists(username)) {
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }/*from   w  ww .ja  v a  2  s  .c om*/
    userStore.delete(username);
    return new ResponseEntity<>(HttpStatus.OK);
}