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.tribuo.backend.controllers.MarcasController.java

/**
 *
 * @return//from w  w w .  j a v a 2 s. c  o m
 */
@RequestMapping(value = "/all", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<List<Marcas>> getUsuarios() {
    List<Marcas> m = se.getMarcas();
    return new ResponseEntity<>(m, HttpStatus.OK);
}

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

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<EntidadBancaria> list = facadeService.getEntidadBancariaDAO().getAll();
    if (!list.isEmpty()) {
        return new ResponseEntity<>(list, HttpStatus.OK);
    } else {/*from   w ww  . j ava  2s.c  o  m*/
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

From source file:com.tribuo.backend.controllers.TiendasController.java

/**
 *
 * @return/*from w ww.ja  va  2s . co m*/
 */
@RequestMapping(value = "/all", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<List<Tiendas>> getTiendas() {
    List<Tiendas> u = se.getTiendas();
    return new ResponseEntity<>(u, HttpStatus.OK);
}

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

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<TipoProducto> tipoProducto = facadeService.getTipoProductoDAO().getAll();
    if (!tipoProducto.isEmpty()) {
        return new ResponseEntity<>(tipoProducto, HttpStatus.OK);
    } else {//  w ww  . j a  va2s .com
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

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

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<Proveedor> proveedor = facadeService.getProveedorDAO().getAll();
    if (!proveedor.isEmpty()) {
        return new ResponseEntity<>(proveedor, HttpStatus.OK);
    } else {//  ww  w .  j ava2 s  .  com
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

From source file:fi.hsl.parkandride.front.SchemaController.java

@RequestMapping(method = GET, value = PAYMENT_METHODS)
public ResponseEntity<List<PaymentMethod>> paymentMethods() {
    return new ResponseEntity<>(asList(PaymentMethod.values()), OK);
}

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

@CrossOrigin
@RequestMapping("/model/{model}")
public ResponseEntity<List<Car>> findByModel(@PathVariable("model") String model) {
    List<Car> cars = service.findByModel(model);
    return new ResponseEntity<List<Car>>(cars, HttpStatus.OK);
}

From source file:br.com.hyperclass.snackbar.restapi.CashierController.java

@RequestMapping(value = "/cashier/sale-by-date", method = RequestMethod.POST)
public ResponseEntity<SalesReportWrapper> saleForDate(@RequestBody final SalesDateWrapper salesDateWrapper) {
    return new ResponseEntity<>(
            new SalesReportWrapper(
                    cashier.saleByPeriod(salesDateWrapper.getDateInitial(), salesDateWrapper.getDateInitial())),
            HttpStatus.OK);/*ww  w .  j  a va  2  s .co  m*/
}

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

@RequestMapping(path = "/humidity", method = RequestMethod.POST)
public ResponseEntity<Humidity> postNew(@RequestBody postObject<Float> hum) {
    return new ResponseEntity<>(service.addNew(hum), HttpStatus.CREATED);
}

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

@Override
public ResponseEntity<Forum> findById(int idUsuario, String token, Long id)
        throws EntidadNoEncontradaException {
    Forum p = repoForum.findOne(id);//from w w  w. j a  v a  2 s  .  c o m

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