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:fr.xebia.xke.metrics.web.HealthCheckController.java

@RequestMapping(value = "healthcheck", method = RequestMethod.GET, produces = "text/plain")
public ResponseEntity<String> runChecks() {

    boolean healthy = true;
    StringBuilder sb = new StringBuilder();

    // TODO Exercise 11 - run checks here and build response String

    return new ResponseEntity<String>(sb.toString(), HttpStatus.OK);
}

From source file:com.develcom.cliente.Cliente.java

public void buscarArchivo() throws FileNotFoundException, IOException {

    CodDecodArchivos cda = new CodDecodArchivos();
    RestTemplate restTemplate = new RestTemplate();
    HttpHeaders headers = new HttpHeaders();
    //        Bufer bufer = new Bufer();
    byte[] buffer = null;
    ResponseEntity<byte[]> response;

    restTemplate.getMessageConverters().add(new ByteArrayHttpMessageConverter());
    headers.setAccept(Arrays.asList(MediaType.ALL));
    HttpEntity<String> entity = new HttpEntity<>(headers);

    response = restTemplate.exchange(//from  www  . j a v a2 s.  c  o m
            "http://localhost:8080/ServicioDW4J/expediente/buscarFisicoDocumento/21593", HttpMethod.GET, entity,
            byte[].class);

    if (response.getStatusCode().equals(HttpStatus.OK)) {
        buffer = response.getBody();
        FileOutputStream output = new FileOutputStream(new File("c:/documentos/archivo.cod"));
        IOUtils.write(response.getBody(), output);
        cda.decodificar("c:/documentos/archivo.cod", "c:/documentos/archivo.pdf");
    }

}

From source file:com.develcom.reafolder.ClienteBajaArchivo.java

public void buscarArchivo() throws FileNotFoundException, IOException {

    CodDecodArchivos cda = new CodDecodArchivos();
    RestTemplate restTemplate = new RestTemplate();
    HttpHeaders headers = new HttpHeaders();
    Bufer bufer = new Bufer();
    byte[] buffer = null;
    ResponseEntity<byte[]> response;

    restTemplate.getMessageConverters().add(new ByteArrayHttpMessageConverter());
    headers.setAccept(Arrays.asList(MediaType.ALL));
    HttpEntity<String> entity = new HttpEntity<>(headers);

    response = restTemplate.exchange(/*from  ww w  .  ja va2 s.  com*/
            "http://localhost:8080/ServicioDW4J/expediente/buscarFisicoDocumento/21593", HttpMethod.GET, entity,
            byte[].class);

    if (response.getStatusCode().equals(HttpStatus.OK)) {
        buffer = response.getBody();
        FileOutputStream output = new FileOutputStream(new File("c:/documentos/archivo.cod"));
        IOUtils.write(response.getBody(), output);
        cda.decodificar("c:/documentos/archivo.cod", "c:/documentos/archivo.pdf");
    }

}

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

@RequestMapping(value = "/nota", method = RequestMethod.GET)
public ResponseEntity<?> getByNotaCredito(@RequestParam("idNota") int idNota) {
    List<DetalleNotaCredito> list = facadeService.getDetalleNotaCreditoDAO().getByNotaCredito(idNota);
    if (!list.isEmpty()) {
        return new ResponseEntity<>(list, HttpStatus.OK);
    } else {//from w w  w.j  a  va  2  s . c o m
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }
}

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

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<Marcas> marcas = facadeService.getMarcasDAO().getAll();
    if (!marcas.isEmpty()) {
        return new ResponseEntity<>(marcas, HttpStatus.OK);
    } else {//from ww  w .j  a  v a2  s . c o m
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

From source file:gt.dakaik.rest.impl.CountryImpl.java

@Override
public ResponseEntity<Country> findById(int idUsuario, String token, Long id)
        throws EntidadNoEncontradaException {
    Country p = repoCountry.findOne(id);

    if (p != null) {
        return new ResponseEntity(p, HttpStatus.OK);
    } else {/*from ww  w.  j  ava2  s.c om*/
        throw new EntidadNoEncontradaException("Entity User");
    }
}

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

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<PlanPago> list = facadeService.getPlanPagoDAO().getAll();
    if (!list.isEmpty()) {
        return new ResponseEntity<>(list, HttpStatus.OK);
    } else {//ww w  .j a  va  2 s . c  om
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

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

/**
 *
 * @return/*from  w  w w  .  j  av  a2 s  . c  o  m*/
 */
@RequestMapping(value = "/all", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<List<Fabricantes>> getFabricantes() {
    List<Fabricantes> u = se.getFabricantes();
    return new ResponseEntity<>(u, HttpStatus.OK);
}

From source file:com.enginizer.controller.MailingResource.java

@RequestMapping(value = "/sendEmail", method = RequestMethod.POST)
@CrossOrigin(origins = { "http://localhost:80", "http://uc8.co:80", "http://uc8.co", "http://localhost" })
public ResponseEntity<String> sendEMAIL(@ModelAttribute("email") Email email) {
    try {//from w  ww .j a  va 2 s .  c om
        mailSender.sendEmail(email);
        return new ResponseEntity<>(HttpStatus.OK);
    } catch (MailException e) {
        return new ResponseEntity<>(e.getMessage(), HttpStatus.valueOf(e.getStatus()));
    }
}

From source file:se.sawano.scala.examples.scalaspringmvc.JavaScalaController.java

@RequestMapping(value = "/indata", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)
public void receiveData(@RequestBody @Valid ScalaIndata indata) {
    logger.debug("Got valid POSTed data: {}", indata);
}