Example usage for org.springframework.http HttpStatus OK

List of usage examples for org.springframework.http HttpStatus OK

Introduction

In this page you can find the example usage for org.springframework.http HttpStatus OK.

Prototype

HttpStatus OK

To view the source code for org.springframework.http HttpStatus OK.

Click Source Link

Document

200 OK .

Usage

From source file:com.ar.dev.tierra.api.controller.ChartController.java

@RequestMapping(value = "/vendedor/ventas", method = RequestMethod.GET)
public ResponseEntity<?> getVentaVendedor(@RequestParam("idVendedor") int idVendedor) {
    List<Chart> chart = impl.getDineroVendedores(idVendedor);
    if (!chart.isEmpty()) {
        return new ResponseEntity<>(chart, HttpStatus.OK);
    } else {//from   www.j  a  va 2 s  . co  m
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }
}

From source file:com.graphaware.example.graphaware.HelloWorldController.java

@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody//  www  . j a  v  a 2  s.com
@ResponseStatus(HttpStatus.OK)
public long createHelloWorldNode() {
    return nodeCreator.createHelloWorldNode().getId();
}

From source file:com.tribuo.backend.controllers.SubcategoriasController.java

/**
 *
 * @return/*  ww w .  j  av  a 2 s. c om*/
 */
@RequestMapping(value = "/all", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<List<Subcategorias>> getSubcategorias() {
    List<Subcategorias> u = se.getSubcategorias();
    return new ResponseEntity<>(u, HttpStatus.OK);
}

From source file:com.tribuo.backend.controllers.PresentacionesController.java

/**
 *
 * @return/* w w  w  .  j ava  2  s .c  om*/
 */
@RequestMapping(value = "/all", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<List<Presentaciones>> getPresentaciones() {
    List<Presentaciones> u = se.getPresentaciones();
    return new ResponseEntity<>(u, HttpStatus.OK);

}

From source file:eu.freme.broker.integration_tests.TildeETerminologyTest.java

@Test
public void testETerminology() throws Exception {

    String nif = readFile("src/test/resources/rdftest/e-terminology/example1.ttl");
    HttpResponse<String> response = post("").queryString("source-lang", "en").queryString("target-lang", "de")
            .queryString("informat", "turtle").queryString("outformat", "turtle").body(nif).asString();

    assertTrue(response.getStatus() == HttpStatus.OK.value());

    // not working due to bug in tilde terminology api
    response = post("").queryString("source-lang", "en").queryString("target-lang", "de")
            .queryString("informat", "text").queryString("outformat", "turtle").body("hello world").asString();

    assertTrue(response.getStatus() == HttpStatus.OK.value());
}

From source file:org.cloudfoundry.identity.uaa.integration.PasswordCheckEndpointIntegrationTests.java

@Test
public void passwordPostSucceeds() throws Exception {
    MultiValueMap<String, String> formData = new LinkedMultiValueMap<String, String>();
    formData.add("password", "password1");
    HttpHeaders headers = new HttpHeaders();
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
    @SuppressWarnings("rawtypes")
    ResponseEntity<Map> response = serverRunning.postForMap("/password/score", formData, headers);
    assertEquals(HttpStatus.OK, response.getStatusCode());

    assertTrue(response.getBody().containsKey("score"));
    assertTrue(response.getBody().containsKey("requiredScore"));
    assertEquals(0, response.getBody().get("score"));
}

From source file:com.unknown.pkg.InfoEndpointApplicationIT.java

@Test
public void fetchInfo() {
    RestTemplate rest = new RestTemplate();
    ResponseEntity<String> response = rest.getForEntity("http://localhost:" + port + "/info", String.class);
    Assertions.assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
    Assertions.assertThat(response.getBody()).contains("\"version\":\"0.9.0-SNAPSHOT\"");
}

From source file:edu.infsci2560.services.BlogsService.java

@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = "application/json")
public ResponseEntity<Blog> list(@PathVariable("id") Long id) {
    HttpHeaders headers = new HttpHeaders();
    return new ResponseEntity<>(repository.findOne(id), headers, HttpStatus.OK);
}

From source file:com.gsr.myschool.server.reporting.convocation.ConvocationController.java

@RequestMapping(value = "test", method = RequestMethod.GET, produces = "application/pdf")
@ResponseStatus(HttpStatus.OK)
public void generateReportTest(@RequestParam String niveauId, @RequestParam String sessionId,
        HttpServletResponse response) {/*from  w  w  w .j  ava 2  s . co m*/
    ReportDTO dto = convocationService.generateConvocationTest(Long.valueOf(niveauId), Long.valueOf(sessionId));
    try {
        response.addHeader("Content-Disposition", "attachment; filename=convocation.pdf");

        BufferedOutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
        byte[] result = reportService.generatePdf(dto);

        outputStream.write(result, 0, result.length);
        outputStream.flush();
        outputStream.close();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:org.openbaton.vnfm.api.RestMediaServer.java

/**
 * Lists all the MediaServers of a specific VNFR
 *
 * @param vnfrId : ID of VNFR/*from  w w w. j  a v a 2  s.c o m*/
 */
@RequestMapping(value = "", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public Set<MediaServer> queryAll(@PathVariable("vnfrId") String vnfrId) throws NotFoundException {
    return mediaServerManagement.queryByVnrfId(vnfrId);
}