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:org.pf9.pangu.app.act.rest.editor.model.ModelSaveRestResource.java
@RequiresPermissions("act:model:edit") @RequestMapping(value = "/act/service/model/{modelId}/save", method = RequestMethod.PUT) @ResponseStatus(value = HttpStatus.OK) public void saveModel(@PathVariable String modelId, @RequestBody MultiValueMap<String, String> values) { try {/*from w w w .j av a2 s . co m*/ Model model = repositoryService.getModel(modelId); ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo()); modelJson.put(MODEL_NAME, values.getFirst("name")); modelJson.put(MODEL_DESCRIPTION, values.getFirst("description")); model.setMetaInfo(modelJson.toString()); model.setName(values.getFirst("name")); repositoryService.saveModel(model); repositoryService.addModelEditorSource(model.getId(), values.getFirst("json_xml").getBytes("utf-8")); InputStream svgStream = new ByteArrayInputStream(values.getFirst("svg_xml").getBytes("utf-8")); TranscoderInput input = new TranscoderInput(svgStream); PNGTranscoder transcoder = new PNGTranscoder(); // Setup output ByteArrayOutputStream outStream = new ByteArrayOutputStream(); TranscoderOutput output = new TranscoderOutput(outStream); // Do the transformation transcoder.transcode(input, output); final byte[] result = outStream.toByteArray(); repositoryService.addModelEditorSourceExtra(model.getId(), result); outStream.close(); } catch (Exception e) { LOGGER.error("Error saving model", e); throw new ActivitiException("Error saving model", e); } }
From source file:be.boyenvaesen.EmployeeControllerTest.java
@Test public void testList() { ResponseEntity<Employee[]> responseEntity = restTemplate.getForEntity("/employees", Employee[].class); assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); Employee[] employees = responseEntity.getBody(); assertEquals("Boyen", employees[0].getFirstName()); assertEquals("Maarten", employees[1].getFirstName()); assertEquals("Thijs", employees[2].getFirstName()); assertEquals("Jasper", employees[3].getFirstName()); assertEquals(4, employees.length);//www. j a v a2s . c o m }
From source file:org.opendatakit.api.odktables.OdkTablesTest.java
@Test public void contextLoads() { ResponseEntity<String> entity = this.restTemplate.getForEntity( "http://localhost:" + server.getEmbeddedServletContainer().getPort() + "/odktables", String.class); logger.info(entity.toString());//w w w . ja v a 2 s . c om logger.info(entity.getBody()); assertThat(entity.getBody()).isEqualTo("[\"default\"]"); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); }
From source file:com.ar.dev.tierra.api.controller.DetalleNotaCreditoController.java
@RequestMapping(value = "/barcode", method = RequestMethod.GET) public ResponseEntity<?> getByProductoOnFactura(@RequestParam("barcode") String barcode) { List<DetalleFactura> list = facadeService.getDetalleNotaCreditoDAO().getByBarcodeOnFactura(barcode); if (!list.isEmpty()) { return new ResponseEntity<>(list, HttpStatus.OK); } else {/*from w w w.ja v a2 s . c o m*/ return new ResponseEntity<>(HttpStatus.NOT_FOUND); } }
From source file:com.diagrama.repository.PeriodoController.java
@RequestMapping(value = "/periodo/{periodo_id}", method = RequestMethod.PUT) public ResponseEntity<?> modificarPeriodo(@RequestBody PeriodosLectivos periodosLectivos, @PathVariable int periodo_id) { periodoRepository.save(periodosLectivos); return new ResponseEntity<>(HttpStatus.OK); }
From source file:com.ar.dev.tierra.api.controller.ChartController.java
@RequestMapping(value = "/medio/cantidad", method = RequestMethod.GET) public ResponseEntity<?> getMedioCantidad(@RequestParam("idMedioPago") int idMedioPago) { List<Chart> chart = impl.getVentaMedioPago(idMedioPago); if (!chart.isEmpty()) { return new ResponseEntity<>(chart, HttpStatus.OK); } else {//from w ww . j av a 2s. com return new ResponseEntity<>(HttpStatus.NOT_FOUND); } }
From source file:com.github.djabry.platform.rest.AuthenticationController.java
/** * @param request The credentials of the user attempting to log in * @return A security token on success, null otherwise */// w ww .ja v a2 s . c o m @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(name = "/login", method = RequestMethod.POST) public SecurityToken login(@NotNull LoginRequest request) { return this.authenticationService.login(request); }
From source file:com.javiermoreno.springboot.rest.PrivateController.java
@RequestMapping(value = "/personas/{id}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ApiOperation(value = "Testear servicios", notes = "Accede a un servicio que consultar la base de datos.") Persona getPersonaPorId(@PathVariable int id) { return service.findById(id); }
From source file:com.seguriboxltv.ws.AlgorithmAssymetricRest.java
@RequestMapping(value = "/sdassymetric", method = RequestMethod.GET, headers = "Accept=application/json") @ResponseBody//from ww w. jav a 2 s. c o m public ResponseEntity<List<AssymetricAlgs>> getAllSDAssymetric() { List<AssymetricAlgs> list = null; try { list = algorithmCryptModuleService.GetSDAssymetricAlgs(); } catch (Exception e) { e.printStackTrace(); } return new ResponseEntity<>(list, HttpStatus.OK); }
From source file:com.nobu.dvdrentalweb.test.restapi.AccountRestControllerTest.java
@Test public void tesCreate() { Account account = new Account.Builder().accountName("Savings").accountType("Gold Card").build(); HttpEntity<Account> requestEntity = new HttpEntity<>(account, getContentType()); // Make the HTTP POST request, marshaling the request to JSON, and the response to a String ResponseEntity<String> responseEntity = restTemplate.exchange(URL + "api/account/create", HttpMethod.POST, requestEntity, String.class); System.out.println(" THE RESPONSE BODY " + responseEntity.getBody()); System.out.println(" THE RESPONSE STATUS CODE " + responseEntity.getStatusCode()); System.out.println(" THE RESPONSE IS HEADERS " + responseEntity.getHeaders()); Assert.assertEquals(responseEntity.getStatusCode(), HttpStatus.OK); }