List of usage examples for org.springframework.http ResponseEntity ResponseEntity
public ResponseEntity(MultiValueMap<String, String> headers, HttpStatus status)
From source file:edu.eci.arsw.blindway.controller.SalaController.java
@RequestMapping(path = "/creacion/{nick}", method = RequestMethod.GET) public ResponseEntity<?> manejadorGetRecursoSalaCreacion(@PathVariable String nick) { try {/* w w w .j av a2s . c o m*/ Usuario u = StubUsuario.getInstance().cargarUsuarioPorNick(nick); int id = StubSala.getInstance().crearSala(u); return new ResponseEntity<>(StubSala.getInstance().obtenerSala(id), HttpStatus.ACCEPTED); } catch (RegistroUsuarioException | CreacionSalaException ex) { Logger.getLogger(SalasController.class.getName()).log(Level.SEVERE, null, ex); return new ResponseEntity<>(ex.getMessage(), HttpStatus.NOT_ACCEPTABLE); } }
From source file:gt.dakaik.rest.impl.SchoolImpl.java
@Override public ResponseEntity<School> findById(int idUsuario, String token, Long id) throws EntidadNoEncontradaException { School p = repoSchool.findOne(id);//from w w w .jav a 2 s .c om if (p != null) { return new ResponseEntity(p, HttpStatus.OK); } else { throw new EntidadNoEncontradaException("Entity School"); } }
From source file:edu.eci.arsw.kalendan.controllers.ProjectResourceController.java
@RequestMapping(path = "/projects/{projectid}/{username}", method = RequestMethod.GET) public ResponseEntity<?> projectGetRecursoActividades(@PathVariable Integer projectid, @PathVariable String username) { try {/*from w ww . j a va2 s .c o m*/ //System.out.println("lalalalala"); //obtener datos que se enviarn a travs del API return new ResponseEntity<>(pj.getActividadesProject(projectid, username), HttpStatus.ACCEPTED); } catch (Exception ex) { Logger.getLogger(ProjectResourceController.class.getName()).log(Level.SEVERE, null, ex); return new ResponseEntity<>("No encontro Datos!", HttpStatus.NOT_FOUND); } }
From source file:com.tribuo.backend.controllers.VentasController.java
/** * * @return/*from w ww . j a v a 2 s . co m*/ */ @RequestMapping(value = "/all", method = RequestMethod.GET) @ResponseBody public ResponseEntity<List<Ventas>> getVentas() { List<Ventas> u = se.getVentas(); return new ResponseEntity<>(u, HttpStatus.OK); }
From source file:io.fourfinanceit.homework.controller.ClientController.java
@RequestMapping(value = "/client", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Iterable<Client>> getClients() { Iterable<Client> clients = clientRepository.findAll(); return new ResponseEntity<Iterable<Client>>(clients, HttpStatus.OK); }
From source file:de.olivergierke.spring4.web.OrderController.java
@RequestMapping("/orders/{id}") ResponseEntity<OrderResourceModel> showOrder(@PathVariable Long id) { // /customers/6 URI uri = fromMethodCall(controller(CustomerController.class).customers(6L)).build().toUri(); // URI uri = fromMethodCall(controller(CustomerController.class).customers(6L)).build().toUri(); return new ResponseEntity<>(new OrderResourceModel(LocalDateTime.now(), uri), HttpStatus.OK); }
From source file:com.ar.dev.tierra.api.controller.CategoriaController.java
@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<?> getAll() { List<Categoria> categorias = facadeService.getCategoriaDAO().getAll(); if (!categorias.isEmpty()) { return new ResponseEntity<>(categorias, HttpStatus.OK); } else {/*w w w . j a v a 2 s . c om*/ return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } }
From source file:com.tamnd2.basicwebapp.rest.mvc.BlogEntryController.java
@RequestMapping(value = "/{blogEntryId}", method = RequestMethod.GET) public ResponseEntity<BlogEntryResource> getBlogEntry(@PathVariable Long blogEntryId) { BlogEntry entry = service.findBlogEntry(blogEntryId); if (entry != null) { BlogEntryResource res = (new BlogEntryResourceAsm()).toResource(entry); return new ResponseEntity<BlogEntryResource>(res, HttpStatus.OK); } else {//w w w. j a va2s. c o m return new ResponseEntity<BlogEntryResource>(HttpStatus.NOT_FOUND); } }
From source file:net.eusashead.hateoas.conditional.interceptor.SyncTestController.java
@RequestMapping(method = RequestMethod.HEAD) public ResponseEntity<String> head() { HttpHeaders headers = new HttpHeaders(); headers.setETag("\"123456\""); return new ResponseEntity<String>(headers, HttpStatus.OK); }
From source file:com.tribuo.backend.controllers.ComprasController.java
/** * * @return//from www. jav a2s .c o m */ @RequestMapping(value = "/all", method = RequestMethod.GET) @ResponseBody public ResponseEntity<List<Compras>> getCompras() { List<Compras> u = se.getCompras(); return new ResponseEntity<>(u, HttpStatus.OK); }