Example usage for org.springframework.http ResponseEntity ResponseEntity

List of usage examples for org.springframework.http ResponseEntity ResponseEntity

Introduction

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

Prototype

public ResponseEntity(MultiValueMap<String, String> headers, HttpStatus status) 

Source Link

Document

Create a new HttpEntity with the given headers and status code, and no body.

Usage

From source file:com.diagrama.repository.PensumController.java

@RequestMapping(value = "/pensum/{pensum_id}/grupos/{grupoid}/estudiante", method = RequestMethod.GET)
public ResponseEntity<?> BuscarPensum(@PathVariable int pensum_id, @PathVariable int grupoid) {
    return new ResponseEntity<>(pensumInterface.getestudiantesbyPensum(pensum_id, grupoid), HttpStatus.OK);
}

From source file:edu.javeriana.patronessoftware.rest.DispatcherController.java

@RequestMapping(value = "/agregar", method = RequestMethod.POST)
public ResponseEntity<Frecuencia> agregar(@RequestBody Invernadero invernadero) {
    return new ResponseEntity(new Frecuencia(ThreadLocalRandom.current().nextInt(5, 60)), HttpStatus.OK);
}

From source file:business.GlobalExceptionHandlerController.java

@ExceptionHandler(ExcerptListUploadError.class)
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
@ResponseBody/*from   w  w w .j  a  v  a  2 s . c om*/
public ResponseEntity<String> handleExcerptListUploadError(ExcerptListUploadError e) {
    log.error("ExcerptListUploadError: " + e.getMessage());
    return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST);
}

From source file:be.boyenvaesen.RestControllers.SampleRestController.java

@RequestMapping("/employees")
@ResponseBody/*from ww  w .j  a  va 2 s  . c  om*/
public ResponseEntity<List<Employee>> getAll() {
    return new ResponseEntity<>(service.getAll(), HttpStatus.OK);

}

From source file:sample.tomcat.web.DemoController.java

@RequestMapping(value = "/responseEntity", method = RequestMethod.GET)
public ResponseEntity<String> helloWorld() {
    return new ResponseEntity<String>("response from ResponseEntity returning method", HttpStatus.OK);
}

From source file:gt.dakaik.rest.impl.CityImpl.java

@Override
public ResponseEntity<City> findById(int idUsuario, String token, Long id) throws EntidadNoEncontradaException {
    City p = repoCity.findOne(id);// w  w w. java  2 s  .c o m

    if (p != null) {
        return new ResponseEntity(p, HttpStatus.OK);
    } else {
        throw new EntidadNoEncontradaException("Entity User");
    }
}

From source file:com.diagrama.repository.PeriodoController.java

@RequestMapping(value = "/periodo", method = RequestMethod.POST)
public ResponseEntity<?> crearPeriodo(@RequestBody PeriodosLectivos periodosLectivos) {
    periodoRepository.save(periodosLectivos);
    return new ResponseEntity<>(periodosLectivos, HttpStatus.CREATED);
}

From source file:gt.dakaik.rest.impl.StateImpl.java

@Override
public ResponseEntity<State> findById(int idUsuario, String token, Long id)
        throws EntidadNoEncontradaException {
    State p = repoState.findOne(id);

    if (p != null) {
        return new ResponseEntity(p, HttpStatus.OK);
    } else {/*from  ww  w.java 2 s . c om*/
        throw new EntidadNoEncontradaException("Entity User");
    }
}

From source file:org.zalando.zmon.actuator.RestControllerAdvice.java

@ExceptionHandler(Exception.class)
public ResponseEntity<String> handleException(final Exception e) {
    return new ResponseEntity<String>("TEST-ERROR", HttpStatus.SERVICE_UNAVAILABLE);
}

From source file:com.recursivechaos.clearent.controller.SaleController.java

@RequestMapping(value = "/sales", method = RequestMethod.POST)
public ResponseEntity<Void> postSale(@RequestBody Sale sale) {
    Sale newSale = saleService.createSale(sale);
    return new ResponseEntity<>(createHeaders(newSale), HttpStatus.CREATED);
}