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:io.github.howiefh.jeews.modules.sys.controller.RoleController.java

@RequiresPermissions("role:view")
@RequestMapping(value = "", method = RequestMethod.GET)
public HttpEntity<Resources<RoleResource>> getList() {
    List<Role> roles = roleService.findAll();
    Resources<RoleResource> resources = ResourcesAssembler.toResources(roles, new RoleResourceAssembler(),
            RoleController.class);
    return new ResponseEntity<>(resources, HttpStatus.OK);
}

From source file:comsat.sample.velocity.SampleWebVelocityApplicationTests.java

@Test
public void testVelocityTemplate() throws Exception {
    ResponseEntity<String> entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port,
            String.class);
    assertEquals(HttpStatus.OK, entity.getStatusCode());
    assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody().contains("Hello, Andy"));
}

From source file:com.aplikasi.penjualan.controller.DataBarangController.java

@RequestMapping(value = "/barang/{kode}", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public ResponseEntity<DataBarang> cariDataBarang(@PathVariable("kode") String kode) {
    DataBarang hasil = kd.findOne(kode);
    //menambahkan error 404 jika data yang dicari tidak ada
    if (hasil == null) {
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }//from w ww.  j av  a  2s.co  m
    return new ResponseEntity<>(hasil, HttpStatus.OK);
}

From source file:org.zalando.stups.twintip.TwintipApplicationIT.java

@Test
public void isConfigured() {

    String endpointUrl = "http://localhost:" + port + "/.well-known/schema-discovery";
    LOG.info("ENDPOINT_URL : {}", endpointUrl);

    RestTemplate template = new RestTemplate();
    ResponseEntity<String> entity = template.getForEntity(endpointUrl, String.class);
    HttpStatus statusCode = entity.getStatusCode();
    String body = entity.getBody();

    Assertions.assertThat(statusCode).isEqualTo(HttpStatus.OK);
    Assertions.assertThat(body).contains("swagger-2.0");

    LOG.info("BODY : {}", body);

}

From source file:hr.foi.sis.controllers.PersonController.java

/**
 * gets all users from database/*from w w w . j  a  v  a  2  s  .c  om*/
 * @return all users in json format with HTTP 200
 */

@RequestMapping(value = "/", method = RequestMethod.GET)
@PreAuthorize("hasRole('ROLE_ADMIN')")
public ResponseEntity<List<Person>> retrieveAll() {

    Logger.getLogger("PersonController.java").log(Level.INFO,
            "GET on /person -- retrieving full list of users");

    return new ResponseEntity(this.personRepository.findAll(), HttpStatus.OK);
}

From source file:org.moserp.common.json_schema.JsonSchemaController.java

@RequestMapping(value = BASE_PATH + REPOSITORY, method = GET)
public HttpEntity<BusinessEntity> schema(RootResourceInformation resourceInformation) {
    BusinessEntity schema = jsonSchemaBuilder.buildFor(resourceInformation.getDomainType());
    return new ResponseEntity<>(schema, HttpStatus.OK);
}

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

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<DetalleFactura> list = facadeService.getDetalleFacturaDAO().getAll();
    if (!list.isEmpty()) {
        return new ResponseEntity<>(list, HttpStatus.OK);
    } else {//  w  w  w  .  ja v a  2s  . c  o  m
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }
}

From source file:com.biz.report.controller.ItemDashBoardController.java

@ResponseBody
@RequestMapping(value = "itemreport/{year}/get", method = RequestMethod.POST, headers = {
        "Content-type=application/json" })
public ResponseEntity<ReportDataSet> readFTypes(@PathVariable("year") String year, @RequestBody Map data) {
    logger.info(year);//  ww  w  .  j  av a  2  s  .  c  o m
    logger.info(data);
    Assert.notNull(data, "Data is null.");
    Assert.notNull(year, "Year is null.");
    String items = data.get("items").toString();
    String months = data.get("months").toString();
    ReportDataSet reportDataSet = itemDashBoardService.getReports(items, months, year);
    HttpHeaders headers = new HttpHeaders();
    headers.add("success", "Success");
    return new ResponseEntity<ReportDataSet>(reportDataSet, headers, HttpStatus.OK);
}

From source file:info.losd.galenweb.api.GalenWebApiController.java

@RequestMapping(value = "/healthchecks/{healthchecks}/statistics", method = RequestMethod.GET)
@ResponseBody//from   w w  w . j ava 2s.  co  m
public HttpEntity<String> statistics(@PathVariable String api,
        @RequestParam(value = "period", required = false, defaultValue = "2m") String period) {
    return new ResponseEntity<>("hello", HttpStatus.OK);
}