List of usage examples for org.springframework.http HttpStatus OK
HttpStatus OK
To view the source code for org.springframework.http HttpStatus OK.
Click Source Link
From source file:com.ar.dev.tierra.api.controller.NotaCreditoController.java
@RequestMapping(value = "/all", method = RequestMethod.GET) public ResponseEntity<?> getAll() { List<NotaCredito> list = facadeService.getNotaCreditoDAO().getAll(); if (!list.isEmpty()) { return new ResponseEntity<>(list, HttpStatus.OK); } else {/*w ww. j a va 2s . c o m*/ return new ResponseEntity<>(HttpStatus.NOT_FOUND); } }
From source file:com.ar.dev.tierra.api.controller.ClienteController.java
@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<?> getAll() { List<Cliente> list = facadeService.getClienteDAO().getAll(); if (!list.isEmpty()) { return new ResponseEntity<>(list, HttpStatus.OK); } else {/*w w w. ja v a 2 s.c o m*/ return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } }
From source file:org.moserp.environment.rest.UnitOfMeasurementRestIT.java
@Test public void testFindByCodeSpecialChars() { commonUtil.createAndSaveSpecialCharUnit(); ResponseEntity<UnitOfMeasurement> entity = restTemplate.getForEntity( testEnvironment.createRestUri("unitOfMeasurements/search/findByCode?code={unit.code}"), UnitOfMeasurement.class, "%"); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertNotNull(entity.getBody());// w ww . ja v a2s .c om }
From source file:nu.yona.server.rest.ControllerBase.java
protected <T, U extends ResourceSupport> ResponseEntity<U> createOkResponse(T dto, ResourceAssemblerSupport<T, U> resourceAssembler) { return createResponse(dto, HttpStatus.OK, resourceAssembler); }
From source file:com._8x8.presentation.restfulController.ZPayRestfulController.java
@RequestMapping(value = "/broadcastMsgByQRCode/{qrCode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<String> broadcastMsgByQRCode(@PathVariable("qrCode") String qrCode) { try {//from w w w.j a v a2 s . c o m Boolean broadcast = _broadcastService.SendBroadcastMsg("SomeMessage", qrCode); return new ResponseEntity<String>(broadcast.toString(), HttpStatus.OK); } catch (Exception ex) { return new ResponseEntity<String>(HttpStatus.BAD_REQUEST); } }
From source file:monkeys.web.MonkeysController.java
@RequestMapping(method = RequestMethod.GET, value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Monkey> getMonkey(@PathVariable Long id) { Monkey monkey = monkeyRepository.findOne(id); HttpHeaders headers = new HttpHeaders(); return new ResponseEntity<>(monkey, headers, HttpStatus.OK); }
From source file:org.mitre.openid.connect.view.HttpCodeView.java
@Override protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {//from ww w .jav a 2 s . co m HttpStatus code = (HttpStatus) model.get(CODE); if (code == null) { code = HttpStatus.OK; // default to 200 } response.setStatus(code.value()); }
From source file:com.salmon.security.xacml.demo.springmvc.rest.controller.MarketPlaceQueryController.java
@RequestMapping(method = RequestMethod.GET, value = "drivers/{license}") @ResponseStatus(HttpStatus.OK) @ResponseBody/*from w w w. j a v a2 s . co m*/ public Driver getDriverDetails(@PathVariable String license) { LOG.info("REST Driver Lookup - " + license); Driver found = marketPlaceController.getDriverDetails(license); if (found == null) { throw new ObjectNotFoundException("Driver Not Found"); //return null; } else { return found; } }
From source file:com.ar.dev.tierra.api.controller.TarjetaController.java
@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<?> getAll() { List<Tarjeta> categorias = facadeService.getTarjetaDAO().getAll(); if (!categorias.isEmpty()) { return new ResponseEntity<>(categorias, HttpStatus.OK); } else {//from w w w .jav a2s . c o m return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } }
From source file:com.opensearchserver.hadse.cluster.ClusterTest.java
@Test public void t01_get() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); RestTemplate template = new RestTemplate(); ResponseEntity<NodeItem[]> entity = template.exchange("http://localhost:8080/_cluster", HttpMethod.GET, null, NodeItem[].class); assertTrue(entity.getBody().length >= 1); assertEquals(HttpStatus.OK, entity.getStatusCode()); }