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:br.com.porao.ui.ControllerVenda.java

@RequestMapping(value = "/venda/add", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody ResponseEntity<?> addVenda(Venda venda) {
    try {//from  w ww.ja v a2  s  .c o  m
        this.fachada.cadastrarVenda(venda);
        return new ResponseEntity<String>(HttpStatus.OK);
    } catch (VendaExistenteException vendaexistente) {
        return new ResponseEntity<VendaExistenteException>(vendaexistente, HttpStatus.BAD_REQUEST);
    }
}

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

@RequestMapping(value = "/order", method = RequestMethod.GET)
public ResponseEntity<ProductsWrapper> menuItemProducts() {
    return new ResponseEntity<ProductsWrapper>(new ProductsWrapper(order.productsMenu()), HttpStatus.OK);
}

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

/**
 *
 * @return//from   w  w  w  .  ja  v a2  s.  c om
 */
@RequestMapping(value = "/all", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<List<Ventas>> getVentas() {
    List<Ventas> u = se.getVentas();
    return new ResponseEntity<>(u, HttpStatus.OK);
}

From source file:rest.DependenciaRestController.java

@RequestMapping(value = "/dependencias/", method = RequestMethod.GET)
public ResponseEntity<List<DependenciaBean>> listAll() {
    List<DependenciaBean> dependencias = dependenciaService.findAll();
    if (dependencias.isEmpty()) {
        return new ResponseEntity<List<DependenciaBean>>(HttpStatus.NO_CONTENT);
    }// w  w w  .  ja v a 2  s.  c o m
    return new ResponseEntity<List<DependenciaBean>>(dependencias, HttpStatus.OK);
}

From source file:org.cloudfoundry.identity.batch.integration.BatchEndpointIntegrationTests.java

/**
 * tests a happy-day flow of the <code>/batch</code> endpoint
 *//*from   w w w . j  a v a2  s . c  om*/
@Test
public void testHappyDay() throws Exception {

    String credentials = String.format("%s:%s", "batch", "batchsecret");
    String auth = String.format("Basic %s", new String(Base64.encode(credentials.getBytes())));

    HttpHeaders headers = new HttpHeaders();
    headers.add("Authorization", auth);
    ResponseEntity<String> response = serverRunning.getForString("/batch/", headers);
    assertEquals(HttpStatus.OK, response.getStatusCode());

    String map = response.getBody();
    assertTrue(map.contains("jobs"));

}

From source file:com.digitalriver.artifact.NickArtifactServerTests.java

public void testHome() throws Exception {
    ResponseEntity<String> entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port,
            String.class);
    assertEquals(HttpStatus.OK, entity.getStatusCode());
    assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(),
            entity.getBody().contains("<title>Static"));
}

From source file:com.phoenixnap.oss.sample.server.controllers.HealthCheckControllerImpl.java

@Override
public ResponseEntity<GetHealthCheckResponse> getHealthCheck() {
    GetHealthCheckResponse hcResponse = new GetHealthCheckResponse();
    hcResponse.setTimestamp(new DateTime().toString());
    hcResponse.setStatus(HealthStatusEnum.OK.name());
    return new ResponseEntity<GetHealthCheckResponse>(hcResponse, HttpStatus.OK);
}

From source file:br.com.porao.ui.ControllerPedido.java

@RequestMapping(value = "/pedido/add", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody ResponseEntity<?> addPedido(Pedido pedido) {
    try {/*from  w w w .  jav  a 2 s . c  om*/
        this.fachada.cadastrarPedido(pedido);
        return new ResponseEntity<String>(HttpStatus.OK);
    } catch (PedidoExistenteException pedidoexistente) {
        return new ResponseEntity<PedidoExistenteException>(pedidoexistente, HttpStatus.BAD_REQUEST);
    }
}

From source file:br.com.porao.ui.ControllerRodada.java

@RequestMapping(value = "/rodada/add", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody ResponseEntity<?> addRodada(Rodada rodada) {
    try {//from   ww w  .  j  a  va  2  s.c  o  m
        this.fachada.cadastrarRodada(rodada);
        return new ResponseEntity<String>(HttpStatus.OK);
    } catch (RodadaExistenteException rodadaexistente) {
        return new ResponseEntity<RodadaExistenteException>(rodadaexistente, HttpStatus.BAD_REQUEST);
    }
}

From source file:com.boxedfolder.carrot.web.client.EventResource.java

@JsonView(View.Client.class)
@ResponseStatus(HttpStatus.OK)
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public List<Event> getAll() {
    EventList list = new EventList();
    list.addAll(service.findAll());/*from  www .  j a v  a 2  s. co m*/
    return list;
}