List of usage examples for org.springframework.http ResponseEntity ResponseEntity
public ResponseEntity(HttpStatus status)
From source file:springfox.documentation.spring.web.dummy.controllers.PetGroomingService.java
@RequestMapping(method = RequestMethod.GET) public ResponseEntity<Boolean> canGroom(@RequestParam String type) { return new ResponseEntity<Boolean>(HttpStatus.OK); }
From source file:br.com.porao.ui.ControllerVenda.java
@RequestMapping(value = "/venda/add", produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody ResponseEntity<?> addVenda(Venda venda) { try {/*from w w w .ja va2 s .c o m*/ this.fachada.cadastrarVenda(venda); return new ResponseEntity<String>(HttpStatus.OK); } catch (VendaExistenteException vendaexistente) { return new ResponseEntity<VendaExistenteException>(vendaexistente, HttpStatus.BAD_REQUEST); } }
From source file:br.com.porao.ui.ControllerPedido.java
@RequestMapping(value = "/pedido/add", produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody ResponseEntity<?> addPedido(Pedido pedido) { try {//from ww w. j ava 2 s . co m this.fachada.cadastrarPedido(pedido); return new ResponseEntity<String>(HttpStatus.OK); } catch (PedidoExistenteException pedidoexistente) { return new ResponseEntity<PedidoExistenteException>(pedidoexistente, HttpStatus.BAD_REQUEST); } }
From source file:br.com.porao.ui.ControllerRodada.java
@RequestMapping(value = "/rodada/add", produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody ResponseEntity<?> addRodada(Rodada rodada) { try {//from w w w . j a v a 2 s . com this.fachada.cadastrarRodada(rodada); return new ResponseEntity<String>(HttpStatus.OK); } catch (RodadaExistenteException rodadaexistente) { return new ResponseEntity<RodadaExistenteException>(rodadaexistente, HttpStatus.BAD_REQUEST); } }
From source file:br.com.porao.ui.ControllerCliente.java
@RequestMapping(value = "/cliente/add", produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody ResponseEntity<?> addCliente(Cliente cliente) { try {/*from w w w . j ava 2 s .co m*/ this.fachada.cadastrarCliente(cliente); return new ResponseEntity<String>(HttpStatus.OK); } catch (ClienteExistenteException clienteexistente) { return new ResponseEntity<ClienteExistenteException>(clienteexistente, HttpStatus.BAD_REQUEST); } }
From source file:com.bofa.sstradingreport.support.ExceptionHandlerAdvice.java
@ExceptionHandler(DataIntegrityViolationException.class) public ResponseEntity<String> handleDataIntegrityViolationException(DataIntegrityViolationException e) throws Exception { return new ResponseEntity<>(HttpStatus.CONFLICT); }
From source file:io.pivotal.strepsirrhini.chaoslemur.state.AbstractRestControllerStateProvider.java
@RequestMapping(method = RequestMethod.POST, value = "/state", consumes = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<?> changeState(@RequestBody Map<String, String> payload) { String value = payload.get(STATUS_KEY); if (value == null) { return new ResponseEntity<>(HttpStatus.BAD_REQUEST); }/* ww w.j av a 2 s. c om*/ try { set(State.valueOf(value.toUpperCase())); return new ResponseEntity<>(HttpStatus.OK); } catch (IllegalArgumentException e) { return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } }
From source file:za.ac.cput.project.universalhardwarestorev2.api.ItemApi.java
@RequestMapping(value = "/items/", method = RequestMethod.GET) public ResponseEntity<List<Item>> listAllItems() { List<Item> Items = service.findAll(); if (Items.isEmpty()) { return new ResponseEntity<List<Item>>(HttpStatus.NO_CONTENT);//You many decide to return HttpStatus.NOT_FOUND }/*from www. j av a 2 s.c o m*/ return new ResponseEntity<List<Item>>(Items, HttpStatus.OK); }
From source file:com.agroservices.restcontrollers.VentasRest.java
@RequestMapping(value = "/", method = RequestMethod.POST) public ResponseEntity<?> notificarVenta(@RequestBody Venta v) { try {//from ww w . j av a 2 s . c o m vf.guardarVenta(v); } catch (Exception e) { System.out.println(e.getMessage()); return new ResponseEntity<>(HttpStatus.CONFLICT); } return new ResponseEntity<>(HttpStatus.CREATED); }
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 {// w ww . j a v a 2 s .com this.fachada.cadastrarProduto(produto); return new ResponseEntity<String>(HttpStatus.OK); } catch (ProdutoExistenteException produtoexistente) { return new ResponseEntity<ProdutoExistenteException>(produtoexistente, HttpStatus.BAD_REQUEST); } }