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:springfox.documentation.spring.web.dummy.controllers.EnumService.java

@RequestMapping(value = "/entity", method = RequestMethod.GET)
@ApiOperation(value = "Example with response entity single value")
public ResponseEntity<EnumType> getResponseEntityValue() {
    return new ResponseEntity<EnumType>(EnumType.ONE, HttpStatus.OK);
}

From source file:com.javiermoreno.springboot.rest.PublicController.java

@RequestMapping(value = "/test/{numero}", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
@ApiOperation(value = "Testear jsr303", notes = "El pathparam nmero debe de ser superior o igual a 5.")
int[] demoValidacion(@PathVariable @Min(5) int numero) {
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < 512; i++) {
        sb.append("*");
    }/*from  w  w w .  ja v a2 s. c o  m*/
    return new int[] { numero * 10 };
}

From source file:br.com.hyperclass.snackbar.restapi.MenuController.java

@RequestMapping(value = "/menu", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<ProductWrapper> registerProduct(@RequestBody final ProductWrapper productWrapper) {
    final Product product = new Product(productWrapper.getName(), productWrapper.getPrice());
    menu.addProductMenu(product);//from w w  w.  ja  v  a 2s . c o m
    return new ResponseEntity<>(HttpStatus.OK);
}

From source file:rest.ApplianceRestController.java

@Test
public void testCreate() {
    Appliance app = new Appliance.Builder("samTv003").brand("samsung").descrip("HDTV").Build();
    HttpEntity<Appliance> requestEntity = new HttpEntity<>(app, getContentType());
    //        Make the HTTP POST request, marshaling the request to JSON, and the response to a String
    ResponseEntity<String> responseEntity = restTemplate.exchange(URL + "api/app/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);

}

From source file:com.seguriboxltv.ws.AlgorithmHashRest.java

@RequestMapping(value = "/sdhash", method = RequestMethod.GET, headers = "Accept=application/json")
@ResponseBody/*  w  ww.  j  a va2  s  .c  o m*/
public ResponseEntity<List<HashAlgs>> getAllSDHash() {
    List<HashAlgs> list = null;
    try {
        list = algorithmCryptModuleService.GetSDAlgorithmHash();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return new ResponseEntity<>(list, HttpStatus.OK);
}

From source file:com.consol.citrus.demo.devoxx.RouteMessagesHttpIT.java

@CitrusTest
public void routeMessagesContentBased() {
    http().client(bakeryClient).post("/order").contentType("application/json").payload(
            "{ \"order\": { \"type\": \"chocolate\", \"id\": citrus:randomNumber(10), \"amount\": 1}}");

    http().client(bakeryClient).response(HttpStatus.OK).messageType(MessageType.PLAINTEXT);

    receive(workerChocolateEndpoint).payload(
            "<order>" + "<type>chocolate</type>" + "<id>@ignore@</id>" + "<amount>1</amount>" + "</order>");

    http().client(bakeryClient).post("/order").contentType("application/json")
            .payload("{ \"order\": { \"type\": \"caramel\", \"id\": citrus:randomNumber(10), \"amount\": 1}}");

    http().client(bakeryClient).response(HttpStatus.OK).messageType(MessageType.PLAINTEXT);

    receive(workerCaramelEndpoint).payload(
            "<order>" + "<type>caramel</type>" + "<id>@ignore@</id>" + "<amount>1</amount>" + "</order>");

    http().client(bakeryClient).post("/order").contentType("application/json").payload(
            "{ \"order\": { \"type\": \"blueberry\", \"id\": citrus:randomNumber(10), \"amount\": 1}}");

    http().client(bakeryClient).response(HttpStatus.OK).messageType(MessageType.PLAINTEXT);

    receive(workerBlueberryEndpoint).payload(
            "<order>" + "<type>blueberry</type>" + "<id>@ignore@</id>" + "<amount>1</amount>" + "</order>");
}

From source file:com.dolphine.customer.microservice.SampleActuatorApplicationTests.java

@Test
public void testHome() throws Exception {
    @SuppressWarnings("rawtypes")
    ResponseEntity<Map> entity = new TestRestTemplate().getForEntity("http://localhost:" + port, Map.class);
    assertEquals(HttpStatus.OK, entity.getStatusCode());
    @SuppressWarnings("unchecked")
    Map<String, Object> body = entity.getBody();
    assertEquals("Hello Phil", body.get("message"));
}

From source file:org.sharetask.controller.TaskController.java

@ResponseStatus(value = HttpStatus.OK)
@RequestMapping(value = "/{workspaceId}/task", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody//from   w ww. j  av a2  s. com
public TaskDTO create(@PathVariable("workspaceId") final Long workspaceId, @RequestBody final TaskDTO task) {
    return taskService.create(workspaceId, task);
}

From source file:org.acme.sample.SpringBootFacesApplicationTests.java

@Test
public void testJsfWelcomePage() 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("javax.faces.ViewState"));
}

From source file:com.carlomicieli.jtrains.infrastructure.web.ResponsesTests.java

@Test
public void shouldCreateResponsesForOk() {
    ResponseEntity<String> resp = Responses.ok("Body");
    assertThat(resp).isNotNull();// w  w  w.  j a v a 2  s.c  om
    assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
    assertThat(resp.getBody()).isEqualTo("Body");
}