List of usage examples for org.springframework.http ResponseEntity ResponseEntity
public ResponseEntity(HttpStatus status)
From source file:net.eusashead.hateoas.response.impl.DeleteResponseBuilderImpl.java
@Override public ResponseEntity<Void> build() { return new ResponseEntity<Void>(HttpStatus.NO_CONTENT); }
From source file:nu.yona.server.rest.ControllerBase.java
protected <T> ResponseEntity<T> createResponse(HttpStatus status) { return new ResponseEntity<>(status); }
From source file:rest.DependenciaRestController.java
@RequestMapping(value = "/dependencias/", method = RequestMethod.GET) public ResponseEntity<List<DependenciaBean>> listAll() { List<DependenciaBean> dependencias = dependenciaService.findAll(); if (dependencias.isEmpty()) { return new ResponseEntity<List<DependenciaBean>>(HttpStatus.NO_CONTENT); }/*from ww w . ja v a2 s. c o m*/ return new ResponseEntity<List<DependenciaBean>>(dependencias, HttpStatus.OK); }
From source file:edu.sjsu.cmpe275.project.controller.UserController.java
/** get all users * @return void/* w w w . j a va 2 s .co m*/ */ @RequestMapping(value = "", method = RequestMethod.GET) public ResponseEntity<?> getUsers() { List<User> users = userDao.getAllUsers(); if (users == null) { return new ResponseEntity<Object>(HttpStatus.BAD_REQUEST); } else { return new ResponseEntity<Object>(users, HttpStatus.OK); } }
From source file:rest.JugadorRestController.java
@RequestMapping(value = "/{id}", method = RequestMethod.PUT) public ResponseEntity<?> modificarJugador(@PathVariable int id, @RequestBody Jugador j) { logicaJugador.modificarJugador(j, id); return new ResponseEntity<>(HttpStatus.CREATED); }
From source file:edu.eci.arsw.controllers.ProductsController.java
@RequestMapping(method = RequestMethod.POST) public ResponseEntity<?> addProduct(@RequestBody Producto p) { services.addNewProduct(p);/* w ww . jav a 2 s . c om*/ Logger.getLogger(ProductsController.class.getName()).log(Level.INFO, null, "POST request processed" + p); return new ResponseEntity<>(HttpStatus.ACCEPTED); }
From source file:edu.eci.cosw.restcontrollers.ClienteRest.java
@RequestMapping(value = "/", method = RequestMethod.POST) public ResponseEntity<?> persist(@RequestBody Cliente c) { if (sf.existeCliente(c.getIdcliente())) { return new ResponseEntity<>(HttpStatus.CONFLICT); } else {/* w ww . java 2 s . c o m*/ sf.guardarCliente(c); } return new ResponseEntity<>(HttpStatus.CREATED); }
From source file:edu.sjsu.cmpe275.project.controller.RoomController.java
/** Get all rooms * @return List<Room></Room> *//* ww w . j a v a2 s . c om*/ @RequestMapping(value = "", method = RequestMethod.GET) public ResponseEntity<?> createRoom() { List<Room> rooms = roomDao.getAllRoom(); if (rooms == null) { return new ResponseEntity<Object>(HttpStatus.NOT_FOUND); } else { return new ResponseEntity<Object>(rooms, HttpStatus.OK); } }
From source file:rest.TorneoRestController.java
@RequestMapping(value = "/{id}", method = RequestMethod.PUT) public ResponseEntity<?> modificarTorneo(@PathVariable int id, @RequestBody Torneo t) { logicaTorneo.modificarTorneo(t, id); return new ResponseEntity<>(HttpStatus.CREATED); }
From source file:com.opensearchserver.hadse.index.IndexCatalog.java
public final static ResponseEntity<?> create(String indexName, int shards, int replicas) throws HadseIndexException, JsonGenerationException, JsonMappingException, IOException { File indexDirectory = new File(Hadse.data_dir, indexName); if (indexDirectory.exists()) return new ResponseEntity<Object>(HttpStatus.CONFLICT); if (!indexDirectory.mkdir()) return new ResponseEntity<String>("Unable to create the index directory", HttpStatus.INTERNAL_SERVER_ERROR); IndexItem indexItem = IndexItem.get(indexName); for (int shard = 1; shard <= shards; shard++) { String shardName = Integer.toString(shard); ShardDef shardDef = ShardDef.write(indexDirectory, shardName, ClusterCatalog.nextShardCandidate()); indexItem.add(ShardItem.load(shardDef, indexDirectory)); }//ww w . j av a2s.c o m return new ResponseEntity<String>("Index created: " + indexName, HttpStatus.CREATED); }