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(HttpStatus status) 

Source Link

Document

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

Usage

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

/**
 *
 * @param marca/*w ww .  ja v  a  2 s.  co m*/
 * @return
 */
@RequestMapping(value = "/insert", method = RequestMethod.POST)
public ResponseEntity<Void> insertMarca(@RequestBody Marcas marca) {
    se.createMarca(marca);
    return new ResponseEntity<>(HttpStatus.CREATED);
}

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

/**
 *
 * @param compra/*from  w  w  w.  j a v  a 2 s  .  com*/
 * @return
 */
@RequestMapping(value = "/insert", method = RequestMethod.POST)
public ResponseEntity<Void> insertCompra(@RequestBody Compras compra) {
    se.registerCompra(compra);
    return new ResponseEntity<>(HttpStatus.CREATED);
}

From source file:org.cloudfoundry.test.web.ServiceController.java

@RequestMapping(value = "/beans", method = RequestMethod.GET)
public ResponseEntity<List<String>> getBeanNames() {
    if (serviceHolder.getBeanNames() == null) {
        return new ResponseEntity<List<String>>(HttpStatus.NOT_FOUND);
    }// w  w  w.  j a v a  2 s.c  o  m
    List<String> beans = Arrays.asList(serviceHolder.getBeanNames());
    return new ResponseEntity<List<String>>(beans, HttpStatus.OK);
}

From source file:com.mycompany.springrest.controllers.RoleController.java

@RequestMapping(value = "/role", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Role>> listRoles() {
    List<Role> roles = roleService.listRoles();
    if (roles.isEmpty()) {
        return new ResponseEntity<List<Role>>(HttpStatus.NO_CONTENT);
    }/*  www  . jav  a  2s  . c  o  m*/
    return new ResponseEntity<List<Role>>(roles, HttpStatus.OK);
}

From source file:es.galvarez.rest.config.AuthController.java

@RequestMapping("/auth")
public HttpEntity<String> auth() {
    return new ResponseEntity<String>(HttpStatus.OK);
}

From source file:edu.eci.cosw.controllers.ProductsController.java

@RequestMapping(value = "familia/{id}/terreno", method = RequestMethod.POST)
public ResponseEntity<?> adicionarTerreno(@RequestBody Terreno terreno, @PathVariable("id") int id) {
    services.addTerreno(id, terreno);//from  ww  w  .  j  ava2s.  co  m
    return new ResponseEntity<>(HttpStatus.ACCEPTED);
}

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

/**
 *
 * @param p// w  w  w .j a v a 2  s  .  c o  m
 * @return
 */
@RequestMapping(value = "/insert", method = RequestMethod.POST)
public ResponseEntity<Void> insertSucursal(@RequestBody Sucursales p) {
    se.createSucursal(p);
    return new ResponseEntity<>(HttpStatus.CREATED);
}

From source file:edu.eci.arsw.msgbroker.STOMPMessagesHandler.java

@RequestMapping(value = "/puntos", method = RequestMethod.POST)
public ResponseEntity<?> manejadorPostRecursoXX(@RequestBody Point pt) {
    try {//from  w ww.  j  a  v  a2  s.co m
        //registrar dato
        agregarPunto(pt);
        msgt.convertAndSend("/topic/newpoint", pt);
        return new ResponseEntity<>(HttpStatus.CREATED);
    } catch (Exception ex) {
        Logger.getLogger(STOMPMessagesHandler.class.getName()).log(Level.SEVERE, null, ex);
        return new ResponseEntity<>("Error bla bla bla", HttpStatus.FORBIDDEN);
    }
}

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

/**
 *
 * @param categoria/*w w w .  j a v a  2  s. c om*/
 * @return
 */
@RequestMapping(value = "/insert", method = RequestMethod.POST)
public ResponseEntity<Void> insertCategoria(@RequestBody Categorias categoria) {
    se.insertCategoria(categoria);
    return new ResponseEntity<>(HttpStatus.CREATED);
}

From source file:br.upe.community.ui.ControllerCategoria.java

@RequestMapping(value = "/cadastrar", headers = "Accept=*/*", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody ResponseEntity<?> adicionarCategoria(Categoria categoria) {
    try {//from www . j  a  va2 s  .  c o m
        fachada.cadastrar(categoria);
        return new ResponseEntity<String>(HttpStatus.OK);
    } catch (CategoriaExistenteException e) {
        return new ResponseEntity<CategoriaExistenteException>(e, HttpStatus.BAD_REQUEST);
    }
}