Example usage for org.springframework.http HttpStatus OK

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

Introduction

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

Prototype

HttpStatus OK

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

Click Source Link

Document

200 OK .

Usage

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 {/*from  w ww .  j  av a  2s .  c om*/
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

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 {// www  .ja  v a  2 s  .  c om
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

From source file:se.sawano.scala.examples.scalaspringmvc.JavaController.java

@RequestMapping(value = "/indata", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)
public void receiveData(@RequestBody @Valid JavaIndata indata) {
    logger.debug("Got valid POSTed data: {}", indata);
}

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");
    }
}

From source file:com.example.todo.api.todo.TodoRestController.java

@RequestMapping(method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public List<TodoResource> getTodos() {
    Collection<Todo> todos = todoService.findAll();
    List<TodoResource> todoResources = new ArrayList<>();
    for (Todo todo : todos) {
        todoResources.add(beanMapper.map(todo, TodoResource.class));
    }//from   w  w w.j  ava2 s . c  o m
    return todoResources;
}

From source file:eu.cloudwave.wp5.feedbackhandler.controller.MainController.java

@RequestMapping("/")
@ResponseStatus(HttpStatus.OK)
@ResponseBody/*w  ww .j av a2 s .  c  om*/
public ModelAndView root() {
    sampleLogger.info(LOGGING_MSG);
    final ModelAndView model = new ModelAndView(ANGULAR_JSP_FILE);
    model.addObject("content", ROOT_CONTENT);
    return model;
}

From source file:br.com.porao.ui.ControllerProduto.java

@RequestMapping(value = "/produto/add", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody ResponseEntity<?> addProduto(Produto produto) {
    try {/*  www .  ja va  2s  .c  o m*/
        this.fachada.cadastrarProduto(produto);
        return new ResponseEntity<String>(HttpStatus.OK);
    } catch (ProdutoExistenteException produtoexistente) {
        return new ResponseEntity<ProdutoExistenteException>(produtoexistente, HttpStatus.BAD_REQUEST);
    }
}

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

@Override
public ResponseEntity<Licences> findById(int idUsuario, String token, Long id)
        throws EntidadNoEncontradaException {
    Licences p = repoLic.findOne(id);//  ww w .ja v a2  s. c om

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

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:com.tribuo.backend.controllers.ProductosController.java

/**
 *
 * @return//w w  w . j  a  v  a  2  s.com
 */
@RequestMapping(value = "/all", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<List<Productos>> getProductos() {
    List<Productos> u = se.getProductos();
    return new ResponseEntity<>(u, HttpStatus.OK);
}