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:org.focusns.common.web.WebUtils.java

public static <T> ResponseEntity<T> getResponseEntity(T body, MediaType mediaType) {
    HttpHeaders httpHeaders = new HttpHeaders();
    httpHeaders.setContentType(mediaType);
    if (body instanceof byte[]) {
        httpHeaders.setContentLength(((byte[]) body).length);
    }/*w  w w .  jav a2 s  .com*/
    return new ResponseEntity<T>(body, httpHeaders, HttpStatus.OK);
}

From source file:com.grizzly.rest.Definitions.DefinitionsHttpMethods.java

/**
 * Returns the http states currently supported.
 * @return a List of int representing the supported http states.
 *///from  w  w  w .  ja va2  s. c  om
public static List<Integer> getHttpStates() {
    List<Integer> list = new ArrayList<>();
    list.add(HttpStatus.OK.value());
    list.add(HttpStatus.ACCEPTED.value());
    list.add(HttpStatus.CREATED.value());
    return list;
}

From source file:br.com.avelar.bac.controllers.CarController.java

@CrossOrigin
@RequestMapping("/description/{description}")
public ResponseEntity<List<Car>> findByDescription(@PathVariable String description) {
    List<Car> cars = service.findByDescription(description);
    return new ResponseEntity<List<Car>>(cars, HttpStatus.OK);
}

From source file:com.xinferin.controller.ProductController.java

@RequestMapping(value = "/{productId}", method = RequestMethod.PUT, consumes = "application/json")
@ResponseStatus(HttpStatus.OK)
public void editProduct(@PathVariable int productId, @RequestBody Product product) {
    product.setId(productId);/*from  w w w . j av  a  2  s.c om*/
    daoProduct.edit(product);
}

From source file:com.boxedfolder.carrot.web.PingResource.java

@ResponseStatus(HttpStatus.OK)
@RequestMapping(value = "/sync/ping", method = RequestMethod.GET)
public String syncPing() {
    return "Ping. (Unsecured)";
}

From source file:md.ibanc.rm.controllers.request.RequestNewsController.java

@RequestMapping(value = "/find/newsCategory", method = RequestMethod.GET)
public ResponseEntity<List<NewsCategory>> getCardsByUser() {

    List<NewsCategory> list = new ArrayList<>();
    NewsCategory newsCategory = new NewsCategory();
    newsCategory.setNameCategory("Deposite");
    newsCategory.setNumberOfNews("10 News");
    newsCategory.setImagePath("album11");

    list.add(newsCategory);//from www .j  a  va 2  s .c  o  m
    newsCategory = new NewsCategory();
    newsCategory.setNameCategory("Service");
    newsCategory.setNumberOfNews("23 News");
    newsCategory.setImagePath("album10");

    list.add(newsCategory);

    return new ResponseEntity<>(list, HttpStatus.OK);

}

From source file:zipkin.autoconfigure.metrics.PrometheusMetricsAutoConfigurationTest.java

@Test
public void correctHttpResponse() throws Exception {
    PublicMetrics publicMetrics = () -> Collections.singleton(new Metric<Number>("mem.free", 1024));
    ResponseEntity<String> response = responseForMetrics(publicMetrics);

    assertThat(response.getStatusCode(), equalTo(HttpStatus.OK));
    assertThat(response.getHeaders().getContentType().toString(),
            equalTo("text/plain;version=0.0.4;charset=utf-8"));
}

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

/**
 *
 * @param id//from ww w  .ja  v  a  2  s . c o  m
 * @return
 */
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<Presentaciones> getPresentacion(@PathVariable("id") Integer id) {
    Presentaciones u = se.getPresentacionesById(id);
    return new ResponseEntity<>(u, HttpStatus.OK);
}

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

/**
 *
 * @param id/* www.  j a v a 2s . c  om*/
 * @return
 */
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<Subcategorias> getSubcategoria(@PathVariable("id") Integer id) {
    Subcategorias u = se.getSubcategoriaById(id);
    return new ResponseEntity<>(u, HttpStatus.OK);
}

From source file:com.boxedfolder.carrot.web.sync.SyncResource.java

@Cacheable("sync")
@JsonView(View.Sync.class)
@ResponseStatus(HttpStatus.OK)
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> sync(@RequestParam(required = false, value = "ts") Long timestamp,
        @RequestParam(required = true, value = "app_key") String appKey) {
    return syncService.sync(timestamp, appKey);
}